answer stringlengths 15 1.25M |
|---|
/*
* @(#)pres_condition.h generated by: makeheader Mon Dec 3 23:08:15 2007
*
* built from: condition.ifc
*/
#ifndef pres_condition_h
#define pres_condition_h
#ifndef pres_dll_h
#include "pres/pres_dll.h"
#endif
#ifndef osapi_type_h
#include "osapi/osapi_type.h"
#endif
#ifndef osapi_time_h
#include "osapi/osapi_ntptime.h"
#endif
#ifndef osapi_semaphore_h
#include "osapi/osapi_semaphore.h"
#endif
#ifndef <API key>
#include "reda/reda_sequenceNumber.h"
#endif
#ifndef reda_inlineList_h
#include "reda/reda_inlineList.h"
#endif
typedef enum {
TRIGGER_VALUE_FALSE = 0x00,
TRIGGER_VALUE_TRUE = 0x01,
<API key> = 0x02
} <API key>;
struct PRESWaitSet;
struct WaitSetNode {
struct REDAInlineListNode _node;
struct PRESWaitSet *_presWaitSetPtr;
};
/*e \ingroup PRESConditionModule
* \brief A Condition.
*/
struct PRESCondition {
RTIBool _triggerValue;
struct REDAInlineList _waitSetList;
struct REDAExclusiveArea* _ea;
void *_userObject;
};
extern PRESDllExport
RTIBool <API key>(struct PRESCondition *self,
struct REDAWorker* worker);
extern PRESDllExport
void <API key>(struct PRESCondition *self,
void *userObject,
struct REDAExclusiveArea* ea,
struct REDAWorker* worker);
#endif /* pres_condition_h */ |
package com.grarak.kerneladiutor.fragments.information;
// imports
import android.content.res.Configuration;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.bvalosek.cpuspy.CpuSpyApp;
import com.bvalosek.cpuspy.CpuStateMonitor;
import com.grarak.kerneladiutor.R;
import com.grarak.kerneladiutor.elements.CardViewItem;
import com.grarak.kerneladiutor.fragments.<API key>;
import com.grarak.kerneladiutor.utils.Constants;
import com.grarak.kerneladiutor.utils.Utils;
import java.util.ArrayList;
import java.util.List;
/**
* main activity class
*/
public class <API key> extends <API key> implements Constants {
private CpuSpyApp cpuSpyApp;
private CardViewItem.DCardView uptimeCard;
private CardViewItem.DCardView frequencyCard;
private CardViewItem.DCardView additionalCard;
private LinearLayout _uiStatesView;
@Override
public int getSpan() {
int orientation = Utils.<API key>(getActivity());
if (Utils.isTablet(getActivity()))
return orientation == Configuration.<API key> ? 1 : 2;
return 1;
}
@Override
public boolean showApplyOnBoot() {
return false;
}
/**
* whether or not we're updating the data in the background
*/
private boolean _updatingData;
/**
* Initialize the Fragment
*/
@Override
public void init(Bundle savedInstanceState) {
super.init(savedInstanceState);
View view = LayoutInflater.from(getActivity()).inflate(R.layout.<API key>, container, false);
_uiStatesView = (LinearLayout) view.findViewById(R.id.ui_states_view);
uptimeCard = new CardViewItem.DCardView();
uptimeCard.setTitle(getString(R.string.uptime));
frequencyCard = new CardViewItem.DCardView();
frequencyCard.setTitle(getString(R.string.frequency_table));
frequencyCard.setView(view);
additionalCard = new CardViewItem.DCardView();
additionalCard.setTitle(getString(R.string.unused_cpu_states));
// see if we're updating data during a config change (rotate
// screen)
if (savedInstanceState != null)
_updatingData = savedInstanceState.getBoolean("updatingData");
cpuSpyApp = new CpuSpyApp();
if (isAdded()) refreshData();
addView(uptimeCard);
addView(frequencyCard);
}
/**
* When the activity is about to change orientation
*/
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean("updatingData", _updatingData);
}
/**
* called when we want to inflate the menu
*/
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.<API key>, menu);
super.onCreateOptionsMenu(menu, inflater);
}
/**
* called to handle a menu event
*/
@Override
public boolean <API key>(MenuItem item) {
// what it do maybe
switch (item.getItemId()) {
/* pressed the load menu button */
case R.id.menu_refresh:
refreshData();
break;
case R.id.menu_reset:
try {
cpuSpyApp.getCpuStateMonitor().setOffsets();
} catch (CpuStateMonitor.<API key> e) {
e.printStackTrace();
}
cpuSpyApp.saveOffsets(getActivity());
updateView();
break;
case R.id.menu_restore:
cpuSpyApp.getCpuStateMonitor().removeOffsets();
cpuSpyApp.saveOffsets(getActivity());
updateView();
break;
}
// made it
return true;
}
/**
* Generate and update all UI elements
*/
private void updateView() {
if (!isAdded()) return;
/**
* Get the CpuStateMonitor from the app, and iterate over all states,
* creating a row if the duration is > 0 or otherwise marking it in
* extraStates (missing)
*/
CpuStateMonitor monitor = cpuSpyApp.getCpuStateMonitor();
_uiStatesView.removeAllViews();
List<String> extraStates = new ArrayList<>();
for (CpuStateMonitor.CpuState state : monitor.getStates()) {
if (state.duration > 0) {
addView(frequencyCard);
try {
generateStateRow(state, _uiStatesView);
} catch (<API key> e) {
e.printStackTrace();
}
} else
extraStates.add(state.freq == 0 ? getString(R.string.deep_sleep) : state.freq / 1000
+ getString(R.string.mhz));
}
// show the red warning label if no states found
if (monitor.getStates().size() == 0) {
removeView(uptimeCard);
removeView(frequencyCard);
}
// update the total state time
long totTime = monitor.getTotalStateTime() / 100;
uptimeCard.setDescription(sToString(totTime));
// for all the 0 duration states, add the the Unused State area
if (extraStates.size() > 0) {
int n = 0;
String str = "";
for (String s : extraStates) {
if (n++ > 0) str += ", ";
str += s;
}
addView(additionalCard);
additionalCard.setDescription(str);
} else removeView(additionalCard);
}
/**
* Attempt to update the time-in-state info
*/
private void refreshData() {
if (!_updatingData) new <API key>().execute((Void) null);
}
/**
* @return A nicely formatted String representing tSec seconds
*/
private static String sToString(long tSec) {
long h = (long) Math.floor(tSec / (60 * 60));
long m = (long) Math.floor((tSec - h * 60 * 60) / 60);
long s = tSec % 60;
String sDur;
sDur = h + ":";
if (m < 10) sDur += "0";
sDur += m + ":";
if (s < 10) sDur += "0";
sDur += s;
return sDur;
}
/**
* View that corresponds to a CPU freq state row as specified by
* the state parameter
*/
private void generateStateRow(CpuStateMonitor.CpuState state, ViewGroup parent) {
// inflate the XML into a view in the parent
LinearLayout layout = (LinearLayout) LayoutInflater.from(getActivity())
.inflate(R.layout.state_row, parent, false);
// what percentage we've got
CpuStateMonitor monitor = cpuSpyApp.getCpuStateMonitor();
float per = (float) state.duration * 100 / monitor.getTotalStateTime();
String sPer = (int) per + "%";
// state name
String sFreq = state.freq == 0 ? getString(R.string.deep_sleep) : state.freq / 1000 + "MHz";
// duration
long tSec = state.duration / 100;
String sDur = sToString(tSec);
// map UI elements to objects
TextView freqText = (TextView) layout.findViewById(R.id.ui_freq_text);
TextView durText = (TextView) layout.findViewById(R.id.ui_duration_text);
TextView perText = (TextView) layout.findViewById(R.id.ui_percentage_text);
ProgressBar bar = (ProgressBar) layout.findViewById(R.id.ui_bar);
// modify the row
freqText.setText(sFreq);
perText.setText(sPer);
durText.setText(sDur);
bar.setProgress(Math.round(per));
// add it to parent and return
parent.addView(layout);
}
/**
* Keep updating the state data off the UI thread for slow devices
*/
private class <API key> extends AsyncTask<Void, Void, Void> {
/**
* Stuff to do on a separate thread
*/
@Override
protected Void doInBackground(Void... v) {
CpuStateMonitor monitor = cpuSpyApp.getCpuStateMonitor();
try {
monitor.updateStates();
} catch (CpuStateMonitor.<API key> e) {
Log.e(TAG, "FrequencyTable: Problem getting CPU states");
}
return null;
}
/**
* Executed on the UI thread right before starting the task
*/
@Override
protected void onPreExecute() {
Log.i(TAG, "FrequencyTable: Starting data update");
_updatingData = true;
}
/**
* Executed on UI thread after task
*/
@Override
protected void onPostExecute(Void v) {
Log.i(TAG, "FrequencyTable: Finished data update");
_updatingData = false;
updateView();
}
}
} |
import React from 'react';
import { Form, Formik, FormikHelpers } from 'formik';
import JSZip from 'jszip';
import FileSaver from 'file-saver';
import Environment from './Environment';
import Page from './Page';
import Header from './Header';
import Layout from './Layout';
import Styles from './Styles';
import Cover from './Cover';
import Other from './Other';
import Metadata from './Metadata';
import Download from './Download';
import { getInitValues, toPluginModel, Values } from './common';
import Generator from '../../generator';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from '<API key>';
import { SaxonJS } from '../../types/saxon-js';
declare global {
interface Window {
SaxonJS: SaxonJS;
}
}
const onSubmit = (values: Values, actions: FormikHelpers<Values>) => {
actions.setSubmitting(false);
const model = toPluginModel(values);
const generator = new Generator(model, window.SaxonJS);
const zip = new JSZip();
generator.generate_plugin(zip);
zip
.generateAsync({
type: 'blob',
platform: 'UNIX',
})
.then((zipData) => FileSaver.saveAs(zipData, `${model.id}.zip`));
};
export default function App() {
return (
<DndProvider backend={HTML5Backend}>
<Formik initialValues={getInitValues()} onSubmit={onSubmit}>
<Form>
<Environment />
<Page />
<Header />
<Layout />
<Styles />
<Cover />
<Other />
<Metadata />
<Download />
</Form>
</Formik>
</DndProvider>
);
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using UIControls;
namespace UITests
{
<summary>
Interaction logic for MainWindow.xaml
</summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
//foreach (ListBoxItem item in thelist.Items)
// DependencyObject d = GetTemplateChild("<API key>");
// if (d != null)
// (d as Button).Click += new RoutedEventHandler(<API key>);
CopyBase.Forms.Models.CopyItem item = new CopyBase.Forms.Models.CopyItem("theitemName");
//thelist.Items.Add(item);
StaticUICommands.OnDelete += theitem_Clear;
Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(() =>
{
var workingArea = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea;
var transform = PresentationSource.FromVisual(this).CompositionTarget.TransformFromDevice;
var corner = transform.Transform(new Point(workingArea.Right, workingArea.Bottom));
this.Left = corner.X - this.ActualWidth - 100;
this.Top = corner.Y - this.ActualHeight;
}));
}
private void theitem_Clear(object item, EventArgs e)
{
try
{
//thelist.Items.Remove(item);
}
catch (Exception ex)
{
throw ex;
}
}
}
} |
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Weixin_Server.MPServer.Helper;
namespace Weixin_Server.MPServer
{
public partial class MPserverAPI : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string sOpenId = Request["OpenId"];
string sFakeId = Request["FakeId"];
string sDo = Request["Do"];
string sSession = Request["Session"];
if (string.IsNullOrWhiteSpace(sOpenId) || string.IsNullOrWhiteSpace(sFakeId))
{
Response.Write("null");
Response.End();
}
switch (sDo)
{
case "Add":
DelSession(sOpenId);
AddSession(sOpenId,sFakeId,sSession);
Response.Write("add");
break;
case "Del":
DelSession(sOpenId);
Response.Write("del");
break;
case "Check":
if (CheckSession(sOpenId, sSession))
{
Response.Write("yse");
}
else
{
Response.Write("no");
}
break;
}
Response.End();
}
private void AddSession(string sOpenId,string sFakeId,string sSession)
{
string sSql = string.Format("INSERT INTO `mpserver_session` (`session`, `time`, `user`, `other`) VALUES ('{0}', '{1}', '{2}', '{3}')",
sSession,DateTime.Now,sOpenId,sFakeId);
CDBAccess.MySqlDt(sSql);
}
private void DelSession(string sOpenId)
{
string sSql = string.Format("DELETE FROM `mpserver_session` WHERE (`User`='{0}')",sOpenId);
CDBAccess.MySqlDt(sSql);
}
private bool CheckSession(string sOpenId,string sSession)
{
string sSql = string.Format("SELECT * FROM `mpserver_session` WHERE `User` = '{0}' AND `session` = '{1}'", sOpenId,sSession);
DataTable dt = CDBAccess.MySqlDt(sSql);
if (dt.Rows.Count <= 0)
{
return false;
}
else
{
DateTime dtTime = (DateTime)dt.Rows[0]["time"];
if ((DateTime.Now - dtTime).TotalSeconds <= 300)
{
return true;
}
else
{
DelSession(sOpenId);
return true;
}
}
}
}
} |
package net.oschina.app.team.fragment;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import com.loopj.android.http.<API key>;
import net.oschina.app.AppContext;
import net.oschina.app.R;
import net.oschina.app.api.remote.OSChinaApi;
import net.oschina.app.base.BaseFragment;
import net.oschina.app.cache.CacheManager;
import net.oschina.app.team.adapter.TeamMemberAdapter;
import net.oschina.app.team.bean.Team;
import net.oschina.app.team.bean.TeamMember;
import net.oschina.app.team.bean.TeamMemberList;
import net.oschina.app.team.ui.TeamMainActivity;
import net.oschina.app.ui.empty.EmptyLayout;
import net.oschina.app.util.UIHelper;
import net.oschina.app.util.XmlUtils;
import org.kymjs.kjframe.http.KJAsyncTask;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
import cz.msebera.android.httpclient.Header;
/**
*
*
* @author kymjs (kymjs123@gmail.com)
*
*/
public class TeamMemberFragment extends BaseFragment {
@Bind(R.id.fragment_team_grid)
GridView mGrid;
@Bind(R.id.fragment_team_empty)
EmptyLayout mEmpty;
@Bind(R.id.swiperefreshlayout)
SwipeRefreshLayout mSwipeRefreshLayout;
private Activity aty;
private Team team;
private List<TeamMember> datas = null;
private long preRefreshTime;
private TeamMemberAdapter adapter;
public static final String TEAM_MEMBER_FILE = "<API key>";
public static String TEAM_MEMBER_KEY = "<API key>";
public static String TEAM_MEMBER_DATA = "<API key>";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle bundle = getArguments();
if (bundle != null) {
team = (Team) bundle
.getSerializable(TeamMainActivity.BUNDLE_KEY_TEAM);
}
TEAM_MEMBER_KEY += team.getId();
TEAM_MEMBER_DATA += team.getId();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View rootView = inflater.inflate(R.layout.<API key>,
container, false);
aty = getActivity();
ButterKnife.bind(this, rootView);
TeamMemberList list = (TeamMemberList) CacheManager.readObject(aty,
TEAM_MEMBER_DATA);
if (list == null) {
initData();
} else {
datas = list.getList();
adapter = new TeamMemberAdapter(aty, datas, team);
mGrid.setAdapter(adapter);
}
initView(rootView);
return rootView;
}
@Override
public void onClick(View v) {}
@Override
public void initView(View view) {
mEmpty.setErrorType(EmptyLayout.HIDE_LAYOUT);
mEmpty.<API key>(new View.OnClickListener() {
@Override
public void onClick(View v) {
refurbish(true);
}
});
mGrid.<API key>(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
UIHelper.showTeamMemberInfo(aty, team.getId(),
datas.get(position));
}
});
mSwipeRefreshLayout.<API key>(new OnRefreshListener() {
@Override
public void onRefresh() {
if (mState == STATE_REFRESH) {
return;
}
refurbish(false);
}
});
mSwipeRefreshLayout.<API key>(
R.color.swiperefresh_color1, R.color.swiperefresh_color2,
R.color.swiperefresh_color3, R.color.swiperefresh_color4);
}
@Override
public void initData() {
refurbish(true);
}
private void refurbish(final boolean isFirst) {
final long currentTime = System.currentTimeMillis();
if (currentTime - preRefreshTime < 100000) {
<API key>();
return;
}
OSChinaApi.getTeamMemberList(team.getId(),
new <API key>() {
@Override
public void onStart() {
super.onStart();
// <API key>();
if (isFirst) {
mEmpty.setErrorType(EmptyLayout.NETWORK_LOADING);
}
}
@Override
public void onSuccess(int arg0, Header[] arg1,
final byte[] arg2) {
KJAsyncTask.execute(new Runnable() {
@Override
public void run() {
TeamMemberList list = XmlUtils.toBean(
TeamMemberList.class, arg2);
CacheManager.saveObject(aty, list,
TEAM_MEMBER_DATA);
datas = list.getList();
aty.runOnUiThread(new Runnable() {
@Override
public void run() {
if (adapter == null) {
adapter = new TeamMemberAdapter(
aty, datas, team);
mGrid.setAdapter(adapter);
} else {
adapter.refresh(datas);
}
preRefreshTime = currentTime;
if (isFirst) {
mEmpty.setErrorType(EmptyLayout.HIDE_LAYOUT);
}
<API key>();
}
});
}
});
}
@Override
public void onFailure(int arg0, Header[] arg1, byte[] arg2,
Throwable arg3) {
AppContext.showToast("");
if (isFirst) {
mEmpty.setErrorType(EmptyLayout.NETWORK_ERROR);
}
<API key>();
}
});
}
private void <API key>() {
mState = STATE_REFRESH;
if (mSwipeRefreshLayout != null) {
mSwipeRefreshLayout.setRefreshing(true);
mSwipeRefreshLayout.setEnabled(false);
}
}
private void <API key>() {
mState = STATE_NOMORE;
if (mSwipeRefreshLayout != null) {
mSwipeRefreshLayout.setRefreshing(false);
mSwipeRefreshLayout.setEnabled(true);
}
}
} |
package fr.javatronic.blog.massive.annotation1.sub1;
import fr.javatronic.blog.processor.Annotation_001;
@Annotation_001
public class Class_2997 {
} |
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_45) on Fri Mar 06 22:15:34 CST 2015 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Class org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies.<API key>.<API key> (<API key> 2.3.0 API)
</TITLE>
<META NAME="date" CONTENT="2015-03-06">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies.<API key>.<API key> (<API key> 2.3.0 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<A NAME="navbar_top"></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../../../org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/policies/<API key>.<API key>.html" title="class in org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../../../../index.html?org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/policies//<API key>.<API key>.html" target="_top"><B>FRAMES</B></A>
<A HREF="<API key>.<API key>.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies.<API key>.<API key></B></H2>
</CENTER>
No usage of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies.<API key>.<API key>
<P>
<HR>
<A NAME="navbar_bottom"></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../../../org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/policies/<API key>.<API key>.html" title="class in org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../../../../index.html?org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/policies//<API key>.<API key>.html" target="_top"><B>FRAMES</B></A>
<A HREF="<API key>.<API key>.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
Copyright &
</BODY>
</HTML> |
package couchdb
import (
"context"
"encoding/json"
"fmt"
"net/http"
"github.com/go-kivik/couchdb/v3/chttp"
"github.com/go-kivik/kivik/v3/driver"
)
func (d *db) CreateIndex(ctx context.Context, ddoc, name string, index interface{}) error {
indexObj, err := deJSONify(index)
if err != nil {
return err
}
parameters := struct {
Index interface{} `json:"index"`
Ddoc string `json:"ddoc,omitempty"`
Name string `json:"name,omitempty"`
}{
Index: indexObj,
Ddoc: ddoc,
Name: name,
}
opts := &chttp.Options{
Body: chttp.EncodeBody(parameters),
}
_, err = d.Client.DoError(ctx, http.MethodPost, d.path("_index"), opts)
return err
}
func (d *db) GetIndexes(ctx context.Context) ([]driver.Index, error) {
var result struct {
Indexes []driver.Index `json:"indexes"`
}
_, err := d.Client.DoJSON(ctx, http.MethodGet, d.path("_index"), nil, &result)
return result.Indexes, err
}
func (d *db) DeleteIndex(ctx context.Context, ddoc, name string) error {
if ddoc == "" {
return missingArg("ddoc")
}
if name == "" {
return missingArg("name")
}
path := fmt.Sprintf("_index/%s/json/%s", ddoc, name)
_, err := d.Client.DoError(ctx, http.MethodDelete, d.path(path), nil)
return err
}
func (d *db) Find(ctx context.Context, query interface{}) (driver.Rows, error) {
opts := &chttp.Options{
GetBody: chttp.BodyEncoder(query),
Header: http.Header{
chttp.<API key>: []string{},
},
}
resp, err := d.Client.DoReq(ctx, http.MethodPost, d.path("_find"), opts)
if err != nil {
return nil, err
}
if err = chttp.ResponseError(resp); err != nil {
return nil, err
}
return newFindRows(ctx, resp.Body), nil
}
type queryPlan struct {
DBName string `json:"dbname"`
Index map[string]interface{} `json:"index"`
Selector map[string]interface{} `json:"selector"`
Options map[string]interface{} `json:"opts"`
Limit int64 `json:"limit"`
Skip int64 `json:"skip"`
Fields fields `json:"fields"`
Range map[string]interface{} `json:"range"`
}
type fields []interface{}
func (f *fields) UnmarshalJSON(data []byte) error {
if string(data) == `"all_fields"` {
return nil
}
var i []interface{}
if err := json.Unmarshal(data, &i); err != nil {
return err
}
newFields := make([]interface{}, len(i))
copy(newFields, i)
*f = newFields
return nil
}
func (d *db) Explain(ctx context.Context, query interface{}) (*driver.QueryPlan, error) {
opts := &chttp.Options{
GetBody: chttp.BodyEncoder(query),
Header: http.Header{
chttp.<API key>: []string{},
},
}
var plan queryPlan
if _, err := d.Client.DoJSON(ctx, http.MethodPost, d.path("_explain"), opts, &plan); err != nil {
return nil, err
}
return &driver.QueryPlan{
DBName: plan.DBName,
Index: plan.Index,
Selector: plan.Selector,
Options: plan.Options,
Limit: plan.Limit,
Skip: plan.Skip,
Fields: plan.Fields,
Range: plan.Range,
}, nil
} |
package com.cadasta.murad.fragments;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.cadasta.murad.CadastaApplication;
import com.cadasta.murad.R;
import com.cadasta.murad.activities.<API key>;
import com.cadasta.murad.activities.EditProfileActivity;
import com.cadasta.murad.activities.SignInActivity;
import com.cadasta.murad.backend.clients.RestClient;
import com.cadasta.murad.models.account.Account;
import com.squareup.picasso.Picasso;
import butterknife.BindView;
import butterknife.OnClick;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
/**
* A simple {@link BaseFragment} subclass.
*/
public class ProfileFragment extends BaseFragment {
public static final String TAG = ProfileFragment.class.getSimpleName();
@BindView(R.id.profile_avatar) ImageView profileAvatar;
@BindView(R.id.profile_username) TextView profileUserName;
@BindView(R.id.profile_name) TextView profileName;
@BindView(R.id.profile_email) TextView profileEmail;
private Call<Account> fetchAccount;
private SharedPreferences sharedPreferences;
private SharedPreferences.Editor editor;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
return view;
}
@Override
protected int getLayoutResource() {
return R.layout.fragment_profile;
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
fetchAccount = new RestClient().getAccountService().getAccount();
fetchAccount.enqueue(new Callback<Account>() {
@Override
public void onResponse(Call<Account> call, Response<Account> response) {
if (response.code() == 200) {
String avatar = response.body().getAvatar();
String username = response.body().getUsername();
String name = response.body().getFullName();
String email = response.body().getEmail();
if (avatar != null) {
Picasso.with(getActivity().<API key>()).load(avatar).into(profileAvatar);
}
profileUserName.setText(username);
profileName.setText(name);
profileEmail.setText(email);
}
}
@Override
public void onFailure(Call<Account> call, Throwable t) {
}
});
}
@OnClick(R.id.edit_profile)
void editProfile() {
Intent i = new Intent(getActivity(), EditProfileActivity.class);
startActivity(i);
}
@OnClick(R.id.change_password)
void changePassword() {
Intent i = new Intent(getActivity(), <API key>.class);
startActivity(i);
}
@OnClick(R.id.logout)
void logout() {
sharedPreferences = PreferenceManager.<API key>(CadastaApplication.getAppContext());
editor = sharedPreferences.edit();
editor.clear();
editor.apply();
Intent i = new Intent(getActivity(), SignInActivity.class);
startActivity(i);
getActivity().finish();
}
@Override
public void onDestroyView() {
super.onDestroyView();
fetchAccount.cancel();
}
} |
package com.leetcode.aaront;
import java.util.Arrays;
/**
* @author tonyhui
* @since 16/3/20
*/
public class ContainsDuplicate {
public static void main(String[] args) {
int[] nums = new int[30000];
for(int i = 0;i<30000;i++)nums[i] = i;
containsDuplicate2(nums);
}
public static boolean containsDuplicate(int[] nums) {
long start = System.currentTimeMillis();
for (int i = 0; i < nums.length; i++) {
for (int j = 0; j < nums.length; j++) {
if (nums[j] == nums[i] && i != j) return true;
}
}
long end = System.currentTimeMillis();
System.out.println(end-start);
return false;
}
public static boolean containsDuplicate2(int[] nums){
long start = System.currentTimeMillis();
Arrays.sort(nums);
for(int i = 0;i<nums.length-1;i++){
if(nums[i] == nums[i+1])return true;
}
long end = System.currentTimeMillis();
System.out.println(end-start);
return false;
}
} |
package Stacks;
import java.util.<API key>;
public class StackWithArray {
private Object[] items;
private int count;
public StackWithArray(){
items = new Object[1];
}
public void push(Object item){
if(count == items.length){
resize(items.length * 2);
}
items[count] = item;
count++;
}
public Object pop(){
if(isEmpty()){
throw new <API key>("Stack underflow");
}
Object temp = items[--count];
items[count] = null;
if(items.length / 4 == count){
resize(items.length / 2);
}
return temp;
}
public boolean isEmpty(){
return count == 0;
}
public Object peek(){
return items[count-1];
}
public void resize(int capacity){
Object[] tempArray = new Object[capacity];
for(int i = 0;i < count; i++){
tempArray[i] = items[i];
}
items = tempArray;
}
} |
using System;
using AVF.CourseParticipation.Models;
using AVF.CourseParticipation.ViewModels;
using Xamarin.Forms;
namespace AVF.CourseParticipation.Views
{
public partial class CalenderPage
{
private int _monthsNavigated = 0;
public CalenderPage()
{
InitializeComponent();
}
private void <API key>(object sender, EventArgs e)
{
Calendar.PreviousMonth();
_monthsNavigated
}
private void <API key>(object sender, EventArgs e)
{
Calendar.NextMonth();
_monthsNavigated++;
}
private void <API key>(object sender, EventArgs e)
{
SetToday();
}
private void SetToday()
{
Calendar.SelectedDate = DateTime.Now;
if (_monthsNavigated < 0)
{
for (int i = 0; i < _monthsNavigated * -1; i++)
{
Calendar.NextMonth();
}
_monthsNavigated = 0;
}
if (_monthsNavigated > 0)
{
for (int i = 0; i < _monthsNavigated; i++)
{
Calendar.PreviousMonth();
}
_monthsNavigated = 0;
}
}
protected override bool OnBackButtonPressed()
{
((<API key>) BindingContext).Logout();
return true; // Disable back button
}
private void <API key>(object sender, EventArgs e)
{
ButtonSelectCourse.Focus();
}
public override void KeyPressed(KeyEventArgs keyEventArgs)
{
if (keyEventArgs.Key == "Enter")
{
ButtonSelectCourse.Command.Execute(null);
}
var previousDate = Calendar.SelectedDate ?? DateTime.Now;
if (keyEventArgs.Key == "Down")
{
Calendar.SelectedDate = Calendar.SelectedDate + new TimeSpan(1, 0, 0, 0);
}
if (keyEventArgs.Key == "Up")
{
Calendar.SelectedDate = Calendar.SelectedDate - new TimeSpan(1, 0, 0, 0);
}
if (keyEventArgs.Key == "Right")
{
var currentDate = Calendar.SelectedDate ?? DateTime.Now;
var newYear = currentDate.Year;
var newMonth = currentDate.Month+1;
if (newMonth == 13)
{
newMonth = 1;
newYear++;
}
Calendar.SelectedDate = new DateTime(newYear, newMonth, 1);
}
if (keyEventArgs.Key == "Left")
{
var currentDate = Calendar.SelectedDate ?? DateTime.Now;
var newYear = currentDate.Year;
var newMonth = currentDate.Month + -1;
if (newMonth == 0)
{
newMonth = 12;
newYear
}
Calendar.SelectedDate = new DateTime(newYear, newMonth, 1);
}
if (keyEventArgs.Key == "Home")
{
SetToday();
}
var selectedDate = Calendar.SelectedDate ?? DateTime.Now;
var previousYearMonth = previousDate.Year.ToString() + previousDate.Month.ToString().PadLeft(2, '0');
var selectedYearMonth = selectedDate.Year.ToString() + selectedDate.Month.ToString().PadLeft(2, '0');
if (string.Compare(selectedYearMonth, previousYearMonth, StringComparison.Ordinal) > 0)
{
Calendar.NextMonth();
_monthsNavigated++;
}
if (string.Compare(selectedYearMonth, previousYearMonth, StringComparison.Ordinal) < 0)
{
Calendar.PreviousMonth();
_monthsNavigated
}
}
}
} |
package ca.uhn.fhir.jpa.dao.r4;
import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao;
import ca.uhn.fhir.jpa.subscription.<API key>;
import ca.uhn.fhir.rest.server.exceptions.<API key>;
import ca.uhn.fhir.util.TestUtil;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.Subscription;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
public class <API key> extends BaseJpaR4Test {
@Autowired
private <API key> <API key>;
@AfterEach
public void afterResetDao() {
myDaoConfig.<API key>(new DaoConfig().<API key>());
BaseHapiFhirDao.<API key>(false);
}
@AfterEach
public void <API key>() {
<API key>.<API key>();
}
@BeforeEach
public void <API key>() {
<API key>.<API key>();
}
@Test
public void <API key>() {
Subscription s = new Subscription();
s.setStatus(Subscription.SubscriptionStatus.OFF);
s.setCriteria("FOO");
IIdType id = mySubscriptionDao.create(s).getId().toUnqualified();
s = mySubscriptionDao.read(id);
assertEquals("FOO", s.getCriteria());
s.setStatus(Subscription.SubscriptionStatus.REQUESTED);
try {
mySubscriptionDao.update(s);
fail();
} catch (<API key> e) {
assertEquals("Subscription.criteria must be in the form \"{Resource Type}?[params]\"", e.getMessage());
}
}
} |
package jp.gr.java_conf.ya.shiobeforandroid2;
import java.io.File;
import java.io.FileInputStream;
import java.io.<API key>;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.<API key>;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import jp.gr.java_conf.ya.shiobeforandroid2.util.CheckNetworkUtil;
import jp.gr.java_conf.ya.shiobeforandroid2.util.HttpsClient;
import jp.gr.java_conf.ya.shiobeforandroid2.util.MyCrypt;
import jp.gr.java_conf.ya.shiobeforandroid2.util.StringUtil;
import jp.gr.java_conf.ya.shiobeforandroid2.util.WriteLog;
import twitter4j.PagableResponseList;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.User;
import twitter4j.auth.AccessToken;
import twitter4j.auth.OAuthAuthorization;
import twitter4j.auth.RequestToken;
import twitter4j.conf.Configuration;
import twitter4j.conf.<API key>;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.<API key>;
import android.graphics.Bitmap;
import android.media.MediaPlayer;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.StrictMode;
import android.preference.PreferenceManager;
import android.telephony.TelephonyManager;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.EditText;
import android.widget.TextView;
public class <API key> extends Activity {
private final class FileCheck_font implements FilenameFilter {
@Override
public final boolean accept(final File dir, final String strfilename) {
if (( strfilename.endsWith(".ttf") ) || ( strfilename.endsWith(".ttc") ) || ( strfilename.endsWith(".otf") ) || ( strfilename.endsWith(".otc") ) || ( strfilename.endsWith(".zip") )) {
return true;
} else {
return false;
}
}
}
private final class FileCheckPrefXml implements FilenameFilter {
@Override
public final boolean accept(final File dir, final String strfilename) {
if (strfilename.contains(getPackageName()) && ( strfilename.endsWith(".xml") || strfilename.endsWith(".xml.bin") )) {
return true;
} else {
return false;
}
}
}
private ListAdapter adapter;
private boolean timeout = true;
private final CheckNetworkUtil checkNetworkUtil = new CheckNetworkUtil(this);
private int <API key> = 0;
private int pref_timeout_so = 0;
private int <API key>;
private int <API key>;
private OAuthAuthorization oAuthAuthorization;
private RequestToken requestToken;
private SharedPreferences pref_app;
private SharedPreferences pref_twtr;
private static final String CALLBACK_URL = "myapp://oauth";
private static String consumerKey = "";
private static String consumerSecret = "";
private String crpKey = "";
private String Status;
private TextView textView1;
private Twitter twitter;
private WebView webView1;
private final void connectTwitter() throws TwitterException {
if (checkNetworkUtil.isConnected() == false) {
adapter.toast(getString(R.string.<API key>));
return;
}
pref_app = PreferenceManager.<API key>(this);
final String pref_consumerKey = pref_app.getString("pref_consumerkey", "");
final String pref_consumerSecret = pref_app.getString("pref_consumersecret", "");
final Boolean <API key> = pref_app.getBoolean("<API key>", false);
if (( <API key> == true ) && ( pref_consumerKey.equals("") == false ) && ( pref_consumerSecret.equals("") == false )) {
consumerKey = pref_consumerKey.replaceAll(" ", "").replaceAll("\r", "").replaceAll("\n", "");
consumer<API key>.replaceAll(" ", "").replaceAll("\r", "").replaceAll("\n", "");
} else {
consumerKey = getString(R.string.default_consumerKey);
consumerSecret = getString(R.string.<API key>);
adapter.toast(getString(R.string.consumerkey_default));
}
if (pref_consumerKey.equals("") || pref_consumerSecret.equals("")) {
adapter.toast(getString(R.string.<API key>));
pref_app = PreferenceManager.<API key>(this);
final EditText editText = new EditText(this);
if (( pref_consumerKey.equals("") == false ) && ( pref_consumerSecret.equals("") == false )) {
editText.setText(pref_consumerKey + " " + pref_consumerSecret);
} else if (( pref_consumerKey.equals("") == false ) && ( pref_consumerSecret.equals("") )) {
editText.setText(pref_consumerKey + " " + getString(R.string.<API key>));
} else if (( pref_consumerKey.equals("") ) && ( pref_consumerSecret.equals("") == false )) {
editText.setText(getString(R.string.default_consumerKey) + " " + pref_consumerSecret);
} else {
editText.setText(getString(R.string.default_consumerKey) + " " + getString(R.string.<API key>));
}
new AlertDialog.Builder(this).setTitle(R.string.<API key>).setMessage(R.string.<API key>).setView(editText).setCancelable(true).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public final void onClick(final DialogInterface dialog, final int which) {
final String[] <API key> = ( editText.getText().toString() ).split(" ");
if (<API key>.length == 2) {
final SharedPreferences.Editor editor = pref_app.edit();
editor.putBoolean("<API key>", true);
editor.putString("pref_consumerkey", ( <API key>[0] ));
editor.putString("pref_consumersecret", ( <API key>[1] ));
editor.commit();
consumerKey = <API key>[0];
consumer<API key>[1];
try {
connectTwitter();
} catch (TwitterException e) {
WriteLog.write(<API key>.this, e);
}
}
}
}).create().show();
} else {
<API key> = ListAdapter.getPrefInt(this, "<API key>", "20000");
<API key> = ListAdapter.getPrefInt(this, "<API key>", "120000");
final String pref_<TwitterConsumerkey> = pref_app.getString("pref_<TwitterConsumerkey>", "0");
WriteLog.write(this, "pref_<TwitterConsumerkey>: " + pref_<TwitterConsumerkey>);
if (pref_<TwitterConsumerkey>.equals("1")) {
final <API key> confbuilder = new <API key>();
confbuilder.setOAuthConsumerKey(consumerKey);
confbuilder.<API key>(consumerSecret);
final Configuration conf = confbuilder.build();
oAuthAuthorization = new OAuthAuthorization(conf);
oAuthAuthorization.setOAuthAccessToken(null);
String authUrl = null;
try {
authUrl = oAuthAuthorization.<API key>(CALLBACK_URL).getAuthorizationURL();
} catch (final Exception e) {
return;
}
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(authUrl));
startActivity(intent);
// } else if (pref_<TwitterConsumerkey>.equals("2")) {
// final <API key> confbuilder = new <API key>();
// confbuilder.setOAuthConsumerKey(consumerKey).<API key>(consumerSecret).<API key>(<API key>).setHttpReadTimeout(<API key>);// .setUseSSL(true);
// twitter = new TwitterFactory(confbuilder.build()).getInstance();
// try {
// requestToken = twitter.<API key>(CALLBACK_URL);
// } catch (final TwitterException e) {
// WriteLog.write(this, e);
// } catch (final Exception e) {
// WriteLog.write(this, e);
// if (requestToken != null) {
// String authorizationUrl = "";
// try {
// authorizationUrl = requestToken.getAuthorizationURL();
// } catch (final Exception e) {
// if (authorizationUrl.equals("") == false) {
// final Intent intent = new Intent(this, TwitterLoginPin.class);
// intent.putExtra("auth_url", authorizationUrl);
// intent.putExtra("consumer_key", consumerKey);
// intent.putExtra("consumer_secret", consumerSecret);
// <API key>(intent, 0);
} else {
<API key> confbuilder = new <API key>();
confbuilder.setOAuthConsumerKey(consumerKey).<API key>(consumerSecret).<API key>(<API key>).setHttpReadTimeout(<API key>).setHttpRetryCount(3).<API key>(10);// .setUseSSL(true);
twitter = new TwitterFactory(confbuilder.build()).getInstance();
try {
requestToken = twitter.<API key>(CALLBACK_URL);
} catch (final TwitterException e) {
adapter.twitterException(e);
} catch (final Exception e) {
WriteLog.write(this, e);
}
if (requestToken != null) {
String authorizationUrl = "";
try {
authorizationUrl = requestToken.getAuthorizationURL();
} catch (final Exception e) {
WriteLog.write(this, e);
}
if (authorizationUrl.equals("") == false) {
final Intent intent = new Intent(this, TwitterLogin.class);
intent.putExtra("auth_url", authorizationUrl);
this.<API key>(intent, 0);
}
}
}
}
}
private final boolean copyFile(final String srcFilePath, final String dstFilePath) {
final File srcFile = new File(srcFilePath);
WriteLog.write(this, "copyFile() srcFilePath: " + srcFilePath);
final File dstFile = new File(dstFilePath);
WriteLog.write(this, "copyFile() dstFilePath: " + dstFilePath);
try {
new File(( dstFile.getParentFile() ).getPath()).mkdirs();
} catch (final Exception e) {
WriteLog.write(this, "copyFile() mkdirs() Exception: " + e.toString());
}
InputStream input;
OutputStream output = null;
try {
input = new FileInputStream(srcFile);
} catch (<API key> e) {
input = null;
WriteLog.write(this, "copyFile() input <API key>: " + e.toString());
}
try {
output = new FileOutputStream(dstFile);
} catch (final <API key> e) {
try {
input.close();
} catch (final IOException e1) {
}
input = null;
WriteLog.write(this, "copyFile() output <API key>: " + e.toString());
return false;
}
final int DEFAULT_BUFFER_SIZE = 1024 * 4;
final byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
int n = 0;
try {
while (-1 != ( n = input.read(buffer) )) {
output.write(buffer, 0, n);
}
input.close();
output.flush();
output.close();
} catch (final IOException e) {
WriteLog.write(this, "copyFile() output.write() IOException: " + e.toString());
return false;
} catch (final Exception e) {
WriteLog.write(this, "copyFile() output.write() Exception: " + e.toString());
return false;
}
return true;
}
private final void disconnectTwitter() {
pref_twtr = <API key>("Twitter_setting", MODE_PRIVATE);
final int index = Integer.parseInt(pref_twtr.getString("index", "-1"));
if (index > -1) {
final SharedPreferences.Editor editor = pref_twtr.edit();
editor.remove("consumer_key_" + Integer.toString(index));
editor.remove("consumer_secret_" + Integer.toString(index));
editor.remove("oauth_token_" + Integer.toString(index));
editor.remove("oauth_token_secret_" + Integer.toString(index));
editor.remove("profile_image_url_" + Integer.toString(index));
editor.remove("screen_name_" + Integer.toString(index));
editor.remove("status_" + Integer.toString(index));
editor.commit();
// finish();
}
WriteLog.write(this, "disconnected.");
}
private final void download(final String apkurl) {
if (checkNetworkUtil.isConnected() == false) {
adapter.toast(getString(R.string.<API key>));
return;
}
HttpURLConnection c;
try {
final URL url = new URL(apkurl);
c = (HttpURLConnection) url.openConnection();
c.setRequestMethod("GET");
c.connect();
} catch (final <API key> e) {
c = null;
} catch (final IOException e) {
c = null;
}
try {
final String PATH = Environment.<API key>() + "/";
final File file = new File(PATH);
file.mkdirs();
final File outputFile = new File(file, "ShiobeForAndroid.apk");
final FileOutputStream fos = new FileOutputStream(outputFile);
final InputStream is = c.getInputStream();
final byte[] buffer = new byte[1024];
int len = 0;
while (( len = is.read(buffer) ) != -1) {
fos.write(buffer, 0, len);
}
fos.close();
is.close();
final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(PATH + "ShiobeForAndroid.apk")), "application/vnd.android.package-archive");
startActivity(intent);
} catch (final <API key> e) {
} catch (final IOException e) {
}
}
private final boolean isConnected(final String shiobeStatus) {
if (( shiobeStatus != null ) && shiobeStatus.equals("available")) {
return true;
} else {
return false;
}
}
private final void makeShortcuts() {
pref_app = PreferenceManager.<API key>(this);
final String <API key> = pref_app.getString("<API key>", "");
final String[] urls = <API key>.split(",");
for (final String url : urls) {
if (url.startsWith(ListAdapter.TWITTER_BASE_URI)) {
adapter.makeShortcutTl("", url, url.toLowerCase(ListAdapter.LOCALE).endsWith("(s)"));
} else {
adapter.makeShortcutUri(url);
}
}
}
@Override
protected final void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if (resultCode == RESULT_OK) {
if (requestCode == 0) {
if (checkNetworkUtil.isConnected() == false) {
adapter.toast(getString(R.string.<API key>));
return;
}
try {
pref_app = PreferenceManager.<API key>(this);
final String pref_consumerKey = pref_app.getString("pref_consumerkey", "");
final String pref_consumerSecret = pref_app.getString("pref_consumersecret", "");
final Boolean <API key> = pref_app.getBoolean("<API key>", false);
if (( <API key> == true ) && ( pref_consumerKey.equals("") == false ) && ( pref_consumerSecret.equals("") == false )) {
consumerKey = pref_consumerKey.replaceAll(" ", "").replaceAll("\r", "").replaceAll("\n", "");
consumer<API key>.replaceAll(" ", "").replaceAll("\r", "").replaceAll("\n", "");
} else {
consumerKey = getString(R.string.default_consumerKey);
consumerSecret = getString(R.string.<API key>);
}
final AccessToken accessToken = twitter.getOAuthAccessToken(requestToken, intent.getExtras().getString("oauth_verifier"));
final <API key> confbuilder = new <API key>();
confbuilder.setOAuthAccessToken(accessToken.getToken()).setO<API key>(accessToken.getTokenSecret()).setOAuthConsumerKey(consumerKey).<API key>(consumerSecret).<API key>(<API key>).setHttpReadTimeout(<API key>).setHttpRetryCount(3).<API key>(10);// .setUseSSL(true);
twitter = new TwitterFactory(confbuilder.build()).getInstance();
final User user = twitter.showUser(twitter.getScreenName());
final String profile_image_url = user.getProfileImageURL().toString();
pref_twtr = <API key>("Twitter_setting", MODE_PRIVATE);
final int index = Integer.parseInt(pref_twtr.getString("index", "-1"));
if (index > -1) {
final SharedPreferences.Editor editor = pref_twtr.edit();
editor.putString("consumer_key_" + Integer.toString(index), MyCrypt.encrypt(this, crpKey, consumerKey));
editor.putString("consumer_secret_" + Integer.toString(index), MyCrypt.encrypt(this, crpKey, consumerSecret));
editor.putString("oauth_token_" + Integer.toString(index), MyCrypt.encrypt(this, crpKey, accessToken.getToken()));
editor.putString("oauth_token_secret_" + Integer.toString(index), MyCrypt.encrypt(this, crpKey, accessToken.getTokenSecret()));
editor.putString("status_" + Integer.toString(index), "available");
editor.putString("screen_name_" + Integer.toString(index), twitter.getScreenName());
editor.putString("profile_image_url_" + Integer.toString(index), profile_image_url);
editor.commit();
Intent intent2 = new Intent(this, UpdateTweet.class);
this.<API key>(intent2, 0);
}
} catch (final TwitterException e) {
}
}
}
}
@Override
public final void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().permitAll().build());
}
crpKey = getString(R.string.app_name);
final TelephonyManager telephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
crpKey += telephonyManager.getDeviceId();
crpKey += telephonyManager.getSimSerialNumber();
try {
final PackageInfo packageInfo = getPackageManager().getPackageInfo("jp.gr.java_conf.ya.shiobeforandroid2", PackageManager.GET_META_DATA);
crpKey += Long.toString(packageInfo.firstInstallTime);
} catch (final <API key> e) {
}
adapter = new ListAdapter(this, crpKey, null, null);
pref_app = PreferenceManager.<API key>(this);
final boolean <API key> = pref_app.getBoolean("<API key>", true);
final String <API key> = pref_app.getString("<API key>", "");
if (<API key> && ( <API key> != null ) && ( <API key>.equals("") == false )) {
final MediaPlayer mediaPlayer = MediaPlayer.create(this, Uri.parse(<API key>));
mediaPlayer.setLooping(false);
mediaPlayer.seekTo(0);
mediaPlayer.start();
}
<API key> = ListAdapter.getPrefInt(this, "<API key>", Integer.toString(ListAdapter.<API key>));
pref_timeout_so = ListAdapter.getPrefInt(this, "pref_timeout_so", Integer.toString(ListAdapter.default_timeout_so));
<API key> = ListAdapter.getPrefInt(this, "<API key>", "20000");
<API key> = ListAdapter.getPrefInt(this, "<API key>", "120000");
if (checkNetworkUtil.isConnected() == false) {
adapter.toast(getString(R.string.<API key>));
} else {
final Boolean <API key> = pref_app.getBoolean("<API key>", false);
if (<API key>) {
adapter.toast(getString(R.string.<API key>));
String <API key> = pref_app.getString("<API key>", ListAdapter.<API key>);
<API key> += ( <API key>.endsWith("/") ) ? "" : "/";
final String updateVerStr = HttpsClient.https2data(this, <API key> + "index.php?mode=updatecheck", <API key>, pref_timeout_so, "UTF-8");
if (updateVerStr.equals("") == false) {
long updateVer = 0;
try {
updateVer = Long.parseLong(updateVerStr);
} catch (final <API key> e) {
}
try {
final PackageInfo packageInfo = getPackageManager().getPackageInfo("jp.gr.java_conf.ya.shiobeforandroid2", PackageManager.GET_META_DATA);
if (updateVer > ( packageInfo.lastUpdateTime / 1000L )) {
final File deleteFile = new File(Environment.<API key>() + "/ShiobeForAndroid.apk");
if (deleteFile.exists()) {
deleteFile.delete();
}
download(HttpsClient.https2data(this, <API key> + "index.php?mode=updateuri", <API key>, pref_timeout_so, ListAdapter.default_charset));
}
} catch (<API key> e) {
}
}
}
}
setContentView(R.layout.main);
pref_twtr = <API key>("Twitter_setting", MODE_PRIVATE);
int index = -1;
try {
index = Integer.parseInt(pref_twtr.getString("index", "0"));
} catch (final Exception e) {
index = 0;
}
Status = pref_twtr.getString("status_" + Integer.toString(index), "");
final long <API key> = <API key> / 5;
final String pref_useragent = pref_app.getString("pref_useragent", getString(R.string.useragent_ff));
textView1 = (TextView) this.findViewById(R.id.textView1);
webView1 = (WebView) this.findViewById(R.id.webView1);
new Thread(new Runnable() {
@Override
public final void run() {
runOnUiThread(new Runnable() {
@Override
public final void run() {
if (isConnected(Status)) {
textView1.setText(getString(R.string.welcome));
} else {
textView1.setText(getString(R.string.hello));
}
if (checkNetworkUtil.isConnected() == false) {
adapter.toast(getString(R.string.<API key>));
new Thread(new Runnable() {
@Override
public final void run() {
runOnUiThread(new Runnable() {
public final void run() {
webView1.loadUrl(ListAdapter.app_uri_local);
webView1.requestFocus(View.FOCUS_DOWN);
}
});
}
});
} else {
webView1.getSettings().<API key>(true);
webView1.getSettings().<API key>(true);
if (pref_useragent.equals("")) {
webView1.getSettings().setUserAgentString(getString(R.string.useragent_ff));
} else {
webView1.getSettings().setUserAgentString(pref_useragent);
}
webView1.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
timeout = false;
}
@Override
public final void onPageStarted(final WebView view, final String url, final Bitmap favicon) {
new Thread(new Runnable() {
@Override
public final void run() {
try {
Thread.sleep(<API key>);
} catch (final <API key> e) {
}
if (timeout) {
WriteLog.write(<API key>.this, getString(R.string.timeout));
if (url.startsWith(ListAdapter.app_uri_about)) {
runOnUiThread(new Runnable() {
public final void run() {
webView1.stopLoading();
webView1.loadUrl(ListAdapter.app_uri_local);
webView1.requestFocus(View.FOCUS_DOWN);
}
});
// } else if (url.equals(ListAdapter.app_uri_local) == false) {
// adapter.toast(getString(R.string.timeout));
}
}
}
}).start();
}
@Override
public final void onReceivedError(final WebView view, final int errorCode, final String description, final String failingUrl) {
WriteLog.write(<API key>.this, getString(R.string.description) + ": " + description);
// if (failingUrl.startsWith(ListAdapter.app_uri_about)) {
// webView1.stopLoading();
// webView1.loadUrl(ListAdapter.app_uri_local);
// webView1.requestFocus(View.FOCUS_DOWN);
// } else if (failingUrl.equals(ListAdapter.app_uri_local) == false) {
// WriteLog.write(<API key>.this, "errorCode: " + errorCode + " description: " + description + " failingUrl: " + failingUrl);
// adapter.toast("errorCode: " + errorCode + " description: " + description + " failingUrl: " + failingUrl);
}
@Override
public final void onReceivedSslError(final WebView view, final SslErrorHandler handler, final SslError error) {
handler.proceed();
}
});
webView1.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
webView1.<API key>(true);
// <API key> = (ConnectivityManager) getSystemService(<API key>);
// final NetworkInfo nInfo = <API key>.<API key>();
// if (nInfo != null) {
// webView1.loadUrl(ListAdapter.app_uri_about + "?id=" + StringUtil.join("_", adapter.getPhoneIds()) + "¬e=" + StringUtil.join("__", adapter.getOurScreenNames()));
// } else {
webView1.loadUrl(ListAdapter.app_uri_local);
webView1.requestFocus(View.FOCUS_DOWN);
}
}
});
}
}).start();
}
@Override
protected final Dialog onCreateDialog(final int id) {
final Dialog dialog = adapter.createDialog(id);
if (dialog != null) {
return dialog;
} else {
return super.onCreateDialog(id);
}
}
@Override
public final boolean onCreateOptionsMenu(final Menu menu) {
menu.add(0, R.string.tweet, 0, R.string.tweet).setIcon(android.R.drawable.ic_menu_edit);
final SubMenu sub1 = menu.addSubMenu(getString(R.string.timeline) + "...").setIcon(android.R.drawable.ic_menu_view);
sub1.add(0, R.string.<API key>, 0, R.string.<API key>);
sub1.add(0, R.string.home, 0, R.string.home);
sub1.add(0, R.string.mention, 0, R.string.mention);
sub1.add(0, R.string.user, 0, R.string.user);
sub1.add(0, R.string.userfav, 0, R.string.userfav);
menu.add(0, R.string.addaccount, 0, R.string.addaccount).setIcon(android.R.drawable.ic_input_add);
menu.add(0, R.string.check_ratelimit, 0, R.string.check_ratelimit).setIcon(android.R.drawable.stat_sys_download);
menu.add(0, R.string.check_apistatus, 0, R.string.check_apistatus).setIcon(android.R.drawable.stat_sys_download);
menu.add(0, R.string.make_shortcut, 0, R.string.make_shortcut).setIcon(android.R.drawable.ic_menu_add);
final SubMenu sub2 = menu.addSubMenu(getString(R.string.settings_all) + "...").setIcon(android.R.drawable.ic_menu_preferences);
sub2.add(0, R.string.settings, 0, R.string.settings).setIcon(android.R.drawable.ic_menu_preferences);
sub2.add(0, R.string.<API key>, 0, getString(R.string.<API key>) + "...").setIcon(android.R.drawable.stat_notify_sdcard);
sub2.add(0, R.string.<API key>, 0, getString(R.string.<API key>) + "...").setIcon(android.R.drawable.stat_notify_sdcard);
sub2.add(0, R.string.get_blockusers, 0, R.string.get_blockusers).setIcon(android.R.drawable.stat_sys_download);
sub2.add(0, R.string.<API key>, 0, R.string.<API key>).setIcon(android.R.drawable.stat_sys_download);
final SubMenu sub3 = sub2.addSubMenu(getString(R.string.set_colors) + "...").setIcon(android.R.drawable.ic_menu_gallery);
sub3.add(0, R.string.get_colors, 0, R.string.get_colors).setIcon(android.R.drawable.stat_sys_download);
sub3.add(0, R.string.<API key>, 0, R.string.<API key>).setIcon(android.R.drawable.ic_menu_gallery);
sub3.add(0, R.string.<API key>, 0, R.string.<API key>).setIcon(android.R.drawable.ic_menu_gallery);
sub3.add(0, R.string.<API key>, 0, R.string.<API key>).setIcon(android.R.drawable.ic_menu_gallery);
sub3.add(0, R.string.<API key>, 0, R.string.<API key>).setIcon(android.R.drawable.ic_menu_gallery);
menu.add(0, R.string.copyright, 0, R.string.copyright).setIcon(android.R.drawable.<API key>);
menu.add(0, R.string.quit, 0, R.string.quit).setIcon(android.R.drawable.<API key>);
return true;
}
@Override
public final boolean onKeyDown(final int keyCode, final KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (webView1.canGoBack()) {
webView1.goBack();
return true;
} else {
// this.moveTaskToBack(true);
finish();
return false;
}
} else {
return super.onKeyDown(keyCode, event);
}
}
@Override
public final void onNewIntent(final Intent intent) {
if (checkNetworkUtil.isConnected() == false) {
adapter.toast(getString(R.string.<API key>));
return;
}
final Uri uri = intent.getData();
if (uri == null) {
return;
}
final String verifier = uri.getQueryParameter("oauth_verifier");
if (verifier.equals("") == false) {
try {
pref_app = PreferenceManager.<API key>(this);
final String pref_consumerKey = pref_app.getString("pref_consumerkey", "");
final String pref_consumerSecret = pref_app.getString("pref_consumersecret", "");
final Boolean <API key> = pref_app.getBoolean("<API key>", false);
if (( <API key> == true ) && ( pref_consumerKey.equals("") == false ) && ( pref_consumerSecret.equals("") == false )) {
consumerKey = pref_consumerKey.replaceAll(" ", "").replaceAll("\r", "").replaceAll("\n", "");
consumer<API key>.replaceAll(" ", "").replaceAll("\r", "").replaceAll("\n", "");
} else {
consumerKey = getString(R.string.default_consumerKey);
consumerSecret = getString(R.string.<API key>);
}
<API key> = ListAdapter.getPrefInt(this, "<API key>", "20000");
<API key> = ListAdapter.getPrefInt(this, "<API key>", "120000");
AccessToken accessToken = null;
try {
access<API key>.getOAuthAccessToken(verifier);
final <API key> cbuilder = new <API key>();
cbuilder.setOAuthConsumerKey(consumerKey);
cbuilder.<API key>(consumerSecret);
cbuilder.setOAuthAccessToken(accessToken.getToken());
cbuilder.setO<API key>(accessToken.getTokenSecret());
final Configuration configuration = cbuilder.build();
final TwitterFactory twitterFactory = new TwitterFactory(configuration);
<TwitterConsumerkey>.getInstance();
} catch (final Exception e) {
WriteLog.write(this, e);
}
String profile_image_url = "";
if (twitter != null) {
try {
final User user = twitter.showUser(twitter.getScreenName());
profile_image_url = user.getProfileImageURL().toString();
} catch (final <API key> e) {
WriteLog.write(this, e);
} catch (final Exception e) {
WriteLog.write(this, e);
}
}
pref_twtr = <API key>("Twitter_setting", MODE_PRIVATE);
final int index = Integer.parseInt(pref_twtr.getString("index", "-1"));
if (index > -1) {
if (accessToken != null) {
final SharedPreferences.Editor editor = pref_twtr.edit();
editor.putString("consumer_key_" + Integer.toString(index), MyCrypt.encrypt(this, crpKey, consumerKey));
editor.putString("consumer_secret_" + Integer.toString(index), MyCrypt.encrypt(this, crpKey, consumerSecret));
editor.putString("oauth_token_" + Integer.toString(index), MyCrypt.encrypt(this, crpKey, accessToken.getToken()));
editor.putString("oauth_token_secret_" + Integer.toString(index), MyCrypt.encrypt(this, crpKey, accessToken.getTokenSecret()));
editor.putString("status_" + Integer.toString(index), "available");
editor.putString("screen_name_" + Integer.toString(index), twitter.getScreenName());
editor.putString("profile_image_url_" + Integer.toString(index), profile_image_url);
editor.commit();
final Intent intent2 = new Intent(this, UpdateTweet.class);
this.<API key>(intent2, 0);
}
}
} catch (final TwitterException e) {
}
}
}
@Override
public final boolean <API key>(final MenuItem item) {
boolean ret = true;
pref_twtr = <API key>("Twitter_setting", MODE_PRIVATE);
final int user_index_size = ListAdapter.getPrefInt(this, "<API key>", Integer.toString(ListAdapter.<API key>));
final String[] ITEM1 = new String[user_index_size + 1];
final String[] ITEM2 = new String[user_index_size];
int account_num = 0;
for (int i = 0; i < user_index_size; i++) {
final String itemname = pref_twtr.getString("screen_name_" + i, "");
account_num += itemname.equals("") ? 0 : 1;
ITEM1[i + 1] = itemname.equals("") ? " - " : "@" + itemname;
ITEM2[i] = itemname.equals("") ? " - " : "@" + itemname;
}
ITEM1[0] = ( account_num > 0 ) ? "Current" : "
pref_twtr = <API key>("Twitter_setting", MODE_PRIVATE);
int idx = -1;
try {
idx = Integer.parseInt(pref_twtr.getString("index", "0"));
} catch (final Exception e) {
idx = 0;
}
final int index = idx;
if (item.getItemId() == R.string.tweet) {
new AlertDialog.Builder(<API key>.this).setTitle(R.string.login).setItems(ITEM1, new DialogInterface.OnClickListener() {
@Override
public final void onClick(final DialogInterface dialog, final int which) {
if (which == 0) {
Status = pref_twtr.getString("status_" + Integer.toString(index), "");
if (isConnected(Status)) {
startUpdateTweet();
}
} else {
final SharedPreferences.Editor editor = pref_twtr.edit();
editor.putString("index", Integer.toString(which - 1));
editor.commit();
Status = pref_twtr.getString("status_" + ( which - 1 ), "");
if (isConnected(Status)) {
startUpdateTweet();
} else {
try {
connectTwitter();
} catch (final TwitterException e) {
}
}
}
}
}).create().show();
} else if (item.getItemId() == R.string.<API key>) {
final Intent intent1 = new Intent();
intent1.setClassName("jp.gr.java_conf.ya.shiobeforandroid2", "jp.gr.java_conf.ya.shiobeforandroid2.TabsActivity");
startActivity(intent1);
} else if (item.getItemId() == R.string.home) {
new AlertDialog.Builder(<API key>.this).setTitle(R.string.login).setItems(ITEM1, new DialogInterface.OnClickListener() {
@Override
public final void onClick(final DialogInterface dialog, final int which) {
if (which == 0) {
Status = pref_twtr.getString("status_" + Integer.toString(index), "");
if (isConnected(Status)) {
adapter.startTlHome(index);
}
} else {
final SharedPreferences.Editor editor = pref_twtr.edit();
editor.putString("index", Integer.toString(which - 1));
editor.commit();
Status = pref_twtr.getString("status_" + ( which - 1 ), "");
if (isConnected(Status)) {
adapter.startTlHome(which - 1);
} else {
try {
connectTwitter();
} catch (final TwitterException e) {
}
}
}
}
}).create().show();
} else if (item.getItemId() == R.string.mention) {
new AlertDialog.Builder(<API key>.this).setTitle(R.string.login).setItems(ITEM1, new DialogInterface.OnClickListener() {
@Override
public final void onClick(final DialogInterface dialog, final int which) {
if (which == 0) {
Status = pref_twtr.getString("status_" + Integer.toString(index), "");
if (isConnected(Status)) {
adapter.startTlMention(index);
}
} else {
final SharedPreferences.Editor editor = pref_twtr.edit();
editor.putString("index", Integer.toString(which - 1));
editor.commit();
Status = pref_twtr.getString("status_" + ( which - 1 ), "");
if (isConnected(Status)) {
adapter.startTlMention(which - 1);
} else {
try {
connectTwitter();
} catch (final TwitterException e) {
}
}
}
}
}).create().show();
} else if (item.getItemId() == R.string.user) {
new AlertDialog.Builder(<API key>.this).setTitle(R.string.login).setItems(ITEM1, new DialogInterface.OnClickListener() {
@Override
public final void onClick(final DialogInterface dialog, final int which) {
if (which == 0) {
Status = pref_twtr.getString("status_" + Integer.toString(index), "");
if (isConnected(Status)) {
adapter.startTlUser(index);
}
} else {
final SharedPreferences.Editor editor = pref_twtr.edit();
editor.putString("index", Integer.toString(which - 1));
editor.commit();
Status = pref_twtr.getString("status_" + ( which - 1 ), "");
if (isConnected(Status)) {
adapter.startTlUser(which - 1);
} else {
try {
connectTwitter();
} catch (final TwitterException e) {
}
}
}
}
}).create().show();
} else if (item.getItemId() == R.string.userfav) {
new AlertDialog.Builder(<API key>.this).setTitle(R.string.login).setItems(ITEM1, new DialogInterface.OnClickListener() {
@Override
public final void onClick(final DialogInterface dialog, final int which) {
if (which == 0) {
Status = pref_twtr.getString("status_" + Integer.toString(index), "");
if (isConnected(Status)) {
adapter.startTlFavorite(index);
}
} else {
final SharedPreferences.Editor editor = pref_twtr.edit();
editor.putString("index", Integer.toString(which - 1));
editor.commit();
Status = pref_twtr.getString("status_" + ( which - 1 ), "");
if (isConnected(Status)) {
adapter.startTlFavorite(which - 1);
} else {
try {
connectTwitter();
} catch (final TwitterException e) {
}
}
}
}
}).create().show();
} else if (item.getItemId() == R.string.addaccount) {
new AlertDialog.Builder(<API key>.this).setTitle(R.string.addaccount2).setItems(ITEM2, new DialogInterface.OnClickListener() {
@Override
public final void onClick(final DialogInterface dialog, final int which) {
try {
pref_twtr = <API key>("Twitter_setting", MODE_PRIVATE);
final SharedPreferences.Editor editor = pref_twtr.edit();
editor.putString("index", Integer.toString(which));
editor.commit();
} catch (final Exception e) {
}
try {
disconnectTwitter();
} catch (final Exception e) {
}
ITEM2[which] = " - ";
try {
connectTwitter();
} catch (final TwitterException e) {
}
}
}).create().show();
} else if (item.getItemId() == R.string.check_ratelimit) {
adapter.showRateLimits(webView1);
} else if (item.getItemId() == R.string.check_apistatus) {
adapter.showApiStatuses(webView1);
} else if (item.getItemId() == R.string.deljustbefore) {
adapter.deljustbefore(-1);
} else if (item.getItemId() == R.string.settings) {
final Intent intent2 = new Intent();
intent2.setClassName("jp.gr.java_conf.ya.shiobeforandroid2", "jp.gr.java_conf.ya.shiobeforandroid2.Preference");
startActivity(intent2);
} else if (item.getItemId() == R.string.<API key>) {
final Date date = new Date();
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddkkmmss", Locale.JAPAN);
final String datestr = simpleDateFormat.format(date);
final String prefXmlPath = Environment.getDataDirectory().getPath() + "/data/" + getPackageName() + "/shared_prefs/" + getPackageName() + "_preferences.xml";
final String backupPath = Environment.<API key>().toString() + "/" + getPackageName() + "_preferences.xml";
final String backupPath_date = Environment.<API key>().toString() + "/" + getPackageName() + "_preferences_" + datestr + ".xml";
WriteLog.write(this, "prefXmlPath: " + prefXmlPath);
WriteLog.write(this, "backupPath: " + backupPath);
final File dir = new File(Environment.<API key>().toString() + "/");
final File[] files = dir.listFiles(new FileCheckPrefXml());
final String[] ITEM3 = new String[files.length + 2];
ITEM3[0] = getString(R.string.settings_export);
ITEM3[1] = getString(R.string.settings_export) + " ()";
for (int i = 0; i < files.length; i++) {
ITEM3[i + 2] = files[i].getName();
}
adapter.toast(getString(R.string.<API key>));
new AlertDialog.Builder(<API key>.this).setTitle(R.string.<API key>).setItems(ITEM3, new DialogInterface.OnClickListener() {
@Override
public final void onClick(final DialogInterface dialog, final int which) {
if (which == 0) {
if (prefExport(prefXmlPath, backupPath)) {
adapter.toast(getString(R.string.settings_export) + ": " + getString(R.string.success));
}
} else if (which == 1) {
if (prefExport(prefXmlPath, backupPath_date)) {
adapter.toast(getString(R.string.settings_export) + ": " + getString(R.string.success));
}
} else {
if (prefImport(Environment.<API key>().toString() + "/" + ITEM3[which])) {
adapter.toast(getString(R.string.settings_import) + ": " + getString(R.string.success));
}
}
}
}).create().show();
} else if (item.getItemId() == R.string.<API key>) {
final File dir = new File(Environment.<API key>().toString() + "/");
WriteLog.write(this, dir.getAbsolutePath());
final File dir2 = new File(Environment.<API key>().toString() + "/Fonts/");
WriteLog.write(this, dir2.getAbsolutePath());
File[] files2a;
File[] files2b;
int length = 0;
try {
final File[] files2a_ = dir.listFiles();
WriteLog.write(this, "/");
for (final File f : files2a_) {
WriteLog.write(this, f.getAbsolutePath());
}
files2a = dir.listFiles(new FileCheck_font()); |
package com.intellij.rt.junit;
import com.intellij.rt.execution.junit.RepeatCount;
import java.util.ArrayList;
import java.util.List;
public class JUnitForkedStarter {
public static void main(String[] args) throws Exception {
List argList = new ArrayList();
for (int i = 0; i < args.length; i++) {
final int count = RepeatCount.getCount(args[i]);
if (count != 0) {
JUnitStarter.ourCount = count;
continue;
}
argList.add(args[i]);
}
args = (String[])argList.toArray(new String[0]);
final String[] <API key> = {args[0]};
final String argentName = args[1];
final ArrayList listeners = new ArrayList();
for (int i = 2, argsLength = args.length; i < argsLength; i++) {
listeners.add(args[i]);
}
IdeaTestRunner testRunner = (IdeaTestRunner)JUnitStarter.getAgentClass(argentName).newInstance();
System.exit(IdeaTestRunner.Repeater.startRunnerWithArgs(testRunner, <API key>, listeners, null, JUnitStarter.ourCount, false));
}
} |
package com.imaginary.utils;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.<API key>;
import java.io.<API key>;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.imageio.stream.ImageOutputStream;
import sun.misc.BASE64Encoder;
/**
*
* @author wenshi.shen
* @version 2016319
* @Description 2d,
*
*/
public class RandomNumUtil {
private <API key> image;
private String str;
private RandomNumUtil() {
init();
}
/*
* RandomNumUtil
*/
public static RandomNumUtil Instance() {
return new RandomNumUtil();
}
public <API key> getImage() {
return this.image;
}
public String PicBase64() {
<API key> baos = new <API key>();
int len = 0;
byte[] b = new byte[1024];
while ((len = this.image.read(b, 0, b.length)) != -1) {
baos.write(b, 0, len);
}
byte[] buffer = baos.toByteArray();
// Base64 encorer=new Base64();
BASE64Encoder encoder = new BASE64Encoder();
String outstr = encoder.encode(buffer);
return outstr;
}
public String getString() {
return this.str;
}
private void init() {
int width = 55, height = 20;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
Random random = new Random();
g.setColor(getRandColor(200, 250));
g.fillRect(0, 0, width, height);
g.setFont(new Font("Times New Roman", Font.PLAIN, 18));
// 155
g.setColor(getRandColor(160, 200));
for (int i = 0; i < 155; i++) {
int x = random.nextInt(width);
int y = random.nextInt(height);
int xl = random.nextInt(12);
int yl = random.nextInt(12);
g.drawLine(x, y, x + xl, y + yl);
}
String sRand = "";
for (int i = 0; i < 4; i++) {
String rand = String.valueOf(random.nextInt(10));
sRand += rand;
g.setColor(new Color(20 + random.nextInt(110), 20 + random.nextInt(110), 20 + random.nextInt(110)));
g.drawString(rand, 13 * i + 6, 16);
}
this.str = sRand;
g.dispose();
<API key> input = null;
<API key> output = new <API key>();
try {
ImageOutputStream imageOut = ImageIO.<API key>(output);
ImageIO.write(image, "JPEG", imageOut);
imageOut.close();
input = new <API key>(output.toByteArray());
} catch (Exception e) {
System.out.println("" + e.toString());
}
this.image = input;
}
private Color getRandColor(int fc, int bc) {
Random random = new Random();
if (fc > 255)
fc = 255;
if (bc > 255)
bc = 255;
int r = fc + random.nextInt(bc - fc);
int g = fc + random.nextInt(bc - fc);
int b = fc + random.nextInt(bc - fc);
return new Color(r, g, b);
}
} |
package xryusha.onlinedebug.testcases.nested;
public class Nested_T2
{
int inst_ii = 2;
public Nested_T2()
{
}
public Nested_T2(int inst_ii)
{
this.inst_ii = inst_ii;
}
public int getInts_ii()
{
return inst_ii;
}
public void setInts_ii(int ints_ii)
{
this.inst_ii = ints_ii;
}
} |
package VMOMI::<API key>;
use parent 'VMOMI::ComplexType';
use strict;
use warnings;
our @class_ancestors = ( );
our @class_members = (
['<API key>', '<API key>', 1, 1],
);
sub get_class_ancestors {
return @class_ancestors;
}
sub get_class_members {
my $class = shift;
my @super_members = $class->SUPER::get_class_members();
return (@super_members, @class_members);
}
1; |
package org.deepdive.extraction
import akka.actor._
import akka.pattern.{ask, pipe}
import akka.util.Timeout
import java.io.{File, OutputStream, InputStream, PrintWriter, BufferedWriter, OutputStreamWriter, Writer}
import ProcessExecutor._
import scala.collection.mutable.ArrayBuffer
import scala.concurrent._
import scala.concurrent.duration._
import scala.io.Source
import scala.sys.process._
/* Companion object to process executor */
object ProcessExecutor {
// Start the actor using this method
def props = Props(classOf[ProcessExecutor])
// Received Messages
// Start the process with a given command. Output lines are returnd in batchSize batches.
case class Start(cmd: String, outputBatchSize: Int)
// Write data to stdin of the started process
case class Write(data: String)
// Close the input stream of the started process
case object CloseInputStream
// Signal that the process has exited (self message)
case class ProcessExited(exitValue: Int)
// Sent Messages
// An output batch from the process
case class OutputData(block: List[String])
// States
sealed trait State
// The actor is waiting for someone to tell a process command
case object Idle extends State
// The actor is running a process and receiving data
case object Running extends State
// Data (Internal State)
sealed trait Data
case object Uninitialized extends Data
case class TaskInfo(cmd: String, outputBatchSize: Int, sender: ActorRef)
case class ProcessInfo(process: Process, inputStream: PrintWriter,
errorStream: InputStream, outputStream: InputStream)
case class RuntimeData(processInfo: ProcessInfo, taskInfo: TaskInfo) extends Data
}
/* Executes a process and channels input and output data */
class ProcessExecutor extends Actor with FSM[State, Data] with ActorLogging {
/* We use the current dispatcher for Futures */
import context.dispatcher
implicit val taskTimeout = Timeout(24 hours)
override def preStart() { log.info("started") }
startWith(Idle, Uninitialized)
when(Idle) {
case Event(Start(cmd, outputBatchSize), Uninitialized) =>
// Start the process (don't close over the sender)
val _sender = sender
val processInfo = startProcess(cmd, outputBatchSize, _sender)
// Schedule a message when the process has exited
Future {
val exitValue = processInfo.process.exitValue()
self ! ProcessExited(exitValue)
processInfo.process.destroy()
}
// Transition to the running state
goto(Running) using RuntimeData(processInfo, TaskInfo(cmd, outputBatchSize, sender))
}
when(Running) {
case Event(Write(data), RuntimeData(processInfo, taskInfo)) =>
// Write data to the process. Do this in a different thread
processInfo.inputStream.println(data)
sender ! "OK!"
stay
case Event(CloseInputStream, RuntimeData(processInfo, taskInfo)) =>
// Close the input stream.
// No more data goes to the process. We still need to wait for the process to exit.
log.debug(s"closing input stream")
processInfo.inputStream.close()
stay
case Event(ProcessExited(exitValue), RuntimeData(processInfo, taskInfo)) =>
// The process has exited, notify the task sender and stop
log.info(s"process exited with exit_value=$exitValue")
taskInfo.sender ! ProcessExited(exitValue)
stop()
}
initialize()
/* Starts the process, blocks until all streams are connected, then return a ProcessInfo */
private def startProcess(cmd: String, batchSize: Int, dataCallback: ActorRef) : ProcessInfo = {
val inputStreamFuture = Promise[PrintWriter]()
val errorStreamFuture = Promise[InputStream]()
val outputStreamFuture = Promise[InputStream]()
log.info(s"""starting process with cmd="$cmd" and batch_size=$batchSize""")
// Build a process object and handle the input, output, and error streams
val processBuilder = new ProcessIO(
in => {
val writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(in)))
inputStreamFuture.success(writer)
},
out => {
outputStreamFuture.success(out)
Source.fromInputStream(out).getLines.grouped(batchSize).foreach { batch =>
// We wait for the result here, because we don't want to read too much data at once
Await.result(dataCallback ? OutputData(batch.toList), 1.hour)
}
log.debug(s"closing output stream")
out.close()
},
err => {
errorStreamFuture.success(err)
Source.fromInputStream(err).getLines foreach (log.debug)
}
)
// If the process is a file, make it executable
val file = new File(cmd)
if (file.isFile) file.setExecutable(true, false)
// Run the process
val process = cmd run (processBuilder)
// Wait for all streams to be connected
val processInfoFuture = for {
inputStream <- inputStreamFuture.future
errorStream <- errorStreamFuture.future
outputStream <- outputStreamFuture.future
} yield ProcessInfo(process, inputStream, errorStream, outputStream)
Await.result(processInfoFuture, 15.seconds)
}
} |
import os, sys
import time, datetime
import PIL
from PIL import Image
proj_path = "/srv/spaceweather/git/spaceweather/src/spaceweather/"
output_path = "/srv/spaceweather/git/spaceweather/misc/scripts/output/"
os.environ.setdefault("<API key>", "spaceweather.settings")
sys.path.append(proj_path)
newwidth = 512
newheight = 512
quality_val = 84
now = datetime.datetime.utcnow()
isonow = now.isoformat()
channels = ['171','193','211','304']
for c in channels:
filename = "{}-{}.jpg".format(c,isonow)
os.system("curl -4 'https://sdo.gsfc.nasa.gov/assets/img/latest/latest_1024_0{}.jpg' --output output/{}/{}".format(c,c,filename))
time.sleep(1)
downloadedimage = Image.open("output/{}/{}".format(c,filename)).convert('RGB')
downloadedimage = downloadedimage.resize((newwidth, newheight), PIL.Image.ANTIALIAS)
downloadedimage.save("output/{}/{}".format(c,filename), 'JPEG')
#HMI
basenow = now.replace(minute=0, second=0, microsecond=0)
minutes = now.minute
loopminutes = minutes//15 +1
delta15min = datetime.timedelta(minutes=15)
delta1hour = datetime.timedelta(hours=1)
for l in range(loopminutes):
filetime = basenow - delta1hour + delta15min*l
print("filetime",filetime)
filetimestring = filetime.strftime("%Y/%m/%d/%Y%m%d_%H%M%S_Ic_512.jpg")
filetimestringout = filetime.strftime("%Y%m%d_%H%M%S_Ic_512.jpg")
os.system("wget http://jsoc.stanford.edu/data/hmi/images/{} -O output/{}".format(filetimestring,filetimestringout))
downloadedimage = Image.open("output/{}".format(filetimestringout)).convert('RGB')
downloadedimage = downloadedimage.resize((newwidth, newheight), PIL.Image.ANTIALIAS)
downloadedimage.save("output/{}".format(filetimestringout), 'JPEG', quality=quality_val)
os.chdir(proj_path)
from core.models import *
from django.core.files import File
os.chdir(output_path)
for c in channels:
entry = "{}/{}-{}.jpg".format(c,c,isonow)
entryb = "{}-{}.jpg".format(c,isonow)
ct = Channeltype.objects.get(name__contains=c)
ic = Imagechannel(date=isonow,originaldate=isonow,bogus=False,channeltype=ct)
ic.image.save(entryb,File(open(entry,'rb')))
ic.save()
for l in range(loopminutes):
filetime = basenow - delta1hour + delta15min*l
filetimestring = filetime.strftime("%Y%m%d_%H%M%S_Ic_512.jpg")
ct = Channeltype.objects.get(name__contains="HMI")
try:
Imagechannel.objects.get(date=filetime)
print("Data for {} already there!".format(filetime))
except:
ic = Imagechannel(date=filetime,originaldate=filetime,bogus=False,channeltype=ct)
ic.image.save(filetimestring,File(open(filetimestring,'rb')))
ic.save()
print("Data for {} inserted!".format(filetime)) |
#include "ast.h"
void
ast_type_specifier::print(void) const
{
if (structure) {
structure->print();
} else {
printf("%s ", type_name);
}
if (array_specifier) {
array_specifier->print();
}
}
bool
<API key>::has_qualifiers() const
{
return this->qualifier.flags.i != 0;
}
bool ast_type_qualifier::has_interpolation() const
{
return this->flags.q.smooth
|| this->flags.q.flat
|| this->flags.q.noperspective;
}
bool
ast_type_qualifier::has_layout() const
{
return this->flags.q.origin_upper_left
|| this->flags.q.<API key>
|| this->flags.q.depth_any
|| this->flags.q.depth_greater
|| this->flags.q.depth_less
|| this->flags.q.depth_unchanged
|| this->flags.q.std140
|| this->flags.q.shared
|| this->flags.q.column_major
|| this->flags.q.row_major
|| this->flags.q.packed
|| this->flags.q.explicit_location
|| this->flags.q.explicit_index
|| this->flags.q.explicit_binding
|| this->flags.q.explicit_offset;
}
bool
ast_type_qualifier::has_storage() const
{
return this->flags.q.constant
|| this->flags.q.attribute
|| this->flags.q.varying
|| this->flags.q.in
|| this->flags.q.out
|| this->flags.q.uniform;
}
bool
ast_type_qualifier::<API key>() const
{
return this->flags.q.centroid
|| this->flags.q.sample;
}
const char*
ast_type_qualifier::<API key>() const
{
if (this->flags.q.smooth)
return "smooth";
else if (this->flags.q.flat)
return "flat";
else if (this->flags.q.noperspective)
return "noperspective";
else
return NULL;
}
bool
ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
<API key> *state,
ast_type_qualifier q)
{
ast_type_qualifier ubo_mat_mask;
ubo_mat_mask.flags.i = 0;
ubo_mat_mask.flags.q.row_major = 1;
ubo_mat_mask.flags.q.column_major = 1;
ast_type_qualifier ubo_layout_mask;
ubo_layout_mask.flags.i = 0;
ubo_layout_mask.flags.q.std140 = 1;
ubo_layout_mask.flags.q.packed = 1;
ubo_layout_mask.flags.q.shared = 1;
ast_type_qualifier ubo_binding_mask;
ubo_binding_mask.flags.i = 0;
ubo_binding_mask.flags.q.explicit_binding = 1;
ubo_binding_mask.flags.q.explicit_offset = 1;
/* Uniform block layout qualifiers get to overwrite each
* other (rightmost having priority), while all other
* qualifiers currently don't allow duplicates.
*/
if ((this->flags.i & q.flags.i & ~(ubo_mat_mask.flags.i |
ubo_layout_mask.flags.i |
ubo_binding_mask.flags.i)) != 0) {
_mesa_glsl_error(loc, state,
"duplicate layout qualifiers used");
return false;
}
if (q.flags.q.prim_type) {
if (this->flags.q.prim_type && this->prim_type != q.prim_type) {
_mesa_glsl_error(loc, state,
"conflicting primitive type qualifiers used");
return false;
}
this->prim_type = q.prim_type;
}
if (q.flags.q.max_vertices) {
if (this->flags.q.max_vertices && this->max_vertices != q.max_vertices) {
_mesa_glsl_error(loc, state,
"geometry shader set conflicting max_vertices "
"(%d and %d)", this->max_vertices, q.max_vertices);
return false;
}
this->max_vertices = q.max_vertices;
}
if ((q.flags.i & ubo_mat_mask.flags.i) != 0)
this->flags.i &= ~ubo_mat_mask.flags.i;
if ((q.flags.i & ubo_layout_mask.flags.i) != 0)
this->flags.i &= ~ubo_layout_mask.flags.i;
for (int i = 0; i < 3; i++) {
if (q.flags.q.local_size & (1 << i)) {
if ((this->flags.q.local_size & (1 << i)) &&
this->local_size[i] != q.local_size[i]) {
_mesa_glsl_error(loc, state,
"compute shader set conflicting values for "
"local_size_%c (%d and %d)", 'x' + i,
this->local_size[i], q.local_size[i]);
return false;
}
this->local_size[i] = q.local_size[i];
}
}
this->flags.i |= q.flags.i;
if (q.flags.q.explicit_location)
this->location = q.location;
if (q.flags.q.explicit_index)
this->index = q.index;
if (q.flags.q.explicit_binding)
this->binding = q.binding;
if (q.flags.q.explicit_offset)
this->offset = q.offset;
if (q.precision != ast_precision_none)
this->precision = q.precision;
if (q.flags.q.<API key>) {
this->image_format = q.image_format;
this->image_base_type = q.image_base_type;
}
return true;
}
bool
ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
<API key> *state,
ast_type_qualifier q,
ast_node* &node)
{
void *mem_ctx = state;
bool create_gs_ast = false;
bool create_cs_ast = false;
ast_type_qualifier valid_in_mask;
valid_in_mask.flags.i = 0;
switch (state->stage) {
case <API key>:
if (q.flags.q.prim_type) {
/* Make sure this is a valid input primitive type. */
switch (q.prim_type) {
case GL_POINTS:
case GL_LINES:
case GL_LINES_ADJACENCY:
case GL_TRIANGLES:
case <API key>:
break;
default:
_mesa_glsl_error(loc, state,
"invalid geometry shader input primitive type");
break;
}
}
create_gs_ast |=
q.flags.q.prim_type &&
!state->in_qualifier->flags.q.prim_type;
valid_in_mask.flags.q.prim_type = 1;
valid_in_mask.flags.q.invocations = 1;
break;
case <API key>:
if (q.flags.q.<API key>) {
state-><API key> = true;
} else {
_mesa_glsl_error(loc, state, "invalid input layout qualifier");
}
break;
case MESA_SHADER_COMPUTE:
create_cs_ast |=
q.flags.q.local_size != 0 &&
state->in_qualifier->flags.q.local_size == 0;
valid_in_mask.flags.q.local_size = 1;
break;
default:
_mesa_glsl_error(loc, state,
"input layout qualifiers only valid in "
"geometry, fragment and compute shaders");
break;
}
/* Generate an error when invalid input layout qualifiers are used. */
if ((q.flags.i & ~valid_in_mask.flags.i) != 0) {
_mesa_glsl_error(loc, state,
"invalid input layout qualifiers used");
return false;
}
/* Input layout qualifiers can be specified multiple
* times in separate declarations, as long as they match.
*/
if (this->flags.q.prim_type) {
if (q.flags.q.prim_type &&
this->prim_type != q.prim_type) {
_mesa_glsl_error(loc, state,
"conflicting input primitive types specified");
}
} else if (q.flags.q.prim_type) {
state->in_qualifier->flags.q.prim_type = 1;
state->in_qualifier->prim_type = q.prim_type;
}
if (this->flags.q.invocations &&
q.flags.q.invocations &&
this->invocations != q.invocations) {
_mesa_glsl_error(loc, state,
"conflicting invocations counts specified");
return false;
} else if (q.flags.q.invocations) {
this->flags.q.invocations = 1;
this->invocations = q.invocations;
}
if (create_gs_ast) {
node = new(mem_ctx) ast_gs_input_layout(*loc, q.prim_type);
} else if (create_cs_ast) {
/* Infer a local_size of 1 for every unspecified dimension */
unsigned local_size[3];
for (int i = 0; i < 3; i++) {
if (q.flags.q.local_size & (1 << i))
local_size[i] = q.local_size[i];
else
local_size[i] = 1;
}
node = new(mem_ctx) ast_cs_input_layout(*loc, local_size);
}
return true;
} |
package org.jacpfx;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.*;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
import java.nio.ByteBuffer;
public class PixelWriterARGBDemo extends Application {
public static final String FILE_JPG = "DSCF5453.jpg";
public static void main(final String[] args) {
Application.launch(args);
}
Label result = new Label("");
VBox color = new VBox();
VBox argb = new VBox();
VBox setPixels = new VBox();
VBox all = new VBox();
VBox maskImageView = new VBox();
@Override
public void start(Stage stage) {
Group root = new Group();
Scene scene = new Scene(root, 1280, 1024);
stage.setScene(scene);
stage.setTitle("Progress Controls - Task");
final VBox vb = new VBox();
VBox header = new VBox();
header.getChildren().addAll(createButtons(), <API key>(), result);
vb.setSpacing(5);
vb.getChildren().addAll(header, createSamplePane());
scene.setRoot(vb);
stage.show();
}
private HBox createSamplePane() {
HBox box = new HBox();
box.setAlignment(Pos.BOTTOM_CENTER);
box.setPrefHeight(150);
box.setMaxHeight(150);
color.setAlignment(Pos.BOTTOM_CENTER);
argb.setAlignment(Pos.BOTTOM_CENTER);
setPixels.setAlignment(Pos.BOTTOM_CENTER);
all.setAlignment(Pos.BOTTOM_CENTER);
maskImageView.setAlignment(Pos.BOTTOM_CENTER);
HBox.setMargin(color, new Insets(10));
HBox.setMargin(argb, new Insets(10));
HBox.setMargin(all, new Insets(10));
HBox.setMargin(setPixels, new Insets(10));
HBox.setMargin(maskImageView, new Insets(10));
box.getChildren().addAll(color, argb, all, setPixels, maskImageView);
return box;
}
private StackPane <API key>() {
StackPane originalPane = new StackPane();
HBox originalStage = new HBox();
HBox.setHgrow(originalPane, Priority.ALWAYS);
originalStage.getChildren().add(originalPane);
ImageView originalView = new ImageView(new Image(FILE_JPG, 0, 480, true, false, true));
originalPane.getChildren().add(originalView);
return originalPane;
}
private HBox createButtons() {
HBox box = new HBox();
box.setAlignment(Pos.CENTER);
Button color = new Button("setColor");
color.setOnAction((event) -> <API key>());
Button argb = new Button("setRGB");
argb.setOnAction((event) -> createImageByargb());
Button setPixels = new Button("setPixels");
setPixels.setOnAction((event) -> <API key>((view, time) -> Platform.runLater(() -> {
VBox.setMargin(view, new Insets(20));
this.setPixels.getChildren().clear();
this.setPixels.getChildren().addAll(view, new Label("by setPixels: " + time + " ms"));
})));
Button all = new Button("mask and getImage");
all.setOnAction((event) -> createImageByMask());
Button imgView = new Button("mask use ImageView");
imgView.setOnAction((event) -> <API key>());
HBox.setMargin(color, new Insets(30));
HBox.setMargin(argb, new Insets(30));
HBox.setMargin(setPixels, new Insets(30));
HBox.setMargin(all, new Insets(30));
HBox.setMargin(imgView, new Insets(30));
box.getChildren().addAll(color, argb, all, setPixels, imgView);
return box;
}
private void <API key>() {
invokeLoop((writer, reader, x, y) -> {
Color color = reader.getColor(x, y);
writer.setColor(x, y, color);
}, (view, elapsedTime) -> Platform.runLater(() -> {
color.getChildren().clear();
VBox.setMargin(view, new Insets(20));
color.getChildren().addAll(view, new Label("by color: " + elapsedTime + " ms"));
}));
}
private void createImageByargb() {
invokeLoop((writer, reader, x, y) -> {
int argb = reader.getArgb(x, y);
writer.setArgb(x, y, argb);
}, (view, elapsedTime) -> Platform.runLater(() -> {
argb.getChildren().clear();
VBox.setMargin(view, new Insets(20));
argb.getChildren().addAll(view, new Label("by setRgb: " + elapsedTime + " ms"));
}));
}
private void invokeLoop(final ReaderWrtiter readerWrtiter, NodeTime nodeTime) {
runOffThread(() -> {
final Image src = getFile();
final PixelReader reader = src.getPixelReader();
final int width = (int) src.getWidth();
final int height = (int) src.getHeight();
WritableImage dest = null;
final long startTime = System.currentTimeMillis();
for (int i = 0; i < 1000; i++) {
dest = invokeLoopBody(readerWrtiter, reader, width, height);
}
final long stopTime = System.currentTimeMillis();
final long elapsedTime = stopTime - startTime;
final ImageView originalView = new ImageView(dest);
nodeTime.invoke(originalView, elapsedTime);
});
}
private void runOffThread(Runnable r) {
Thread t = new Thread(r);
t.start();
}
private Image getFile() {
return new Image(FILE_JPG, 0, 300, true, true, false);
}
private WritableImage invokeLoopBody(ReaderWrtiter readerWrtiter, PixelReader reader, int width, int height) {
WritableImage dest = null;
if (width > height) {
int startX = width / 4;
dest = new WritableImage(height, height + startX);
final PixelWriter writer = dest.getPixelWriter();
invokeLandscape(readerWrtiter, reader, width, height, writer);
} else {
int startY = (height / 4);
dest = new WritableImage(width, width + startY);
final PixelWriter writer = dest.getPixelWriter();
invokePortrait(readerWrtiter, reader, width, height, writer);
}
return dest;
}
private void invokePortrait(ReaderWrtiter readerWrtiter, PixelReader reader, int width, int height, PixelWriter writer) {
int startY = (height / 4);
for (int x = 0; x < width; x++) {
for (int y = startY; y < height - startY / 2 + 10; y++) {
readerWrtiter.invoke(writer, reader, x, y);
}
}
}
private void invokeLandscape(ReaderWrtiter readerWrtiter, PixelReader reader, int width, int height, PixelWriter writer) {
int startX = width / 4;
for (int x = startX; x < width - startX / 2 + 10; x++) {
for (int y = 0; y < height; y++) {
readerWrtiter.invoke(writer, reader, x, y);
}
}
}
private interface ReaderWrtiter {
void invoke(PixelWriter writer, PixelReader reader, int x, int y);
}
private interface NodeTime {
void invoke(ImageView view, long elapsedTime);
}
private void <API key>(NodeTime nodeTime) {
runOffThread(() -> {
final Image src = getFile();
final PixelReader reader = src.getPixelReader();
// reader.getPixelFormat();
WritablePixelFormat<ByteBuffer> format = WritablePixelFormat.<API key>();
// WritablePixelFormat<ByteBuffer> format = WritablePixelFormat.getByteBgraInstance(); //false test
// WritablePixelFormat<ByteBuffer> formatRead = WritablePixelFormat.getByteBgraInstance(); //false test
WritablePixelFormat<ByteBuffer> formatRead = WritablePixelFormat.<API key>();
final int width = (int) src.getWidth();
final int height = (int) src.getHeight();
final long startTime = System.currentTimeMillis();
WritableImage dest = null;
for (int i = 0; i < 1000; i++) {
if (width > height) {
// landscape
byte[] rowBuffer = new byte[height * width * 4];
reader.getPixels(width / 4, 0, height, height, formatRead, rowBuffer, 0, width * 4);
dest = new WritableImage(width, width);
final PixelWriter writer = dest.getPixelWriter();
writer.setPixels(0, 0, height, height, format, rowBuffer, 0, width * 4);
} else {
// portrait
byte[] rowBuffer = new byte[height * width * 4];
reader.getPixels(0, height / 4, width, width, formatRead, rowBuffer, 0, width * 4);
dest = new WritableImage(width, width);
final PixelWriter writer = dest.getPixelWriter();
writer.setPixels(0, 0, width, width, format, rowBuffer, 0, width * 4);
}
}
final long stopTime = System.currentTimeMillis();
final long elapsedTime = stopTime - startTime;
final ImageView originalView = new ImageView(dest);
nodeTime.invoke(originalView, elapsedTime);
});
}
private void <API key>() {
runOffThread(() -> {
final Image src = getFile();
ImageView dest = null;
final int width = (int) src.getWidth();
final int height = (int) src.getHeight();
final long startTime = System.currentTimeMillis();
for (int i = 0; i < 1000; i++) {
dest = postProcess(src, height, width);
}
final long stopTime = System.currentTimeMillis();
final long elapsedTime = stopTime - startTime;
final ImageView originalView = dest;
Platform.runLater(() -> {
maskImageView.getChildren().clear();
maskImageView.getChildren().addAll(originalView, new Label("by mask: " + elapsedTime + " ms"));
});
});
}
private void createImageByMask() {
final Image src = getFile();
Image dest = null;
final int width = (int) src.getWidth();
final int height = (int) src.getHeight();
final long startTime = System.currentTimeMillis();
for (int i = 0; i < 1000; i++) {
dest = postProcess(src, height, width).snapshot(null, null);
}
final long stopTime = System.currentTimeMillis();
final long elapsedTime = stopTime - startTime;
final ImageView originalView = new ImageView(dest);
all.getChildren().clear();
VBox.setMargin(originalView, new Insets(20));
all.getChildren().addAll(originalView, new Label("by mask (snapshot): " + elapsedTime + " ms"));
}
public ImageView postProcess(Image image, double maxHight, double maxWidth) {
ImageView maskView = new ImageView();
maskView.setPreserveRatio(true);
maskView.setSmooth(false);
maskView.setImage(image);
maskView.setClip(initLayer(image, Color.WHITE, 1.0, maxHight, maxWidth));
return maskView;//.snapshot(null, null);
}
private Rectangle initLayer(Image image, Color color, double opacity, double maxHight, double maxWidth) {
Rectangle rectangle = null;
if (image.getWidth() > image.getHeight()) {
rectangle = new Rectangle(maxWidth / 4, 0, maxHight, maxHight);
} else {
rectangle = new Rectangle(0, maxHight / 4, maxWidth, maxWidth);
}
rectangle.setFill(color);
rectangle.setOpacity(opacity);
return rectangle;
}
} |
package merchant
type (
ApiInfo struct {
MerchantId int `db:"mch_id" pk:"yes" auto:"no"`
ApiId string `db:"api_id"`
ApiSecret string `db:"api_secret"`
WhiteList string `db:"white_list"`
Enabled int `db:"enabled"`
}
// Api
IApiManager interface {
// API,
GetApiInfo() ApiInfo
// API, ,
SaveApiInfo(*ApiInfo) error
// API
EnableApiPerm() error
// API
DisableApiPerm() error
}
) |
var utils = require('ethereumjs-util');
var fs = require('fs');
var async = require('async');
var inherits = require('util').inherits;
var StateManager = require('../statemanager.js');
var to = require('../utils/to');
var txhelper = require('../utils/txhelper');
var pkg = require('../../package.json');
var Subprovider = require('<API key>/subproviders/subprovider.js');
inherits(GethApiDouble, Subprovider)
function GethApiDouble(options) {
var self = this;
this.state = options.state || new StateManager(options);
this.options = options;
this.initialized = false;
this.state.initialize(this.options, function() {
self.initialized = true;
});
}
GethApiDouble.prototype.<API key> = function(callback) {
var self = this;
if (this.initialized == false) {
setTimeout(function() {
self.<API key>(callback);
}, 100);
} else {
callback(null, this.state);
}
}
// Function to not pass methods through until initialization is finished
GethApiDouble.prototype.handleRequest = function(payload, next, end) {
var self = this;
if (this.initialized == false) {
setTimeout(this.getDelayedHandler(payload, next, end), 100);
return;
}
var method = this[payload.method];
if (method == null) {
return end(new Error("RPC method " + payload.method + " not supported."));
}
var params = payload.params;
var args = [];
Array.prototype.push.apply(args, params);
if (this.<API key>(payload.method) && args.length < method.length - 1) {
args.push("latest");
}
args.push(end);
method.apply(this, args);
};
GethApiDouble.prototype.getDelayedHandler = function(payload, next, end) {
var self = this;
return function() {
self.handleRequest(payload, next, end);
}
}
GethApiDouble.prototype.<API key> = function(method) {
// object for O(1) lookup.
var methods = {
"eth_getBalance": true,
"eth_getCode": true,
"<API key>": true,
"eth_getStorageAt": true,
"eth_call": true
};
return methods[method] === true;
};
// Handle individual requests.
GethApiDouble.prototype.eth_accounts = function(callback) {
callback(null, Object.keys(this.state.accounts));
};
GethApiDouble.prototype.eth_blockNumber = function(callback) {
callback(null, to.hex(this.state.blockNumber()));
};
GethApiDouble.prototype.eth_coinbase = function(callback) {
callback(null, this.state.coinbase);
};
GethApiDouble.prototype.eth_mining = function(callback) {
callback(null, this.state.is_mining);
};
GethApiDouble.prototype.eth_hashrate = function(callback) {
callback(null, '0x0');
};
GethApiDouble.prototype.eth_gasPrice = function(callback) {
callback(null, utils.addHexPrefix(this.state.gasPrice()));
};
GethApiDouble.prototype.eth_getBalance = function(address, block_number, callback) {
this.state.getBalance(address, block_number, callback);
};
GethApiDouble.prototype.eth_getCode = function(address, block_number, callback) {
this.state.getCode(address, block_number, callback);
};
GethApiDouble.prototype.<API key> = function(block_number, <API key>, callback) {
this.state.blockchain.getBlock(block_number, function(err, block) {
if (err) {
if (err.message && err.message.indexOf("Couldn't find block by reference:") >= 0) {
return callback(null, null);
} else {
return callback(err);
}
}
callback(null, {
number: to.hex(block.header.number),
hash: to.hex(block.hash()),
parentHash: to.hex(block.header.parentHash),
nonce: to.hex(block.header.nonce),
sha3Uncles: to.hex(block.header.uncleHash),
logsBloom: to.hex(block.header.bloom),
transactionsRoot: to.hex(block.header.transactionsTrie),
stateRoot: to.hex(block.header.stateRoot),
receiptRoot: to.hex(block.header.receiptTrie),
miner: to.hex(block.header.coinbase),
difficulty: to.hex(block.header.difficulty),
totalDifficulty: to.hex(block.header.difficulty), // TODO: Figure out what to do here.
extraData: to.hex(block.header.extraData),
size: to.hex(1000), // TODO: Do something better here
gasLimit: to.hex(block.header.gasLimit),
gasUsed: to.hex(block.header.gasUsed),
timestamp: to.hex(block.header.timestamp),
transactions: block.transactions.map(function(tx) {
if (<API key>) {
return txhelper.toJSON(tx, block);
} else {
return to.hex(tx.hash());
}
}),
uncles: []//block.uncleHeaders.map(function(uncleHash) {return to.hex(uncleHash)})
});
});
};
GethApiDouble.prototype.eth_getBlockByHash = function(tx_hash, <API key>, callback) {
this.<API key>.apply(this, arguments);
};
GethApiDouble.prototype.<API key> = function(hash, callback) {
this.state.<API key>(hash, function(err, receipt) {
if (err) return callback(err);
var result = null;
if (receipt){
result = receipt.toJSON();
}
callback(null, result);
});
};
GethApiDouble.prototype.<API key> = function(hash, callback) {
this.state.<API key>(hash, function(err, receipt) {
if (err) return callback(err);
var result = null;
if (receipt) {
result = txhelper.toJSON(receipt.tx, receipt.block)
}
callback(null, result);
});
}
GethApiDouble.prototype.<API key> = function(hash_or_number, index, callback) {
var self = this;
index = to.number(index);
this.state.getBlock(hash_or_number, function(err, block) {
if (err) return callback(err);
if (index >= block.transactions.length) {
return callback(new Error("Transaction at index " + to.hex(index) + " does not exist in block."));
}
var tx = block.transactions[index];
var result = txhelper.toJSON(tx, block);
callback(null, result);
});
};
GethApiDouble.prototype.<API key> = function(hash_or_number, index, callback) {
this.<API key>(hash_or_number, index, callback);
};
GethApiDouble.prototype.<API key> = function(address, block_number, callback) {
this.state.getTransactionCount(address, block_number, callback);
}
GethApiDouble.prototype.eth_sign = function(address, dataToSign, callback) {
var result;
var error;
try {
result = this.state.sign(address, dataToSign);
} catch (e) {
error = e;
}
callback(error, result);
};
GethApiDouble.prototype.eth_sendTransaction = function(tx_data, callback) {
this.state.queueTransaction("eth_sendTransaction", tx_data, callback);
};
GethApiDouble.prototype.<API key> = function(rawTx, callback) {
this.state.queueRawTransaction(rawTx, callback);
};
GethApiDouble.prototype.eth_getStorageAt = function(address, position, block_number, callback) {
this.state.queueStorage(address, position, block_number, callback);
}
GethApiDouble.prototype.eth_newBlockFilter = function(callback) {
var filter_id = utils.addHexPrefix(utils.intToHex(this.state.latest_filter_id));
this.state.latest_filter_id += 1;
callback(null, filter_id);
};
GethApiDouble.prototype.<API key> = function(filter_id, callback) {
var blockHash = this.state.latestBlock().hash().toString("hex");
// Mine a block after each request to getFilterChanges so block filters work.
this.state.mine();
callback(null, [blockHash]);
};
GethApiDouble.prototype.eth_getLogs = function(filter, callback) {
this.state.getLogs(filter, callback);
};
GethApiDouble.prototype.eth_uninstallFilter = function(filter_id, callback) {
callback(null, true);
};
GethApiDouble.prototype.eth_getCompilers = function(callback) {
callback(null, ["solidity"]);
}
GethApiDouble.prototype.eth_syncing = function(callback) {
callback(null, false);
};
GethApiDouble.prototype.net_listening = function(callback) {
callback(null, true);
};
GethApiDouble.prototype.net_peerCount = function(callback) {
callback(null, 0);
};
GethApiDouble.prototype.web3_clientVersion = function(callback) {
callback(null, "EthereumJS TestRPC/v" + pkg.version + "/ethereum-js")
};
GethApiDouble.prototype.web3_sha3 = function(string, callback) {
callback(null, to.hex(utils.sha3(string)));
};
GethApiDouble.prototype.net_version = function(callback) {
// net_version returns a string containing a base 10 integer.
callback(null, this.state.net_version + "");
};
GethApiDouble.prototype.miner_start = function(threads, callback) {
this.state.startMining(function(err) {
callback(err, true);
});
};
GethApiDouble.prototype.miner_stop = function(callback) {
this.state.stopMining(function(err) {
callback(err, true);
});
};
GethApiDouble.prototype.rpc_modules = function(callback) {
// returns the availible api modules and versions
callback(null, {"eth":"1.0","net":"1.0","rpc":"1.0","web3":"1.0","evm":"1.0"});
};
/* Functions for testing purposes only. */
GethApiDouble.prototype.evm_snapshot = function(callback) {
callback(null, this.state.snapshot());
};
GethApiDouble.prototype.evm_revert = function(snapshot_id, callback) {
callback(null, this.state.revert(snapshot_id));
};
GethApiDouble.prototype.evm_increaseTime = function(seconds, callback) {
callback(null, this.state.blockchain.increaseTime(seconds));
};
GethApiDouble.prototype.evm_mine = function(callback) {
this.state.blockchain.processNextBlock(function(err) {
// Remove the VM result objects from the return value.
callback(err);
});
};
module.exports = GethApiDouble; |
#!/bin/bash
# converts pretty-space formatted treceval and galagoeval format into tab-separated format - to be used as inputs for minir-plots
awk -v OFS="\t" ' { print $2, $1 ,$3; } ' $1 |
package com.fun.animator.control;
import com.fun.animator.<API key>;
import com.fun.animator.AnimatorInitializer;
import javafx.scene.control.Label;
import javafx.scene.layout.FlowPane;
public class ControlViewHolder extends <API key> {
public ControlViewHolder() {
AnimatorInitializer.init(this);
}
@Override
public void createLayout() {
FlowPane flowPane = new FlowPane();
flowPane.getChildren().add(new Label("View for selected Control"));
setRootUIPane(flowPane);
}
} |
#Optimizely Node Client
Access the [Optimizely REST API][opt-api] via javascript
Installation
bash
$ npm install <API key>
Usage
js
var OptimizelyClient = require('<API key>');
var API_TOKEN = "*";
var oc = new OptimizelyClient(API_TOKEN);
Example
js
oc.createProject({/*...project properties*/})
## Contributing
Please see [contributing.md](contributing.md).
Code copyright 2015 Celerius Group Inc. Released under the [Apache 2.0 License](http:
[opt-api]:http://developers.optimizely.com/rest/ |
import autocomplete_light
from .models import WishlistItem
class WishlistForm(autocomplete_light.ModelForm):
class Meta:
model = WishlistItem
exclude = ['owner',] |
<?php
// No direct access.
defined('_JEXEC') or die;
jimport('joomla.application.component.controlleradmin');
/**
* Danh_sach_giao_vien list controller class.
*/
class <API key> extends JControllerAdmin
{
/**
* Proxy for getModel.
* @since 1.6
*/
public function getModel($name = 'giao_vien', $prefix = '<API key>')
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model;
}
/**
* Method to save the submitted ordering values for records via AJAX.
*
* @return void
*
* @since 3.0
*/
public function saveOrderAjax()
{
// Get the input
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
$order = $input->post->get('order', array(), 'array');
// Sanitize the input
JArrayHelper::toInteger($pks);
JArrayHelper::toInteger($order);
// Get the model
$model = $this->getModel();
// Save the ordering
$return = $model->saveorder($pks, $order);
if ($return)
{
echo "1";
}
// Close the application
JFactory::getApplication()->close();
}
} |
var win = Titanium.UI.currentWindow;
var flexSpace = Ti.UI.createButton({ systemButton:Ti.UI.iPhone.SystemButton.FLEXIBLE_SPACE });
//Bring the module into the example
var map = require('bencoding.map');
//Create mapView
//We support all of the same functions the native Ti.Map.View does
var mapView = map.createView({
mapType: Ti.Map.STANDARD_TYPE,
animate:true,
userLocation:true
});
//Add to Window
win.add(mapView);
var bZoomIn = Ti.UI.createButton({
title:'+', style:Ti.UI.iPhone.SystemButtonStyle.BORDERED
});
var bZoomOut = Ti.UI.createButton({
title:'-', style:Ti.UI.iPhone.SystemButtonStyle.BORDERED
});
bZoomIn.addEventListener('click',function() {
mapView.zoom(1);
});
bZoomOut.addEventListener('click',function() {
mapView.zoom(-1);
});
var zoomControl = Titanium.UI.iOS.createToolbar({
items:[bZoomIn,bZoomOut],
top:0,width:70,left:0, borderRadius:5,
borderTop:true, borderBottom:false, translucent:true
});
win.add(zoomControl);
var bAddGeoJSON = Ti.UI.createButton({
title:'Load GeoJSON', style:Ti.UI.iPhone.SystemButtonStyle.BORDERED
});
var bRemoveGeoJSON = Ti.UI.createButton({
title:'Remove GeoJSON', style:Ti.UI.iPhone.SystemButtonStyle.BORDERED
});
var bMore = Ti.UI.createButton({
title:'More', style:Ti.UI.iPhone.SystemButtonStyle.BORDERED
});
function onComplete(){
alert("GeoJSON File Loaded");
};
//Add event handler to let us know when the KML file has been loaded
mapView.addEventListener('geoJSONCompleted',onComplete);
bAddGeoJSON.addEventListener('click',function() {
mapView.addGeoJSON({
path:"geo.json", //Path to our geo json file
tag : 55, //Integer value used as the tag for all polygons. If you want use remove you need to set this to a known value.
alpha:0.5, //Alpha value of your overlays
lineWidth:1.2, //Line Width of your overlays
strokeColor:'#000', //Stroke Color of your overlays
color:'yellow', //Sets the color of all your overlays ( if left off, a random color will be selected)
useRandomColor:true //If true, a random color will be selected, this overrides the color provided if true
});
});
bRemoveGeoJSON.addEventListener('click',function() {
//The tag is used to remove polygons.
mapView.removePolygon({tag:55});
});
bMore.addEventListener('click',function() {
var dialog = Ti.UI.createOptionDialog({
options:['Zoom Out To World', 'Zoom To Overlays', 'Clear Map'],
title:'More Options'
});
dialog.addEventListener('click',function(e){
if(e.index===0){
mapView.ZoomOutFull();
}
if(e.index===1){
mapView.ZoomToFit();
}
if(e.index===2){
//Remove everything
mapView.clear();
}
});
dialog.show();
});
win.setToolbar([bAddGeoJSON,flexSpace,bRemoveGeoJSON,flexSpace,bMore]); |
// This is a generated source file for Chilkat version 9.5.0.48
#ifndef _C_CkUnixCompress_H
#define _C_CkUnixCompress_H
#include "chilkatDefs.h"
#include "Chilkat_C.h"
CK_VISIBLE_PUBLIC HCkUnixCompress <API key>(void);
CK_VISIBLE_PUBLIC void <API key>(HCkUnixCompress handle);
CK_VISIBLE_PUBLIC void <API key>(HCkUnixCompress cHandle, HCkString retval);
CK_VISIBLE_PUBLIC void <API key>(HCkUnixCompress cHandle, const char *newVal);
CK_VISIBLE_PUBLIC const char *<API key>(HCkUnixCompress cHandle);
CK_VISIBLE_PUBLIC int <API key>(HCkUnixCompress cHandle);
CK_VISIBLE_PUBLIC void <API key>(HCkUnixCompress cHandle, int newVal);
CK_VISIBLE_PUBLIC void <API key>(HCkUnixCompress cHandle, HCkString retval);
CK_VISIBLE_PUBLIC const char *<API key>(HCkUnixCompress cHandle);
CK_VISIBLE_PUBLIC void <API key>(HCkUnixCompress cHandle, HCkString retval);
CK_VISIBLE_PUBLIC const char *<API key>(HCkUnixCompress cHandle);
CK_VISIBLE_PUBLIC void <API key>(HCkUnixCompress cHandle, HCkString retval);
CK_VISIBLE_PUBLIC const char *<API key>(HCkUnixCompress cHandle);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle);
CK_VISIBLE_PUBLIC void <API key>(HCkUnixCompress cHandle, BOOL newVal);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle);
CK_VISIBLE_PUBLIC void <API key>(HCkUnixCompress cHandle, BOOL newVal);
CK_VISIBLE_PUBLIC void <API key>(HCkUnixCompress cHandle, HCkString retval);
CK_VISIBLE_PUBLIC const char *<API key>(HCkUnixCompress cHandle);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle, const char *inFilename, const char *destPath);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle, const char *inFilename, HCkByteData outData);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle, HCkByteData inData, const char *destPath);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle, HCkByteData inData, HCkByteData outData);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle, const char *inStr, const char *charset, HCkByteData outBytes);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle, const char *inStr, const char *charset, const char *destPath);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle, const char *path);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle, const char *zFilename, const char *destDir, BOOL bNoAbsolute);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle, const char *inFilename, const char *destPath);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle, const char *inFilename, HCkByteData outData);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle, const char *zFilename, const char *charset, HCkString outStr);
CK_VISIBLE_PUBLIC const char *<API key>(HCkUnixCompress cHandle, const char *zFilename, const char *charset);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle, HCkByteData inData, const char *destPath);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle, HCkByteData inData, HCkByteData outData);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle, HCkByteData inCompressedData, const char *charset, HCkString outStr);
CK_VISIBLE_PUBLIC const char *<API key>(HCkUnixCompress cHandle, HCkByteData inCompressedData, const char *charset);
CK_VISIBLE_PUBLIC BOOL <API key>(HCkUnixCompress cHandle, const char *unlockCode);
#endif |
package org.praktikum.linuxandc;
import com.sonyericsson.extras.liveware.aef.control.Control;
import com.sonyericsson.extras.liveware.extension.util.ExtensionService;
import com.sonyericsson.extras.liveware.extension.util.control.ControlExtension;
import com.sonyericsson.extras.liveware.extension.util.registration.DeviceInfo;
import com.sonyericsson.extras.liveware.extension.util.registration.DisplayInfo;
import com.sonyericsson.extras.liveware.extension.util.registration.RegistrationAdapter;
import com.sonyericsson.extras.liveware.extension.util.registration.<API key>;
import android.content.Intent;
import android.os.Handler;
import android.util.Log;
/**
* The Sample Extension Service handles registration and keeps track of all
* controls on all accessories.
*/
public class SWExtensionService extends ExtensionService {
//public static final String EXTENSION_KEY = "com.sonyericsson.extras.liveware.extension.samplecontrol.key";
public static final String EXTENSION_KEY = "org.praktikum.linuxandc.key";
public static final String LOG_TAG = "SWExtensionService";
public SWExtensionService() {
super(EXTENSION_KEY);
}
/**
* {@inheritDoc}
*
* @see android.app.Service#onCreate()
*/
@Override
public void onCreate() {
super.onCreate();
Log.d(SWExtensionService.LOG_TAG, "SWExtensionService: onCreate");
}
/*
*
* The service will be started again when a Smart Accessory is
* re-connected. Since the service may have been shut down for
* a while, it is important to check its sources to see if it
* has missed any events that should be replicated to the
* notification content provider.
*
* (non-Javadoc)
* @see com.sonyericsson.extras.liveware.extension.util.ExtensionService#onStartCommand(android.content.Intent, int, int)
*/
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// The SWControlExtension will be created here
Log.d(SWExtensionService.LOG_TAG, "onStartCommand "+ intent.getAction());
int retVal = super.onStartCommand(intent, flags, startId);
if (intent != null) {
// Handling of extension specific intents goes here
//String aha = intent.getStringExtra(Registration.Intents.<API key>);
//Log.i("TAG", "HostAppPackageName: " + aha);
if(intent.getAction().equals(Control.Intents.CONTROL_STOP_INTENT)){
}
}
return retVal;
}
@Override
protected <API key> <API key>() {
return new <API key>(this);
}
/*
* (non-Javadoc)
*
* @see com.sonyericsson.extras.liveware.aef.util.ExtensionService#
* <API key>()
*/
@Override
protected boolean <API key>() {
return false;
}
@Override
public ControlExtension <API key>(String hostAppPackageName) {
Log.d(LOG_TAG, "Overriden method: <API key>() is called");
final int controlSWWidth = SWControlExtension
.<API key>(this);
final int controlSWHeight = SWControlExtension
.<API key>(this);
// final int controlSWHPWidth =
// <API key>.<API key>(this);
// final int controlSWHPHeight =
// <API key>.<API key>(this);
for (DeviceInfo device : RegistrationAdapter.getHostApplication(this,
hostAppPackageName).getDevices()) {
for (DisplayInfo display : device.getDisplays()) {
if (display.sizeEquals(controlSWWidth, controlSWHeight)) {
Log.d(LOG_TAG, "SWControlExtension Constructor is called");
return new SWControlExtension(hostAppPackageName,
this, new Handler());
} // else if (display.sizeEquals(controlSWHPWidth,
// controlSWHPHeight)) {
// return new
// <API key>(hostAppPackageName,
// this,
// new Handler());
}
}
throw new <API key>("No control for: "
+ hostAppPackageName);
}
} |
package org.apereo.cas.token.authentication.principal;
import org.apereo.cas.<API key>;
import org.apereo.cas.authentication.principal.Service;
import org.apereo.cas.authentication.principal.<API key>;
import org.apereo.cas.authentication.principal.<API key>;
import org.apereo.cas.services.RegisteredService;
import org.apereo.cas.services.<API key>;
import org.apereo.cas.services.<API key>;
import org.apereo.cas.services.ServicesManager;
import org.apereo.cas.token.TokenTicketBuilder;
import java.util.Map;
/**
* This is {@link <API key>}.
*
* @author Misagh Moayyed
* @since 5.1.0
*/
public class <API key> extends <API key> {
private static final long serialVersionUID = -<API key>;
private final ServicesManager servicesManager;
private final TokenTicketBuilder tokenTicketBuilder;
public <API key>(final ServicesManager servicesManager,
final TokenTicketBuilder tokenTicketBuilder) {
this.servicesManager = servicesManager;
this.tokenTicketBuilder = tokenTicketBuilder;
}
@Override
protected <API key> buildInternal(final <API key> service,
final Map<String, String> parameters) {
final RegisteredService registeredService = this.servicesManager.findServiceBy(service);
<API key>.<API key>(service, registeredService);
final boolean tokenAsResponse = <API key>.<API key>.TOKEN_AS_RESOPONSE.isAssignedTo(registeredService);
if (!tokenAsResponse) {
return super.buildInternal(service, parameters);
}
final String jwt = generateToken(service, parameters);
final <API key> jwtService = new <API key>(service.getId(), service.getOriginalUrl(), service.getArtifactId());
jwtService.setFormat(service.getFormat());
jwtService.setLoggedOutAlready(service.isLoggedOutAlready());
parameters.put(<API key>.PARAMETER_TICKET, jwt);
return jwtService;
}
/**
* Generate token string.
*
* @param service the service
* @param parameters the parameters
* @return the jwt
*/
protected String generateToken(final Service service, final Map<String, String> parameters) {
try {
final String ticketId = parameters.get(<API key>.PARAMETER_TICKET);
return this.tokenTicketBuilder.build(ticketId, service);
} catch (final Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
}
} |
% skopeo-delete(1)
## NAME
skopeo\-delete - Mark _image-name_ for deletion.
## SYNOPSIS
**skopeo delete** _image-name_
Mark _image-name_ for deletion. To release the allocated disk space, you must login to the container registry server and execute the container registry garbage collector. E.g.,
/usr/bin/registry garbage-collect /etc/docker-distribution/registry/config.yml
Note: sometimes the config.yml is stored in /etc/docker/registry/config.yml
If you are running the container registry inside of a container you would execute something like:
$ docker exec -it registry /usr/bin/registry garbage-collect /etc/docker-distribution/registry/config.yml
**--authfile** _path_
Path of the authentication file. Default is ${XDG_RUNTIME\_DIR}/containers/auth.json, which is set using `podman login`.
If the authorization state is not found there, $HOME/.docker/config.json is checked, which is set using `docker login`.
**--creds** _username[:password]_ for accessing the registry
**--cert-dir** _path_ Use certificates at _path_ (*.crt, *.cert, *.key) to connect to the registry
**--tls-verify** _bool-value_ Require HTTPS and verify certificates when talking to container registries (defaults to true)
Additionally, the registry must allow deletions by setting `<API key>=true` for the registry daemon.
## EXAMPLES
Mark image example/pause for deletion from the registry.example.com registry:
sh
$ skopeo delete --force docker://registry.example.com/example/pause:latest
See above for additional details on using the command **delete**.
## SEE ALSO
skopeo(1), podman-login(1), docker-login(1)
## AUTHORS
Antonio Murdaca <runcom@redhat.com>, Miloslav Trmac <mitr@redhat.com>, Jhon Honce <jhonce@redhat.com> |
# -*- test-case-name: twisted.python.test.test_runtime -*-
from __future__ import division, absolute_import
import os
import sys
import time
import imp
import warnings
from twisted.python import compat
if compat._PY3:
_threadModule = "_thread"
else:
_threadModule = "thread"
def shortPythonVersion():
"""
Returns the Python version as a dot-separated string.
"""
return "%s.%s.%s" % sys.version_info[:3]
knownPlatforms = {
'nt': 'win32',
'ce': 'win32',
'posix': 'posix',
'java': 'java',
'org.python.modules.os': 'java',
}
_timeFunctions = {
#'win32': time.clock,
'win32': time.time,
}
class Platform:
"""
Gives us information about the platform we're running on.
"""
# By oberstet
if os.name == 'java' and hasattr(os, '_name'):
if os._name == 'posix':
osName = os.name
else:
## see:
osName = os._name
else:
osName = os.name
type = knownPlatforms.get(osName)
seconds = staticmethod(_timeFunctions.get(type, time.time))
_platform = sys.platform
def __init__(self, name=None, platform=None):
if name is not None:
self.type = knownPlatforms.get(name)
self.seconds = _timeFunctions.get(self.type, time.time)
if platform is not None:
self._platform = platform
def isKnown(self):
"""
Do we know about this platform?
@return: Boolean indicating whether this is a known platform or not.
@rtype: C{bool}
"""
return self.type != None
def getType(self):
"""
Get platform type.
@return: Either 'posix', 'win32' or 'java'
@rtype: C{str}
"""
return self.type
def isMacOSX(self):
"""
Check if current platform is Mac OS X.
@return: C{True} if the current platform has been detected as OS X.
@rtype: C{bool}
"""
return self._platform == "darwin"
def isWinNT(self):
"""
Are we running in Windows NT?
This is deprecated and always returns C{True} on win32 because
Twisted only supports Windows NT-derived platforms at this point.
@return: C{True} if the current platform has been detected as
Windows NT.
@rtype: C{bool}
"""
warnings.warn(
"twisted.python.runtime.Platform.isWinNT was deprecated in "
"Twisted 13.0. Use Platform.isWindows instead.",
DeprecationWarning, stacklevel=2)
return self.isWindows()
def isWindows(self):
"""
Are we running in Windows?
@return: C{True} if the current platform has been detected as
Windows.
@rtype: C{bool}
"""
return self.getType() == 'win32'
def isVista(self):
"""
Check if current platform is Windows Vista or Windows Server 2008.
@return: C{True} if the current platform has been detected as Vista
@rtype: C{bool}
"""
if getattr(sys, "getwindowsversion", None) is not None:
return sys.getwindowsversion()[0] == 6
else:
return False
def isLinux(self):
"""
Check if current platform is Linux.
@return: C{True} if the current platform has been detected as Linux.
@rtype: C{bool}
"""
return self._platform.startswith("linux")
def supportsThreads(self):
"""
Can threads be created?
@return: C{True} if the threads are supported on the current platform.
@rtype: C{bool}
"""
try:
return imp.find_module(_threadModule)[0] is None
except ImportError:
return False
def supportsINotify(self):
"""
Return C{True} if we can use the inotify API on this platform.
@since: 10.1
"""
try:
from twisted.python._inotify import INotifyError, init
except ImportError:
return False
try:
os.close(init())
except INotifyError:
return False
return True
platform = Platform()
platformType = platform.getType()
seconds = platform.seconds |
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.<API key>(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var di_1 = require('angular2/src/core/di');
var async_1 = require('angular2/src/facade/async');
var common_1 = require('angular2/platform/common');
/**
* A mock implementation of {@link LocationStrategy} that allows tests to fire simulated
* location events.
*/
var <API key> = (function (_super) {
__extends(<API key>, _super);
function <API key>() {
_super.call(this);
this.internalBaseHref = '/';
this.internalPath = '/';
this.internalTitle = '';
this.urlChanges = [];
/** @internal */
this._subject = new async_1.EventEmitter();
}
<API key>.prototype.simulatePopState = function (url) {
this.internalPath = url;
async_1.ObservableWrapper.callEmit(this._subject, new _MockPopStateEvent(this.path()));
};
<API key>.prototype.path = function () { return this.internalPath; };
<API key>.prototype.prepareExternalUrl = function (internal) {
if (internal.startsWith('/') && this.internalBaseHref.endsWith('/')) {
return this.internalBaseHref + internal.substring(1);
}
return this.internalBaseHref + internal;
};
<API key>.prototype.pushState = function (ctx, title, path, query) {
this.internalTitle = title;
var url = path + (query.length > 0 ? ('?' + query) : '');
this.internalPath = url;
var externalUrl = this.prepareExternalUrl(url);
this.urlChanges.push(externalUrl);
};
<API key>.prototype.replaceState = function (ctx, title, path, query) {
this.internalTitle = title;
var url = path + (query.length > 0 ? ('?' + query) : '');
this.internalPath = url;
var externalUrl = this.prepareExternalUrl(url);
this.urlChanges.push('replace: ' + externalUrl);
};
<API key>.prototype.onPopState = function (fn) { async_1.ObservableWrapper.subscribe(this._subject, fn); };
<API key>.prototype.getBaseHref = function () { return this.internalBaseHref; };
<API key>.prototype.back = function () {
if (this.urlChanges.length > 0) {
this.urlChanges.pop();
var nextUrl = this.urlChanges.length > 0 ? this.urlChanges[this.urlChanges.length - 1] : '';
this.simulatePopState(nextUrl);
}
};
<API key>.prototype.forward = function () { throw 'not implemented'; };
<API key> = __decorate([
di_1.Injectable(),
__metadata('design:paramtypes', [])
], <API key>);
return <API key>;
}(common_1.LocationStrategy));
exports.<API key> = <API key>;
var _MockPopStateEvent = (function () {
function _MockPopStateEvent(newUrl) {
this.newUrl = newUrl;
this.pop = true;
this.type = 'popstate';
}
return _MockPopStateEvent;
}());
//# sourceMappingURL=<API key>.js.map |
using NLog.Common;
using NLog.Layouts;
using NLog.Targets;
using RollbarSharp;
namespace NLog.RollbarSharp
{
[Target("RollbarSharp")]
public class RollbarTarget : TargetWithLayout
{
public string AccessToken { get; set; }
public string Endpoint { get; set; }
public Layout Environment { get; set; }
public Layout Platform { get; set; }
public Layout Language { get; set; }
public Layout Framework { get; set; }
public Layout Title { get; set; }
public RollbarTarget()
{
Title = "${message}";
}
protected override void Write(LogEventInfo logEvent)
{
var client = CreateClient(logEvent);
var level = ConvertLogLevel(logEvent.Level);
var title = Title.Render(logEvent);
var notice = logEvent.Exception != null
? client.NoticeBuilder.<API key>(logEvent.Exception)
: client.NoticeBuilder.CreateMessageNotice(logEvent.FormattedMessage);
notice.Level = level;
notice.Title = title;
client.Send(notice,null);
}
<summary>
First attemps to create a RollbarClient using config read from
appSettings. Uses properties of this class as overrides if specified.
</summary>
<param name="logEvent"></param>
<returns></returns>
private RollbarClient CreateClient(LogEventInfo logEvent)
{
var client = new RollbarClient();
client.RequestStarting += <API key>;
client.RequestCompleted += <API key>;
if (!string.IsNullOrEmpty(AccessToken))
client.Configuration.AccessToken = AccessToken;
if (!string.IsNullOrEmpty(Endpoint))
client.Configuration.Endpoint = Endpoint;
if (Environment != null)
client.Configuration.Environment = Environment.Render(logEvent);
if (Platform != null)
client.Configuration.Platform = Platform.Render(logEvent);
if (Language != null)
client.Configuration.Language = Language.Render(logEvent);
if (Framework != null)
client.Configuration.Framework = Framework.Render(logEvent);
return client;
}
<summary>
When posting the request to Rollbar, log it to the internal NLog log
</summary>
<param name="source"></param>
<param name="args"></param>
private static void <API key>(object source, <API key> args)
{
var client = (RollbarClient) source;
InternalLogger.Debug("Sending request to {0}: {1}", client.Configuration.Endpoint, args.Payload);
}
<summary>
When receiving a response from Rollbar, log it to the internal NLog log
</summary>
<param name="source"></param>
<param name="args"></param>
private static void <API key>(object source, <API key> args)
{
if (args.Result.IsSuccess)
{
InternalLogger.Debug("Request was successful: " + args.Result.Message);
return;
}
InternalLogger.Warn("Request failed: " + args.Result);
}
<summary>
Convert the NLog level to a level string understood by Rollbar
</summary>
<param name="level"></param>
<returns></returns>
private static string ConvertLogLevel(LogLevel level)
{
if (level == LogLevel.Fatal) return "critical";
if (level == LogLevel.Error) return "error";
if (level == LogLevel.Warn) return "warning";
if (level == LogLevel.Info) return "info";
if (level == LogLevel.Debug) return "debug";
return "debug";
}
}
} |
min([First|Rest], Min) :- accMin(Rest, First, Min).
accMin([], Accumulator, Accumulator).
accMin([First|Rest], Accumulator, Min) :- First < Accumulator -> accMin(Rest, First, Min) ; accMin(Rest, Accumulator, Min). |
package scratchpad;
import java.lang.invoke.MethodHandles;
import java.util.LinkedHashSet;
import org.eclipse.collections.api.set.MutableSet;
import org.eclipse.collections.impl.set.mutable.SetAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SetIntersectExp
{
final static Logger logger = LoggerFactory.getLogger(SetIntersectExp.class);
public static void main(String[] args)
{
LinkedHashSet<String> setOneBackingSet = new LinkedHashSet<String>();
LinkedHashSet<String> setTwoBackingSet = new LinkedHashSet<String>();
MutableSet<String> setOne = SetAdapter.adapt( setOneBackingSet );
MutableSet<String> setTwo = SetAdapter.adapt( setTwoBackingSet );
setOne.add( "d1" );
setOne.add( "d2" );
setTwo.add( "d1" );
setTwo.add( "d3" );
logger.debug( "setOne ∩ setTwo = " + setOne.intersect( setTwo ) );
logger.debug( "\ndone - " + MethodHandles.lookup().lookupClass() );
}
} |
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Using closures in event listeners</title>
<link href="https://google-developers.appspot.com/maps/documentation/javascript/examples/default.css" rel="stylesheet">
<script src="http:
<script>
function initialize() {
var map = new OpenLayers.Map("map-canvas");
var osmLayer = new OpenLayers.Layer.OSM("OpenStreetMap");
map.addLayer(osmLayer);
var center = new OpenLayers.LonLat(131.044922, -25.363882)
.transform(
new OpenLayers.Projection("EPSG:4326"), // WGS84
map.getProjectionObject()
);
map.setCenter(center, 4);
var markersLayer = new OpenLayers.Layer.Markers("Markers");
map.addLayer(markersLayer);
// Add 5 markers to the map at random locations
var southWest = new OpenLayers.LonLat(125.244141, -31.203405)
.transform(
new OpenLayers.Projection("EPSG:4326"), // WGS84
map.getProjectionObject()
);
var northEast = new OpenLayers.LonLat(131.044922, -25.363882)
.transform(
new OpenLayers.Projection("EPSG:4326"), // WGS84
map.getProjectionObject()
);
var bounds = new OpenLayers.Bounds(southWest.lon, southWest.lat,
northEast.lon, northEast.lat);
map.zoomToExtent(bounds, false);
var lngSpan = northEast.lon - southWest.lon;
var latSpan = northEast.lat - southWest.lat;
for (var i = 0; i < 5; i++) {
var position = new OpenLayers.LonLat(
southWest.lon + lngSpan * Math.random(),
southWest.lat + latSpan * Math.random());
var marker = new OpenLayers.Marker(position);
markersLayer.addMarker(marker);
markerSetTitle(marker, (i + 1).toString(), map);
attachSecretMessage(marker, i, map);
}
}
function markerSetTitle(marker, title, map) {
var titlewindow = new OpenLayers.Popup(
"titlewindow", marker.lonlat, new OpenLayers.Size(24, 32),
title, null, false, null);
//titlewindow.autoSize = true;
map.addPopup(titlewindow);
titlewindow.hide();
marker.events.register('mouseover', this, function() {
titlewindow.show();
});
marker.events.register('mouseout', this, function() {
titlewindow.hide();
});
}
// The five markers show a secret message when clicked
// but that message is not within the marker's instance data
function attachSecretMessage(marker, num, map) {
var message = ['This', 'is', 'the', 'secret', 'message'];
var infowindow = new OpenLayers.Popup.FramedCloud(
"infowindow", marker.lonlat, null, message[num], null, true, null);
infowindow.<API key> = function () {
return 'tr'; // top & right
};
infowindow.autoSize = true;
map.addPopup(infowindow);
infowindow.hide();
marker.events.register('click', this, function() {
infowindow.show();
});
}
</script>
</head>
<body onload="initialize();">
<div id="map-canvas"></div>
</body>
</html> |
using System.Threading.Tasks;
namespace Gitter.Services.Abstract
{
public interface <API key>
{
void SendNotification(string title, string content, string id = null, string group = null);
Task <API key>(string group);
}
} |
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class StatLabelScript : MonoBehaviour {
Text text;
public string title = "title";
public string value = "0";
// Use this for initialization
void Start () {
text = GetComponent<Text>();
SetValue(value);
}
public void SetValue(string value)
{
this.value = value;
if (text)
{
text.text = title + ": " + this.value;
}
}
} |
"use strict";
const jsdom = require('jsdom');
let [xml, yie = 'yield'] = ['XMLHttpRequest', 'Yellow:'];
console.log('xml: ', xml, ', yie: ', yie);
console.log(jsdom);
var dom = new jsdom.JSDOM(`<!DOCTYPE html><p>Hello world</p>`);
function* fibs() {
let a = 0;
let b = 1;
while(true){
yield a;
[a, b] = [b, a+b];
}
} |
:- module(tk_test_aux, [
hello/0,
factorial/2,
show/1,
quit/0],
[objects]).
hello :-
display('Hello !!!!'),
nl.
show(X) :-
display(X),
nl.
factorial(N2,X) :-
factorial_aux(N2,X).
%% display(X),
%% nl.
factorial_aux(0,1).
factorial_aux(N,X1) :-
N > 0,
N1 is N - 1,
factorial_aux(N1,X2),
X1 is X2 * N.
quit. |
package com.google.api.ads.adwords.jaxws.v201406.video;
import java.net.<API key>;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceFeature;
@WebServiceClient(name = "<API key>", targetNamespace = "https:
public class <API key>
extends Service
{
private final static URL <API key>;
private final static WebServiceException <API key>;
private final static QName <API key> = new QName("https://adwords.google.com/api/adwords/video/v201406", "<API key>");
static {
URL url = null;
WebServiceException e = null;
try {
url = new URL("https://adwords.google.com/api/adwords/video/v201406/<API key>?wsdl");
} catch (<API key> ex) {
e = new WebServiceException(ex);
}
<API key> = url;
<API key> = e;
}
public <API key>() {
super(__getWsdlLocation(), <API key>);
}
public <API key>(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
/**
*
* @return
* returns <API key>
*/
@WebEndpoint(name = "<API key>")
public <API key> <API key>() {
return super.getPort(new QName("https://adwords.google.com/api/adwords/video/v201406", "<API key>"), <API key>.class);
}
/**
*
* @param features
* A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
* @return
* returns <API key>
*/
@WebEndpoint(name = "<API key>")
public <API key> <API key>(WebServiceFeature... features) {
return super.getPort(new QName("https://adwords.google.com/api/adwords/video/v201406", "<API key>"), <API key>.class, features);
}
private static URL __getWsdlLocation() {
if (<API key>!= null) {
throw <API key>;
}
return <API key>;
}
} |
var win = Titanium.UI.createWindow({
backgroundColor:'white',
height: '100%',
width: '100%',
fullscreen: true,
exitOnClose: true,
layout: "vertical"
});
var htmlstrng='<html>
<body>
<img src="images/animacion/miedo1.gif" style="width: 30%; height: auto;"/>
<img src="images/animacion/miedo2.gif" style="width: 30%; height: auto; right:40%"/>
</body>
</html>';
var gifView = Titanium.UI.createWebView({
top:'20%',
left:'0%',
html:htmlstrng
});
win.add(gifView);
win.addEventListener("open", function () {
setTimeout(function(){
colorea_nivel_4 = Alloy.createController('colorea_nivel_4');
win.close();
}, 10000);
});
win.open(); |
package org.apereo.cas.impl.calcs;
import org.apereo.cas.api.<API key>;
import org.apereo.cas.api.<API key>;
import org.apereo.cas.authentication.Authentication;
import org.apereo.cas.authentication.Core<API key>;
import org.apereo.cas.config.CasCore<API key>;
import org.apereo.cas.config.CasCore<API key>;
import org.apereo.cas.config.CasCore<API key>;
import org.apereo.cas.config.CasCore<API key>;
import org.apereo.cas.config.CasCore<API key>;
import org.apereo.cas.config.CasCore<API key>;
import org.apereo.cas.config.CasCore<API key>;
import org.apereo.cas.config.<API key>;
import org.apereo.cas.config.<API key>;
import org.apereo.cas.config.CasCoreServices<API key>;
import org.apereo.cas.config.<API key>;
import org.apereo.cas.config.<API key>;
import org.apereo.cas.config.<API key>;
import org.apereo.cas.config.<API key>;
import org.apereo.cas.config.<API key>;
import org.apereo.cas.config.<API key>;
import org.apereo.cas.config.<API key>;
import org.apereo.cas.config.<API key>;
import org.apereo.cas.config.support.<API key>;
import org.apereo.cas.impl.mock.<API key>;
import org.apereo.cas.logout.config.<API key>;
import org.apereo.cas.services.RegisteredService;
import org.apereo.cas.services.<API key>;
import org.apereo.cas.support.events.CasEventRepository;
import org.apereo.cas.support.events.config.<API key>;
import org.apereo.cas.support.events.config.<API key>;
import org.apereo.cas.support.geo.config.<API key>;
import org.apereo.cas.web.config.<API key>;
import org.apereo.cas.web.flow.config.<API key>;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.autoconfigure.<API key>;
import org.springframework.mock.web.<API key>;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.*;
/**
* This is {@link DateTime<API key>}.
*
* @author Misagh Moayyed
* @since 5.1.0
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {<API key>.class,
<API key>.class,
<API key>.class,
<API key>.class,
CasCore<API key>.class,
CasCore<API key>.class,
CasCore<API key>.class,
CasCore<API key>.class,
CasCore<API key>.class,
CasCore<API key>.class,
CasCoreServices<API key>.class,
<API key>.class,
<API key>.class,
<API key>.class,
<API key>.class,
<API key>.class,
<API key>.class,
<API key>.class,
CasCore<API key>.class,
<API key>.class,
<API key>.class,
<API key>.class,
<API key>.class,
<API key>.class,
<API key>.class,
<API key>.class})
@TestPropertySource(properties = "cas.authn.adaptive.risk.dateTime.enabled=true")
@DirtiesContext
@EnableScheduling
public class DateTime<API key> {
@Autowired
@Qualifier("casEventRepository")
private CasEventRepository casEventRepository;
@Autowired
@Qualifier("<API key>)
private <API key> <API key>;
@Before
public void prepTest() {
<API key>.createEvents(this.casEventRepository);
}
@Test
public void verifyTestWhenNo<API key>() {
final Authentication authentication = Core<API key>.getAuthentication("datetimeperson");
final RegisteredService service = <API key>.<API key>("test");
final <API key> request = new <API key>();
final <API key> score = <API key>.eval(authentication, service, request);
assertTrue(score.isHighestRisk());
}
@Test
public void verifyTestWhen<API key>() {
final Authentication authentication = Core<API key>.getAuthentication("casuser");
final RegisteredService service = <API key>.<API key>("test");
final <API key> request = new <API key>();
final <API key> score = <API key>.eval(authentication, service, request);
assertTrue(score.isLowestRisk());
}
} |
<?php
class AdminAction extends Action{
public function admin(){
define('RES',THEME_PATH.'common');
$this->display("index");
}
public function insert(){
$username = $this->_post('username');
$password = $this->_post('password','md5');
if(empty($username)||empty($password)){
$this->error('',U('Admin/index'));
}
$code=$this->_post('code','intval,md5',0);
if($code != $_SESSION['verify']){
$this->error('',U('Admin/index'));
}
$map = array();
$map['username'] = $username;
$map['status'] = 1;
$authInfo = RBAC::authenticate($map,'User');
//exit;
if($authInfo['password']!=$password)$this->error('');
if((false == $authInfo)) {
$this->error('');
}else {
session(C('USER_AUTH_KEY'), $authInfo['id']);
session('userid',$authInfo['id']);
session('username',$authInfo['username']);
session('roleid',$authInfo['role']);
if($authInfo['username']==C('SPECIAL_USER')) {
session(C('ADMIN_AUTH_KEY'), true);
}
$User = M('User');
$ip = get_client_ip();
$data = array();
if($ip){
$Ip = new IpLocation();
$location = $Ip->getlocation($ip);
$data['last_location'] = '';
if($location['country'] && $location['country']!='CZ88.NET') $data['last_location'].=$location['country'];
if($location['area'] && $location['area']!='CZ88.NET') $data['last_location'].=' '.$location['area'];
}
$data['id'] = $authInfo['id'];
$data['last_login_time'] = time();
$data['last_login_ip'] = get_client_ip();
$User->save($data);
RBAC::saveAccessList();
redirect(U('System/index'));
}
}
public function verify(){
Image::buildImageVerify();
}
public function logout() {
session(null);
session_destroy();
unset($_SESSION);
if(session('?'.C('USER_AUTH_KEY'))) {
session(C('USER_AUTH_KEY'),null);
redirect(U('Home/Index/index'));
}else {
$this->error('',U('Home/Index/index'));
}
}
}
?> |
package laika.parse.core
/** An interface for streams of values that have positions.
*
* @author Martin Odersky
* @author Adriaan Moors
*/
abstract class Reader {
/** If this is a reader over character sequences, the underlying char sequence.
* If not, throws a `NoSuchMethodError` exception.
*/
def source: java.lang.CharSequence
def offset: Int
/** Returns the first element of the reader
*/
def first: Char
/** Returns an abstract reader consisting of all elements except the first
*
* @return If `atEnd` is `true`, the result will be `this';
* otherwise, it's a `Reader` containing more elements.
*/
def rest: Reader
/** Returns an abstract reader consisting of all elements except the first `n` elements.
*/
def drop(n: Int): Reader = {
var r: Reader = this
var cnt = n
while (cnt > 0) {
r = r.rest; cnt -= 1
}
r
}
/** The position of the first element in the reader.
*/
def pos: Position
/** `true` iff there are no more elements in this reader.
*/
def atEnd: Boolean
} |
#ifndef QFMIDDLEWARESHOOK_H
#define QFMIDDLEWARESHOOK_H
#include <QObject>
#include <QQmlEngine>
#include <QPointer>
#include "./priv/qfhook.h"
class QFMiddlewaresHook : public QFHook
{
Q_OBJECT
public:
explicit QFMiddlewaresHook(QObject *parent = nullptr);
signals:
public:
void dispatch(QString type, QJSValue message);
void setup(QQmlEngine* engine, QObject* middlewares);
public slots:
void next(int senderId, QString type, QJSValue message);
void resolve(QString type, QJSValue message);
private:
QJSValue invoke;
QPointer<QObject> m_middlewares;
};
#endif // QFMIDDLEWARESHOOK_H |
package com.coderschool.android2.rubit.utils;
import com.coderschool.android2.rubit.constants.DatabaseConstants;
import com.coderschool.android2.rubit.models.UserModel;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.UserInfo;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.util.HashMap;
import java.util.Map;
public class FirebaseUtils {
/**
* New Instance
*
* @return FirebaseAuth
*/
public static Firebase<API key>() {
return FirebaseAuth.getInstance();
}
/**
* Base reference
*
* @return DatabaseReference
*/
public static DatabaseReference getBaseRef() {
return FirebaseDatabase.getInstance().getReference();
}
/**
* get current User Id
*
* @return String
*/
public static String getCurrentUserId() {
FirebaseUser user = <API key>().getCurrentUser();
if (user != null) {
return user.getUid();
}
return null;
}
/**
* get current User Name
*
* @return String
*/
public static String getCurrentUserName() {
FirebaseUser user = <API key>().getCurrentUser();
if (user != null) {
return user.getDisplayName();
}
return null;
}
/**
* get user details
*
* @return UserModel
*/
public static UserModel getUserDetails() {
final FirebaseUser user = <API key>().getCurrentUser();
if (user == null)
return null;
String name = user.getDisplayName();
String email = user.getEmail();
String picture = user.getPhotoUrl() != null ? user.getPhotoUrl().toString() : null;
for (UserInfo userInfo : user.getProviderData()) {
if (name == null && userInfo.getDisplayName() != null) {
name = userInfo.getDisplayName();
}
if (email == null && userInfo.getEmail() != null) {
email = userInfo.getEmail();
}
}
// Tag
Map<String, Boolean> tags = new HashMap<>();
tags.put(DatabaseConstants.TAG_OTHERS, true);
tags.put(DatabaseConstants.TAG_ANDROID, false);
tags.put(DatabaseConstants.TAG_IOS, false);
tags.put(DatabaseConstants.TAG_RUBY, false);
tags.put(DatabaseConstants.TAG_PYTHON, false);
tags.put(DatabaseConstants.TAG_NODEJS, false);
return new UserModel(
getCurrentUserId(),
null,
null,
null,
email,
name,
picture,
0,
false,
tags,
null);
}
/**
* get Current userRef
*
* @return DatabaseReference
*/
public static DatabaseReference getCurrentUserRef() {
String uid = getCurrentUserId();
if (uid != null) {
return getRubitUser().child(uid);
}
return null;
}
/**
* get reference for user table
*
* @return DatabaseReference
*/
public static DatabaseReference getRubitUser() {
return getBaseRef().child(DatabaseConstants.RUBIT_USERS);
}
/**
* get reference for request table
*
* @return DatabaseReference
*/
public static DatabaseReference getRequests() {
return getBaseRef().child(DatabaseConstants.REQUESTS);
}
/**
* get Tag Rubit User
*
* @return DatabaseReference
*/
public static DatabaseReference getTagRubitUser() {
return getRubitUser().child(DatabaseConstants.TAGS);
}
} |
package com.psalgs.ctc.string;
public class CheckEditString {
private boolean oneEditAway(String s1, String s2) {
if (s1 == null || s2 == null) {
return false;
}
if (s1.length() == s2.length()) {
return replace(s1, s2);
} else if (s1.length() + 1 == s2.length()) {
return insert(s1, s2);
} else if (s1.length() - 1 == s2.length()) {
return insert(s2, s1);
}
return false;
}
private boolean replace(String s1, String s2) {
boolean foundDiff = false;
char[] chars1 = s1.toCharArray();
char[] chars2 = s2.toCharArray();
for (int i = 0; i < chars1.length; i++) {
if (chars1[i] != chars2[2]) {
if (foundDiff) {
return false;
}
foundDiff = true;
}
}
return true;
}
private boolean insert(String s1, String s2) {
int index1 = 0;
int index2 = 0;
char[] chars1 = s1.toCharArray();
char[] chars2 = s2.toCharArray();
while (index1 < s1.length() && index2 < s2.length()) {
if (chars1[index1] != chars2[index2]) {
if (index1 != index2) {
return false;
}
index2++;
} else {
index1++;
index2++;
}
}
return true;
}
/**
* method2: Handle replace and insert in the same method;
*/
private boolean method2(String s1, String s2) {
if (s1 == null || s2 == null || s1.length() - s2.length() == 0) {
return false;
}
String str1 = s1.length() < s2.length() ? s1 : s2;
String str2 = s1.length() < s2.length() ? s2 : s1;
int index1 = 0;
int index2 = 0;
char[] chars1 = str1.toCharArray();
char[] chars2 = str2.toCharArray();
boolean foundDiff = false;
while (index1 < s1.length() && index2 < s2.length()) {
if (chars1[index1] != chars2[index2]) {
if (foundDiff) {
return false;
}
foundDiff = true;
if (chars1.length == chars2.length) {
index1++;
}
} else {
index1++;
}
index2++;
}
return true;
}
public static void main(String args[]) {
CheckEditString one = new CheckEditString();
System.out.println(one.oneEditAway("pale", "ple"));
System.out.println(one.oneEditAway("pales", "pale"));
System.out.println(one.oneEditAway("pale", "bale"));
System.out.println(one.method2("ac", "abc"));
}
} |
package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaJsapiService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import me.chanjar.weixin.common.bean.WxJsapiSignature;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.RandomUtils;
import me.chanjar.weixin.common.util.crypto.SHA1;
import java.util.concurrent.locks.Lock;
public class <API key> implements WxMaJsapiService {
private static final JsonParser JSON_PARSER = new JsonParser();
private WxMaService wxMaService;
public <API key>(WxMaService wxMaService) {
this.wxMaService = wxMaService;
}
@Override
public String getJsapiTicket() throws WxErrorException {
return getJsapiTicket(false);
}
@Override
public String getJsapiTicket(boolean forceRefresh) throws WxErrorException {
Lock lock = this.wxMaService.getWxMaConfig().getJsapiTicketLock();
try {
lock.lock();
if (forceRefresh) {
this.wxMaService.getWxMaConfig().expireJsapiTicket();
}
if (this.wxMaService.getWxMaConfig().<API key>()) {
String responseContent = this.wxMaService.get(<API key>, null);
JsonElement tmpJsonElement = JSON_PARSER.parse(responseContent);
JsonObject tmpJsonObject = tmpJsonElement.getAsJsonObject();
String jsapiTicket = tmpJsonObject.get("ticket").getAsString();
int expiresInSeconds = tmpJsonObject.get("expires_in").getAsInt();
this.wxMaService.getWxMaConfig().updateJsapiTicket(jsapiTicket, expiresInSeconds);
}
} finally {
lock.unlock();
}
return this.wxMaService.getWxMaConfig().getJsapiTicket();
}
@Override
public WxJsapiSignature <API key>(String url) throws WxErrorException {
long timestamp = System.currentTimeMillis() / 1000;
String randomStr = RandomUtils.getRandomStr();
String jsapiTicket = getJsapiTicket(false);
String signature = SHA1.genWithAmple("jsapi_ticket=" + jsapiTicket,
"noncestr=" + randomStr, "timestamp=" + timestamp, "url=" + url);
return WxJsapiSignature
.builder()
.appId(this.wxMaService.getWxMaConfig().getAppid())
.timestamp(timestamp)
.nonceStr(randomStr)
.url(url)
.signature(signature)
.build();
}
} |
package com.google.api.ads.dfp.jaxws.v201403;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"rval"
})
@XmlRootElement(name = "<API key>")
public class ContentMetadataKeyHierarchyServiceInterfaceperformContentMetadataKeyHierarchyActionResponse {
protected UpdateResult rval;
/**
* Gets the value of the rval property.
*
* @return
* possible object is
* {@link UpdateResult }
*
*/
public UpdateResult getRval() {
return rval;
}
/**
* Sets the value of the rval property.
*
* @param value
* allowed object is
* {@link UpdateResult }
*
*/
public void setRval(UpdateResult value) {
this.rval = value;
}
} |
<!DOCTYPE html>
<html>
<head>
<!
<meta charset="utf-8" />
<meta http-equiv="<API key>" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="<API key>" content="no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<link rel="stylesheet" href="css/jquery.mobile-1.4.5.min.css" />
<title>Index</title>
</head>
<body>
<div data-role="header" data-position="fixed" data-theme="a">
<h1>Guidling</h1>
<div data-role="navbar">
<ul>
<li><a href="index.html" data-prefetch="true" data-transition="fade">Routen</a></li>
<li><a href="info.html" data-prefetch="true" data-transition="fade">Info</a></li>
<li><a href="tour.html" data-prefetch="true" data-transition="fade">Tour</a></li>
</ul>
</div><!-- /navbar -->
</div><!-- /header -->
<div data-role="page" data-title="Routen">
<div role="main" class="ui-content">
Index
<ul data-role="listview">
<li><a href="info.html" data-transition="slide">Route 1</a></li>
<li><a href="info.html" data-transition="slide">Route 2</a></li>
<li><a href="info.html" data-transition="slide">Route 3</a></li>
<li><a href="info.html" data-transition="slide">Route 4</a></li>
<li><a href="info.html" data-transition="slide">Route 5</a></li>
</ul>
</div><!-- /content -->
</div><!-- /page -->
<div data-role="footer" data-id="footer" class="ui-bar" data-position="fixed" data-theme="a">
<div data-role="controlgroup" data-type="horizontal">
<a href="#" onclick="showMap()" data-role="button" data-icon="arrow-u" data-mini="true">Show Map</a>
<a href="#" onclick="hideMap()" data-role="button" data-icon="arrow-d" data-mini="true">Hide Map</a>
</div>
</div><!-- /footer -->
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="scripts/platformOverrides.js"></script>
<script type="text/javascript" src="scripts/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="scripts/jquery.mobile-1.4.5.min.js"></script>
<script type="text/javascript" src="scripts/navbar.js"></script>
<script type="text/javascript" src="scripts/mapbox.js"></script>
</body>
</html> |
<?php
/*
Format of "sentences_detailed.csv":
id [tab] lang [tab] text [tab] username [tab] date_added [tab] date_last_modified
*/
/**
* The class is intended build the links between the sentences, returned by CorpusReader/read().
*/
class SentenceLinker
{
/**
* If true, prints current progress status on the screen
* If false, doesn't print anything and just returns the results.
*/
public static $print_reports = true;
/** What's the expected CSV delimeter */
public static $DELIMETER = "\t";
/** What's the expected length of once CSV line */
public static $LINE_LENGTH = 64;
/**
* Per how many recodrs print the current reading status
* Calculated automatically to represent approximately 1% of the requested amount.
* The default value is used if $length == 0
*/
public static $<API key> = 1000;
/** Array of records to be linked */
private static $records;
/** Length of$records */
private static $recordsLen;
/** Array of records, that have the sentence ID as a key */
private static $orderedRecords;
/** Size of the links file */
private static $totalSize;
// average link-record length in the file, used for progress printing
private static $<API key> = 15;
/** Size of the processed part of the links so far*/
private static $processedSize = 0;
/**
* Reads the links file and tries to link the provided sentences with each other.
* @param String $filename name of the links.csv
* @param Array $records an array, returned by CorpusReader or of the same format.
*/
public static function link($filename, $records)
{
if(!file_exists($filename) || !is_readable($filename))
exit("file $filename not found!");
self::$records = $records;
self::$recordsLen = count($records);
self::$totalSize = filesize($filename);
// print report frequency based on the file size
self::$<API key> = self::$totalSize / self::$<API key> / 50;
// populate self::$orderedRecords
self::orderRecords();
if (self::$print_reports)
print "Beginning linking process using $filename\n\n";
$counter = 0;
$foundCounter = 0;
//Assoc array of links: [$sentID_1] => $sentID_2
$links = array();
if (($handle = fopen($filename, 'r')) !== FALSE)
{
while (($currentLink = fgetcsv($handle, self::$LINE_LENGTH, self::$DELIMETER)) !== FALSE)
{
//print_r($currentLink);
$leftID = $currentLink[0];
$rightID = $currentLink[1];
//print "left=$leftID, right=$rightID\n";
if ( array_key_exists($leftID, self::$orderedRecords) &&
array_key_exists($rightID, self::$orderedRecords))
{
$links[$leftID] = $rightID;
$foundCounter++;
}
// get the length of the currently processed link record and add it to the total
self::$processedSize += strlen($leftID.$rightID);
$counter++;
if (self::$print_reports)
{
if ( $counter%self::$<API key>==0)
{
// percentage of the processed data
$prcnt = round(self::$processedSize/self::$totalSize *100) . '%';
// memory usage status
$mem = 'mem: ' . round(<API key>()/1048576, 2).'M / '.ini_get('memory_limit');
print "Linking...$counter.\tLinks found: $foundCounter\t[ $prcnt ]\t[ $mem ]\n";
}
}
}
fclose($handle);
}
else
{
exit("Could not read from $filename");
}
if (self::$print_reports)
print "\n\n";
return $links;
}
/** Populates self::$orderedRecords */
private static function orderRecords()
{
if (self::$print_reports)
print "\nOrdering records...\n\n";
foreach (self::$records as $record)
self::$orderedRecords[$record['id']] = $record;
}
} |
package com.lpii.evma.view;
import com.lpii.evma.adapter.BaseInflaterAdapter;
import android.view.View;
import android.view.ViewGroup;
public interface <API key><T>
{
public View inflate(BaseInflaterAdapter<T> adapter, int pos, View convertView, ViewGroup parent);
} |
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using VaultSharp.Core;
using VaultSharp.V1.Commons;
namespace VaultSharp.V1.SecretsEngines.KeyValue.V2
{
internal class KeyValue<API key> : <API key>
{
private readonly Polymath _polymath;
public KeyValue<API key>(Polymath polymath)
{
_polymath = polymath;
}
public async Task<Secret<SecretData>> ReadSecretAsync(string path, int? version = null, string mountPoint = null, string wrapTimeToLive = null)
{
Checker.NotNull(path, "path");
return await _polymath.MakeVaultApiRequest<Secret<SecretData>>(mountPoint ?? _polymath.VaultClientSettings.<API key>.KeyValueV2, "/data/" + path.Trim('/') + (version != null ? ("?version=" + version) : ""), HttpMethod.Get, wrapTimeToLive: wrapTimeToLive).ConfigureAwait(_polymath.VaultClientSettings.<API key>);
}
public async Task<Secret<SecretData<T>>> ReadSecretAsync<T>(string path, int? version = null, string mountPoint = null, string wrapTimeToLive = null)
{
Checker.NotNull(path, "path");
return await _polymath.MakeVaultApiRequest<Secret<SecretData<T>>>(mountPoint ?? _polymath.VaultClientSettings.<API key>.KeyValueV2, "/data/" + path.Trim('/') + (version != null ? ("?version=" + version) : ""), HttpMethod.Get, wrapTimeToLive: wrapTimeToLive).ConfigureAwait(_polymath.VaultClientSettings.<API key>);
}
public async Task<Secret<FullSecretMetadata>> <API key>(string path, string mountPoint = null, string wrapTimeToLive = null)
{
Checker.NotNull(path, "path");
return await _polymath.MakeVaultApiRequest<Secret<FullSecretMetadata>>(mountPoint ?? _polymath.VaultClientSettings.<API key>.KeyValueV2, "/metadata/" + path.Trim('/'), HttpMethod.Get, wrapTimeToLive: wrapTimeToLive).ConfigureAwait(_polymath.VaultClientSettings.<API key>);
}
public async Task<Secret<ListInfo>> <API key>(string path, string mountPoint = null, string wrapTimeToLive = null)
{
var suffixPath = string.IsNullOrWhiteSpace(path) ? string.Empty : "/" + path.Trim('/');
return await _polymath.MakeVaultApiRequest<Secret<ListInfo>>(mountPoint ?? _polymath.VaultClientSettings.<API key>.KeyValueV2, "/metadata" + suffixPath + "?list=true", HttpMethod.Get, wrapTimeToLive: wrapTimeToLive).ConfigureAwait(_polymath.VaultClientSettings.<API key>);
}
public async Task<Secret<<API key>>> WriteSecretAsync<T>(string path, T data, int? checkAndSet = null, string mountPoint = null)
{
Checker.NotNull(path, "path");
var requestData = new Dictionary<string, object>
{
{ "data", data }
};
if (checkAndSet != null)
{
requestData.Add("options", new { cas = checkAndSet.Value });
}
return await _polymath.MakeVaultApiRequest<Secret<<API key>>>(mountPoint ?? _polymath.VaultClientSettings.<API key>.KeyValueV2, "/data/" + path.Trim('/'), HttpMethod.Post, requestData).ConfigureAwait(_polymath.VaultClientSettings.<API key>);
}
public async Task<Secret<<API key>>> PatchSecretAsync(string path, IDictionary<string, object> newData, string mountPoint = null)
{
Checker.NotNull(path, "path");
// https://github.com/hashicorp/vault/blob/master/command/kv_patch.go#L126
var currentSecret = await ReadSecretAsync(path, mountPoint: mountPoint).ConfigureAwait(_polymath.VaultClientSettings.<API key>);
if (currentSecret == null || currentSecret.Data == null)
{
throw new VaultApiException("No value found at " + path);
}
var metadata = currentSecret.Data.Metadata;
if (metadata == null)
{
throw new VaultApiException("No metadata found at " + path + "; patch only works on existing data");
}
if (currentSecret.Data.Data == null)
{
throw new VaultApiException("No data found at " + path + "; patch only works on existing data");
}
foreach(var entry in newData)
{
// upsert
currentSecret.Data.Data[entry.Key] = entry.Value;
}
var requestData = new
{
data = currentSecret.Data.Data,
options = new Dictionary<string, object>
{
{ "cas", metadata.Version }
}
};
return await _polymath.MakeVaultApiRequest<Secret<<API key>>>(mountPoint ?? _polymath.VaultClientSettings.<API key>.KeyValueV2, "/data/" + path.Trim('/'), HttpMethod.Post, requestData).ConfigureAwait(_polymath.VaultClientSettings.<API key>);
}
public async Task DeleteSecretAsync(string path, string mountPoint = null)
{
Checker.NotNull(path, "path");
await _polymath.MakeVaultApiRequest(mountPoint ?? _polymath.VaultClientSettings.<API key>.KeyValueV2, "/data/" + path.Trim('/'), HttpMethod.Delete).ConfigureAwait(_polymath.VaultClientSettings.<API key>);
}
public async Task <API key>(string path, IList<int> versions, string mountPoint = null)
{
Checker.NotNull(path, "path");
Checker.NotNull(versions, "versions");
var requestData = new { versions = versions };
await _polymath.MakeVaultApiRequest(mountPoint ?? _polymath.VaultClientSettings.<API key>.KeyValueV2, "/delete/" + path.Trim('/'), HttpMethod.Post, requestData).ConfigureAwait(_polymath.VaultClientSettings.<API key>);
}
public async Task <API key>(string path, IList<int> versions, string mountPoint = null)
{
Checker.NotNull(path, "path");
Checker.NotNull(versions, "versions");
var requestData = new { versions = versions };
await _polymath.MakeVaultApiRequest(mountPoint ?? _polymath.VaultClientSettings.<API key>.KeyValueV2, "/undelete/" + path.Trim('/'), HttpMethod.Post, requestData).ConfigureAwait(_polymath.VaultClientSettings.<API key>);
}
public async Task DestroySecretAsync(string path, IList<int> versions, string mountPoint = null)
{
Checker.NotNull(path, "path");
Checker.NotNull(versions, "versions");
var requestData = new { versions = versions };
await _polymath.MakeVaultApiRequest(mountPoint ?? _polymath.VaultClientSettings.<API key>.KeyValueV2, "/destroy/" + path.Trim('/'), HttpMethod.Post, requestData).ConfigureAwait(_polymath.VaultClientSettings.<API key>);
}
public async Task DeleteMetadataAsync(string path, string mountPoint = "secret")
{
Checker.NotNull(mountPoint, "mountPoint");
Checker.NotNull(path, "path");
await _polymath.MakeVaultApiRequest("v1/" + mountPoint.Trim('/') + "/metadata/" + path.Trim('/'), HttpMethod.Delete).ConfigureAwait(_polymath.VaultClientSettings.<API key>);
}
}
} |
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="sv">
<head>
<!-- Generated by javadoc (1.8.0_66) on Fri Feb 05 09:38:24 CET 2016 -->
<title>API Help</title>
<meta name="date" content="2016-02-05">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="API Help";
}
}
catch(err) {
}
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="topNav"><a name="navbar.top">
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="se/mah/ke/k3lara/package-summary.html">Package</a></li>
<li>Class</li>
<li>Use</li>
<li><a href="overview-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li class="navBarCell1Rev">Help</li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?help-doc.html" target="_top">Frames</a></li>
<li><a href="help-doc.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip.navbar.top">
</a></div>
<div class="header">
<h1 class="title">How This API Document Is Organized</h1>
<div class="subTitle">This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.</div>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<h2>Package</h2>
<p>Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:</p>
<ul>
<li>Interfaces (italic)</li>
<li>Classes</li>
<li>Enums</li>
<li>Exceptions</li>
<li>Errors</li>
<li>Annotation Types</li>
</ul>
</li>
<li class="blockList">
<h2>Class/Interface</h2>
<p>Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:</p>
<ul>
<li>Class inheritance diagram</li>
<li>Direct Subclasses</li>
<li>All Known Subinterfaces</li>
<li>All Known Implementing Classes</li>
<li>Class/interface declaration</li>
<li>Class/interface description</li>
</ul>
<ul>
<li>Nested Class Summary</li>
<li>Field Summary</li>
<li>Constructor Summary</li>
<li>Method Summary</li>
</ul>
<ul>
<li>Field Detail</li>
<li>Constructor Detail</li>
<li>Method Detail</li>
</ul>
<p>Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.</p>
</li>
<li class="blockList">
<h2>Annotation Type</h2>
<p>Each annotation type has its own separate page with the following sections:</p>
<ul>
<li>Annotation Type declaration</li>
<li>Annotation Type description</li>
<li>Required Element Summary</li>
<li>Optional Element Summary</li>
<li>Element Detail</li>
</ul>
</li>
<li class="blockList">
<h2>Enum</h2>
<p>Each enum has its own separate page with the following sections:</p>
<ul>
<li>Enum declaration</li>
<li>Enum description</li>
<li>Enum Constant Summary</li>
<li>Enum Constant Detail</li>
</ul>
</li>
<li class="blockList">
<h2>Use</h2>
<p>Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.</p>
</li>
<li class="blockList">
<h2>Tree (Class Hierarchy)</h2>
<p>There is a <a href="overview-tree.html">Class Hierarchy</a> page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with <code>java.lang.Object</code>. The interfaces do not inherit from <code>java.lang.Object</code>.</p>
<ul>
<li>When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.</li>
<li>When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.</li>
</ul>
</li>
<li class="blockList">
<h2>Deprecated API</h2>
<p>The <a href="deprecated-list.html">Deprecated API</a> page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.</p>
</li>
<li class="blockList">
<h2>Index</h2>
<p>The <a href="index-files/index-1.html">Index</a> contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.</p>
</li>
<li class="blockList">
<h2>Prev/Next</h2>
<p>These links take you to the next or previous class, interface, package, or related page.</p>
</li>
<li class="blockList">
<h2>Frames/No Frames</h2>
<p>These links show and hide the HTML frames. All pages are available with or without frames.</p>
</li>
<li class="blockList">
<h2>All Classes</h2>
<p>The <a href="allclasses-noframe.html">All Classes</a> link shows all classes and interfaces except non-static nested types.</p>
</li>
<li class="blockList">
<h2>Serialized Form</h2>
<p>Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.</p>
</li>
<li class="blockList">
<h2>Constant Field Values</h2>
<p>The <a href="constant-values.html">Constant Field Values</a> page lists the static final fields and their values.</p>
</li>
</ul>
<span class="emphasizedPhrase">This help file applies to API documentation generated using the standard doclet.</span></div>
<div class="bottomNav"><a name="navbar.bottom">
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="se/mah/ke/k3lara/package-summary.html">Package</a></li>
<li>Class</li>
<li>Use</li>
<li><a href="overview-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li class="navBarCell1Rev">Help</li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?help-doc.html" target="_top">Frames</a></li>
<li><a href="help-doc.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip.navbar.bottom">
</a></div>
</body>
</html> |
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Owin;
using Owin;
using HDO2O.API.App_Start;
[assembly: OwinStartup(typeof(HDO2O.API.Startup))]
namespace HDO2O.API
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
IocContainer.Configure();
}
}
} |
FROM node:16
RUN apt-get update && \
apt install -y \
python3 \
python3-pip \
pylint \ |
package com.intellij.execution.testframework.actions;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.Executor;
import com.intellij.execution.<API key>;
import com.intellij.execution.configurations.*;
import com.intellij.execution.executors.<API key>;
import com.intellij.execution.executors.DefaultRunExecutor;
import com.intellij.execution.runners.<API key>;
import com.intellij.execution.runners.<API key>;
import com.intellij.execution.runners.ProgramRunner;
import com.intellij.execution.testframework.AbstractTestProxy;
import com.intellij.execution.testframework.Filter;
import com.intellij.execution.testframework.<API key>;
import com.intellij.execution.testframework.<API key>;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.actionSystem.ex.ActionUtil;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComponentContainer;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.Getter;
import com.intellij.openapi.util.<API key>;
import com.intellij.openapi.util.<API key>;
import com.intellij.psi.search.GlobalSearchScope;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import javax.swing.*;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
/**
* @author anna
*/
public abstract class <API key> extends AnAction implements AnAction.TransparentUpdate {
private static final Logger LOG = Logger.getInstance(<API key>.class);
private <API key> myModel;
private Getter<? extends <API key>> myModelProvider;
protected <API key> myConsoleProperties;
protected <API key>(@NotNull ComponentContainer componentContainer) {
ActionUtil.copyFrom(this, "RerunFailedTests");
<API key>(getShortcutSet(), componentContainer.getComponent());
}
public void init(<API key> consoleProperties) {
myConsoleProperties = consoleProperties;
}
public void setModel(<API key> model) {
myModel = model;
}
public void setModelProvider(Getter<? extends <API key>> modelProvider) {
myModelProvider = modelProvider;
}
@Override
public final void update(@NotNull AnActionEvent e) {
e.getPresentation().setEnabled(isActive(e));
}
private boolean isActive(@NotNull AnActionEvent e) {
Project project = e.getProject();
if (project == null) {
return false;
}
<API key> model = getModel();
if (model == null || model.getRoot() == null) {
return false;
}
<API key> environment = e.getData(LangDataKeys.<API key>);
if (environment == null) {
return false;
}
<API key> settings = environment.<API key>();
if (settings != null && !settings.getType().isDumbAware() && DumbService.isDumb(project)) {
return false;
}
Filter filter = getFailuresFilter();
for (AbstractTestProxy test : model.getRoot().getAllTests()) {
//noinspection unchecked
if (filter.shouldAccept(test)) {
return true;
}
}
return false;
}
@NotNull
protected List<AbstractTestProxy> getFailedTests(@NotNull Project project) {
<API key> model = getModel();
if (model == null) return Collections.emptyList();
//noinspection unchecked
return getFilter(project, model.getProperties().getScope()).select(model.getRoot().getAllTests());
}
@NotNull
protected Filter getFilter(@NotNull Project project, @NotNull GlobalSearchScope searchScope) {
return getFailuresFilter();
}
protected Filter<?> getFailuresFilter() {
return getFailuresFilter(myConsoleProperties);
}
@TestOnly
public static Filter<?> getFailuresFilter(<API key> consoleProperties) {
if (<API key>.<API key>.value(consoleProperties)) {
return Filter.NOT_PASSED.or(Filter.<API key>).and(Filter.IGNORED.not());
}
return Filter.<API key>.and(Filter.IGNORED.not());
}
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
<API key> environment = e.getData(LangDataKeys.<API key>);
if (environment == null) {
return;
}
execute(e, environment);
}
void execute(@NotNull AnActionEvent e, @NotNull <API key> environment) {
MyRunProfile profile = getRunProfile(environment);
if (profile == null) {
return;
}
final <API key> environmentBuilder = new <API key>(environment).runProfile(profile);
final InputEvent event = e.getInputEvent();
if (!(event instanceof MouseEvent) || !event.isShiftDown()) {
performAction(environmentBuilder);
return;
}
final LinkedHashMap<Executor, ProgramRunner> availableRunners = new LinkedHashMap<>();
for (Executor ex : new Executor[] {DefaultRunExecutor.<API key>(), <API key>.<API key>()}) {
final ProgramRunner runner = ProgramRunner.getRunner(ex.getId(), profile);
if (runner != null) {
availableRunners.put(ex, runner);
}
}
if (availableRunners.isEmpty()) {
LOG.error(environment.getExecutor().getActionName() + " is not available now");
}
else if (availableRunners.size() == 1) {
performAction(environmentBuilder.runner(availableRunners.get(environment.getExecutor())));
}
else {
ArrayList<Executor> model = new ArrayList<>(availableRunners.keySet());
JBPopupFactory.getInstance().<API key>(model)
.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
.setSelectedValue(environment.getExecutor(), true)
.setRenderer(new <API key>() {
@NotNull
@Override
public Component <API key>(@NotNull JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus) {
final Component component = super.<API key>(list, value, index, isSelected, cellHasFocus);
if (value instanceof Executor) {
setText(((Executor)value).getActionName());
setIcon(((Executor)value).getIcon());
}
return component;
}
})
.setTitle("Restart Failed Tests")
.setMovable(false)
.setResizable(false)
.setRequestFocus(true)
.<API key>((value) -> performAction(environmentBuilder.runner(availableRunners.get(value)).executor(value)))
.createPopup().showUnderneathOf(event.getComponent());
}
}
private static void performAction(@NotNull <API key> builder) {
<API key> environment = builder.build();
try {
environment.getRunner().execute(environment);
}
catch (ExecutionException e) {
LOG.error(e);
}
finally {
((MyRunProfile)environment.getRunProfile()).clear();
}
}
/**
* @deprecated use {@link #getRunProfile(<API key>)}
*/
@Deprecated
public MyRunProfile getRunProfile() {
return null;
}
@Nullable
protected MyRunProfile getRunProfile(@NotNull <API key> environment) {
//noinspection deprecation
return getRunProfile();
}
@Nullable
public <API key> getModel() {
if (myModel != null) {
return myModel;
}
if (myModelProvider != null) {
return myModelProvider.get();
}
return null;
}
protected static abstract class MyRunProfile extends <API key><Element> implements ModuleRunProfile,
<API key><<API key>> {
@Deprecated
public <API key> getConfiguration() {
return getPeer();
}
@Override
public <API key> getPeer() {
return myConfiguration;
}
private final <API key> myConfiguration;
public MyRunProfile(<API key> configuration) {
super(configuration.getProject(), configuration.getFactory(), ActionsBundle.message("action.RerunFailedTests.text"));
myConfiguration = configuration;
}
public void clear() {
}
////////////////////////////////Delegates
@Override
public void readExternal(@NotNull final Element element) throws <API key> {
myConfiguration.readExternal(element);
}
@Override
public void writeExternal(@NotNull final Element element) throws <API key> {
myConfiguration.writeExternal(element);
}
@Override
@NotNull
public SettingsEditor<? extends RunConfiguration> <API key>() {
return myConfiguration.<API key>();
}
@Override
public <API key> <API key>(final <API key> provider) {
return myConfiguration.<API key>(provider);
}
@Override
public SettingsEditor<<API key>> <API key>(final ProgramRunner runner) {
return myConfiguration.<API key>(runner);
}
@Override
public RunConfiguration clone() {
return myConfiguration.clone();
}
@Override
public int getUniqueID() {
return myConfiguration.getUniqueID();
}
@Override
public LogFileOptions <API key>(PredefinedLogFile predefinedLogFile) {
return myConfiguration.<API key>(predefinedLogFile);
}
@NotNull
@Override
public List<PredefinedLogFile> <API key>() {
return myConfiguration.<API key>();
}
@NotNull
@Override
public ArrayList<LogFileOptions> getAllLogFiles() {
return myConfiguration.getAllLogFiles();
}
@NotNull
@Override
public List<LogFileOptions> getLogFiles() {
return myConfiguration.getLogFiles();
}
}
@Override
public boolean isDumbAware() {
return true;
}
} |
# Cookbook Name:: mongodb
# Recipe:: default
package 'mongodb' do
action :install
end |
package com.example.administrator.coolweather;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.administrator.coolweather.db.City;
import com.example.administrator.coolweather.db.County;
import com.example.administrator.coolweather.db.Province;
import com.example.administrator.coolweather.util.HttpUtil;
import com.example.administrator.coolweather.util.Utility;
import org.litepal.crud.DataSupport;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;
public class ChooseAreaFragment extends Fragment {
public static final int LEVEL_PROVINCE = 0;
public static final int LEVEL_CITY = 1;
public static final int LEVEL_COUNTY = 2;
private ProgressDialog progressDialog;
private TextView textView ;
private Button button;
private ListView listView;
private ArrayAdapter<String> adapter;
private List<String> datalist = new ArrayList<>();
private List<Province> provinceList;
private List<City> cityList;
private List<County> countyList;
private Province selectProvince;
private City selectCity;
private int currentLevel;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.choose_area, container, false);
textView = (TextView) view.findViewById(R.id.title_text);
button = (Button) view.findViewById(R.id.back_button);
listView = (ListView) view.findViewById(R.id.list_view);
adapter = new ArrayAdapter<>(getContext(),android.R.layout.simple_list_item_1,datalist);
listView.setAdapter(adapter);
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
listView.<API key>(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
if (currentLevel == LEVEL_PROVINCE){
selectProvince = provinceList.get(i);
queryCity();
}else if (currentLevel == LEVEL_CITY){
selectCity = cityList.get(i);
queryCounty();
}else if (currentLevel == LEVEL_COUNTY){
String weatherId = countyList.get(i).getWeatherId();
if (getActivity() instanceof MainActivity) {
Intent intent = new Intent(getActivity(), WeatherActivity.class);
intent.putExtra("weather_id", weatherId);
startActivity(intent);
getActivity().finish();
}else if (getActivity() instanceof WeatherActivity){
WeatherActivity weatherActivity = (WeatherActivity) getActivity();
weatherActivity.drawlayout.closeDrawers();
weatherActivity.swipe_refresh.setRefreshing(true);
weatherActivity.requestWeather(weatherId);
}
}
}
});
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (currentLevel == LEVEL_COUNTY){
queryCity();
}else if (currentLevel == LEVEL_CITY){
queryProvince();
}
}
});
queryProvince();
}
private void queryCounty() {
textView.setText(selectCity.getCityName());
button.setVisibility(View.VISIBLE);
countyList = DataSupport.where("cityid = ?",String.valueOf(selectCity.getId())).find(County.class);
if (countyList.size()>0){
datalist.clear();
for (County county : countyList){
datalist.add(county.getCountyName());
}
adapter.<API key>();
listView.setSelection(0);
currentLevel = LEVEL_COUNTY;
}else {
int provinceCode = selectProvince.getProvinceCode();
int cityCode = selectCity.getCityCode();
String address = "http://guolin.tech/api/china/"+provinceCode+"/"+cityCode;
queryFromServer(address,"county");
}
}
private void queryProvince() {
textView.setText("");
button.setVisibility(View.GONE);
provinceList = DataSupport.findAll(Province.class);
if (provinceList.size()>0){
datalist.clear();
for (Province province : provinceList){
datalist.add(province.getProvinceName());
}
adapter.<API key>();
listView.setSelection(0);
currentLevel = LEVEL_PROVINCE;
}else {
String address = "http://guolin.tech/api/china";
queryFromServer(address,"province");
}
}
private void queryFromServer(String address, final String type) {
showProgressDialog();
HttpUtil.sendOKHttpRequest(address, new Callback() {
@Override
public void onFailure(Call call, IOException e) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
closeProgressDialog();
Toast.makeText(getContext(),"",Toast.LENGTH_SHORT).show();
}
});
}
@Override
public void onResponse(Call call, Response response) throws IOException {
String responseText = response.body().string();
boolean result = false;
if ("province".equals(type)){
result = Utility.<API key>(responseText);
}else if ("city".equals(type)){
result = Utility.handleCityResponse(responseText,selectProvince.getId());
}else if ("county".equals(type)){
result = Utility.<API key>(responseText,selectCity.getId());
}
if (result){
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
closeProgressDialog();
if ("province".equals(type)){
queryProvince();
}else if ("city".equals(type)){
queryCity();
}else if ("county".equals(type)){
queryCounty();
}
}
});
}
}
});
}
private void queryCity() {
textView.setText(selectProvince.getProvinceName());
button.setVisibility(View.VISIBLE);
cityList = DataSupport.where("provinceid = ?",String.valueOf(selectProvince.getId())).find(City.class);
if (cityList.size()>0){
datalist.clear();
for (City city : cityList){
datalist.add(city.getCityName());
}
adapter.<API key>();
listView.setSelection(0);
currentLevel = LEVEL_CITY;
}else {
int provinceCode = selectProvince.getProvinceCode();
String address = "http://guolin.tech/api/china/"+provinceCode;
queryFromServer(address,"city");
}
}
private void closeProgressDialog() {
if (progressDialog != null){
progressDialog.dismiss();
}
}
private void showProgressDialog() {
if (progressDialog == null){
progressDialog = new ProgressDialog(getActivity());
progressDialog.setMessage("...");
progressDialog.<API key>(false);
}
progressDialog.show();
}
} |
import javafx.geometry.Point2D;
/**
*
* @author Arun Kumar
*/
public class Pocketlesstable {
private Point2D point0;
private Point2D point1;
private Point2D point2;
private Point2D point3;
public Pocketlesstable(Point2D point0,Point2D point1,Point2D point2,Point2D point3)
{
this.point0 = point0;
this.point1 = point1;
this.point2 = point2;
this.point3 = point3;
}
/**
* @return the point0
*/
public Point2D getPoint0() {
return point0;
}
/**
* @param point0 the point0 to set
*/
public void setPoint0(Point2D point0) {
this.point0 = point0;
}
/**
* @return the point1
*/
public Point2D getPoint1() {
return point1;
}
/**
* @param point1 the point1 to set
*/
public void setPoint1(Point2D point1) {
this.point1 = point1;
}
/**
* @return the point2
*/
public Point2D getPoint2() {
return point2;
}
/**
* @param point2 the point2 to set
*/
public void setPoint2(Point2D point2) {
this.point2 = point2;
}
/**
* @return the point3
*/
public Point2D getPoint3() {
return point3;
}
/**
* @param point3 the point3 to set
*/
public void setPoint3(Point2D point3) {
this.point3 = point3;
}
} |
my class X::Immutable { ... }
my class X::Range::InvalidArg { ... }
my class Range is Cool does Iterable does Positional {
has $.min;
has $.max;
has int $!excludes-min;
has int $!excludes-max;
has int $!infinite;
has int $!is-int;
method !SET-SELF( $!min, $!max, \excludes-min, \excludes-max, \infinite) {
$!excludes-min = excludes-min
$!excludes-max = excludes-max
$!infinite = infinite;
$!is-int = nqp::istype($!min,Int) && nqp::istype($!max,Int);
self
}
multi method is-lazy(Range:D:) { self.infinite }
# The order of "method new" declarations matters here, to ensure
# appropriate candidate tiebreaking when mixed type arguments
# are present (e.g., Range,Whatever or Real,Range).
multi method new(Range $min, \max, :$excludes-min, :$excludes-max) {
X::Range::InvalidArg.new(:got($min)).throw;
}
multi method new(\min, Range $max, :$excludes-min, :$excludes-max) {
X::Range::InvalidArg.new(:got($max)).throw;
}
multi method new(Seq \min, \max, :$excludes-min, :$excludes-max) {
X::Range::InvalidArg.new(:got(Seq)).throw;
}
multi method new(\min , Seq \max, :$excludes-min, :$excludes-max) {
X::Range::InvalidArg.new(:got(Seq)).throw;
}
multi method new(Complex \min, \max, :$excludes-min, :$excludes-max) {
X::Range::InvalidArg.new(:got(min)).throw;
}
multi method new(\min , Complex \max, :$excludes-min, :$excludes-max) {
X::Range::InvalidArg.new(:got(max)).throw;
}
multi method new(Whatever \min,Whatever \max,:$excludes-min,:$excludes-max){
nqp::create(self)!SET-SELF(-Inf,Inf,$excludes-min,$excludes-max,1);
}
multi method new(Whatever \min, \max, :$excludes-min, :$excludes-max) {
nqp::create(self)!SET-SELF(-Inf,max,$excludes-min,$excludes-max,1);
}
multi method new(\min, Whatever \max, :$excludes-min, :$excludes-max) {
nqp::create(self)!SET-SELF(min,Inf,$excludes-min,$excludes-max,1);
}
multi method new(Real \min, Real() $max, :$excludes-min, :$excludes-max) {
nqp::create(self)!SET-SELF(
min,$max,$excludes-min,$excludes-max,$max == Inf || min == -Inf);
}
multi method new(List:D \min, \max, :$excludes-min, :$excludes-max) {
nqp::create(self)!SET-SELF(
+min,
nqp::istype(max,List) || nqp::istype(max,Match) ?? +max !! max,
$excludes-min, $excludes-max, 0);
}
multi method new(Match:D \min, \max, :$excludes-min, :$excludes-max) {
nqp::create(self)!SET-SELF(
+min,
nqp::istype(max,List) || nqp::istype(max,Match) ?? +max !! max,
$excludes-min, $excludes-max, 0);
}
multi method new(\min, \max, :$excludes-min, :$excludes-max!) {
nqp::create(self)!SET-SELF(min, max,$excludes-min,$excludes-max,0);
}
multi method new(\min, \max, :$excludes-min!, :$excludes-max) {
nqp::create(self)!SET-SELF(min,max,$excludes-min,$excludes-max,0);
}
multi method new(\min, \max) { nqp::create(self)!SET-SELF(min,max,0,0,0) }
method excludes-min() { nqp::p6bool($!excludes-min) }
method excludes-max() { nqp::p6bool($!excludes-max) }
method infinite() { nqp::p6bool($!infinite) }
method is-int() { nqp::p6bool($!is-int) }
multi method WHICH (Range:D:) {
self.^name
~ "|$!min"
~ ("^" if $!excludes-min)
~ '..'
~ ("^" if $!excludes-max)
~ $!max;
}
multi method EXISTS-POS(Range:D: int \pos) {
0 <= pos < self.elems;
}
multi method EXISTS-POS(Range:D: Int \pos) {
0 <= pos < self.elems;
}
method elems {
$!is-int
?? 0 max $!max - $!excludes-max - $!min - $!excludes-min + 1
!! $!infinite ?? Inf !! nextsame;
}
method iterator() {
# can use native ints
if $!is-int
&& !nqp::isbig_I(nqp::decont($!min))
&& !nqp::isbig_I(nqp::decont($!max)) {
Rakudo::Iterator.IntRange(
$!min + $!excludes-min, $!max - $!excludes-max)
}
# doesn't make much sense, but there you go
elsif $!min === -Inf {
class :: does Iterator {
method new() { nqp::create(self) }
method pull-one() { -Inf }
method is-lazy() { True }
}.new
}
# Also something quick and easy for 1..* style things
elsif nqp::istype($!min, Numeric) && $!max === Inf {
class :: does Iterator {
has $!i;
method !SET-SELF(\i) { $!i = i; self }
method new(\i) { nqp::create(self)!SET-SELF(i) }
method pull-one() { $!i++ }
method is-lazy() { True }
}.new($!min + $!excludes-min)
}
# if we have (simple) char range
elsif nqp::istype($!min,Str) {
$!min after $!max
?? ().iterator
!! $!min.chars == 1 && nqp::istype($!max,Str) && $!max.chars == 1
?? class :: does Iterator {
has int $!i;
has int $!n;
method !SET-SELF(\from,\end,\excludes-min,\excludes-max) {
$!i = nqp::ord(nqp::unbox_s(from))
- (excludes-min ?? 0 !! 1);
$!n = nqp::ord(nqp::unbox_s(end))
- (excludes-max ?? 1 !! 0);
self
}
method new(\from,\end,\excludes-min,\excludes-max) {
nqp::create(self)!SET-SELF(
from,end,excludes-min,excludes-max)
}
method pull-one() {
( $!i = $!i + 1 ) <= $!n
?? nqp::chr($!i)
!! IterationEnd
}
method push-all($target --> IterationEnd) {
my int $i = $!i;
my int $n = $!n;
$target.push(nqp::chr($i)) while ($i = $i + 1) <= $n;
$!i = $i;
}
method count-only() { nqp::p6box_i($!n - $!i) }
method bool-only() { nqp::p6bool(nqp::isgt_i($!n,$!i)) }
method sink-all(--> IterationEnd) { $!i = $!n }
}.new($!min, $!max, $!excludes-min, $!excludes-max)
!! SEQUENCE(
($!excludes-min ?? $!min.succ !! $!min),
$!max, :exclude_end($!excludes-max)
).iterator
}
# General case according to spec
else {
class :: does Iterator {
has $!i;
has $!e;
has int $!exclude;
method !SET-SELF(\i,\exclude,\e) {
$!i = i;
$!exclude = exclude.Int;
$!e = e;
self
}
method new(\i,\exclude,\e) {
nqp::create(self)!SET-SELF(i,exclude,e)
}
method pull-one() {
if $!exclude ?? $!i before $!e !! not $!i after $!e {
my Mu $i = $!i;
$!i = $i.succ;
$i
}
else {
IterationEnd
}
}
method push-all($target --> IterationEnd) {
my Mu $i = $!i;
my Mu $e = $!e;
if $!exclude {
while $i before $e {
$target.push(nqp::clone($i));
$i = $i.succ;
}
}
else {
while not $i after $e {
$target.push(nqp::clone($i));
$i = $i.succ;
}
}
$!i = $e.succ;
}
method sink-all(--> IterationEnd) { $!i = $!e.succ }
}.new($!excludes-min ?? $!min.succ !! $!min,$!excludes-max,$!max)
}
}
multi method list(Range:D:) { List.from-iterator(self.iterator) }
method flat(Range:D:) { Seq.new(self.iterator) }
method !reverse-iterator() {
# can use native ints
if $!is-int
&& !nqp::isbig_I(nqp::decont($!min))
&& !nqp::isbig_I(nqp::decont($!max)) {
class :: does Iterator {
has int $!i;
has int $!n;
method !SET-SELF(\i,\n) { $!i = i + 1; $!n = n; self }
method new(\i,\n) { nqp::create(self)!SET-SELF(i,n) }
method pull-one() {
( $!i = $!i - 1 ) >= $!n ?? $!i !! IterationEnd
}
method push-all($target --> IterationEnd) {
my int $i = $!i;
my int $n = $!n;
$target.push(nqp::p6box_i($i)) while ($i = $i - 1) >= $n;
$!i = $i;
}
method count-only() { nqp::p6box_i($!i - $!n) }
method bool-only() { nqp::p6bool(nqp::isgt_i($!i,$!n)) }
method sink-all(--> IterationEnd) { $!i = $!n }
}.new($!max - $!excludes-max, $!min + $!excludes-min)
}
# doesn't make much sense, but there you go
elsif $!max === -Inf {
class :: does Iterator {
method new() { nqp::create(self) }
method pull-one() { Inf }
method is-lazy() { True }
}.new
}
# Also something quick and easy for -Inf..42 style things
elsif nqp::istype($!min, Numeric) && $!min === -Inf {
class :: does Iterator {
has $!i;
method !SET-SELF(\i) { $!i = i; self }
method new(\i) { nqp::create(self)!SET-SELF(i) }
method pull-one() { $!i
method is-lazy() { True }
}.new($!max - $!excludes-max)
}
# if we have (simple) char range
elsif nqp::istype($!min,Str) {
my $max = $!excludes-max ?? $!max.pred !! $!max;
$max before $!min
?? ().iterator
!! $max.chars == 1 && nqp::istype($!min,Str) && $!min.chars == 1
?? class :: does Iterator {
has int $!i;
has int $!n;
method !SET-SELF(\from,\end) {
$!i = nqp::ord(nqp::unbox_s(from)) + 1;
$!n = nqp::ord(nqp::unbox_s(end));
self
}
method new(\from,\end) {
nqp::create(self)!SET-SELF(from,end)
}
method pull-one() {
( $!i = $!i - 1 ) >= $!n
?? nqp::chr($!i)
!! IterationEnd
}
method push-all($target --> IterationEnd) {
my int $i = $!i;
my int $n = $!n;
$target.push(nqp::chr($i)) while ($i = $i - 1) >= $n;
$!i = $i;
}
method count-only() { nqp::p6box_i($!i - $!n) }
method bool-only() { nqp::p6bool(nqp::isgt_i($!i,$!n)) }
method sink-all(--> IterationEnd) { $!i = $!n }
}.new($max, $!excludes-min ?? $!min.succ !! $!min)
!! SEQUENCE($max,$!min,:exclude_end($!excludes-min)).iterator
}
# General case according to spec
else {
class :: does Iterator {
has $!i;
has $!e;
has int $!exclude;
method !SET-SELF(\i,\exclude,\e) {
$!i = i;
$!exclude = exclude.Int;
$!e = e;
self
}
method new(\i,\exclude,\e) {
nqp::create(self)!SET-SELF(i,exclude,e)
}
method pull-one() {
if $!exclude ?? $!i after $!e !! not $!i before $!e {
my Mu $i = $!i;
$!i = $i.pred;
$i
}
else {
IterationEnd
}
}
method push-all($target --> IterationEnd) {
my Mu $i = $!i;
my Mu $e = $!e;
if $!exclude {
while $i after $e {
$target.push(nqp::clone($i));
$i = $i.pred;
}
}
else {
while not $i before $e {
$target.push(nqp::clone($i));
$i = $i.pred;
}
}
}
method sink-all(--> IterationEnd) { $!i = $!e }
}.new($!excludes-max ?? $!max.pred !! $!max,$!excludes-min,$!min)
}
}
method reverse(Range:D:) { Seq.new(self!reverse-iterator) }
method first (|c) {
if c<end> {
my \res := self.reverse.first(|c, :!end);
if c<k> and nqp::istype(res, Numeric) {
self.elems - res - 1
}
elsif c<p> and nqp::istype(res, Pair) {
Pair.new(self.elems - res.key - 1, res.value)
}
else {
res
}
}
else { nextsame };
}
method bounds() { (nqp::decont($!min), nqp::decont($!max)) }
proto method int-bounds(|) { * }
multi method int-bounds($from is rw, $to is rw) {
nqp::if(
$!is-int,
nqp::stmts(
($from = $!min + $!excludes-min),
($to = $!max - $!excludes-max)
),
nqp::if(
nqp::istype($!min,Real)
&& $!min.floor == $!min
&& nqp::istype($!max,Real),
nqp::stmts(
($from = $!min.floor + $!excludes-min),
($to = $!max.floor - ($!excludes-max && $!max.Int == $!max))
),
(die "Cannot determine integer bounds")
)
)
}
multi method int-bounds() {
$!is-int
?? ($!min + $!excludes-min, $!max - $!excludes-max)
!! nqp::istype($!min,Real) && $!min.floor == $!min && nqp::istype($!max,Real)
?? ($!min.floor + $!excludes-min, $!max.floor - ($!excludes-max && $!max.Int == $!max))
!! Failure.new("Cannot determine integer bounds")
}
method fmt(|c) {
self.list.fmt(|c)
}
multi method Str(Range:D:) {
$!min === -Inf && $!max === Inf
?? "*{'^' if $!excludes-min}..{'^' if $!excludes-max}*"
!! $!min === -Inf
?? "*{'^' if $!excludes-min}..{'^' if $!excludes-max}$!max"
!! $!max === Inf
?? "{$!min}{'^' if $!excludes-min}..{'^' if $!excludes-max}*"
!! self.list.Str
}
multi method ACCEPTS(Range:D: Mu \topic) {
(topic cmp $!min) > -(!$!excludes-min)
and (topic cmp $!max) < +(!$!excludes-max)
}
multi method ACCEPTS(Range:D: Cool:D \got) {
$!is-int && nqp::istype(got,Int)
?? got >= $!min + $!excludes-min && got <= $!max - $!excludes-max
!! ($!excludes-min ?? got after $!min !! not got before $!min)
&& ($!excludes-max ?? got before $!max !! not got after $!max)
}
multi method ACCEPTS(Range:D: Complex:D \got) {
nqp::istype(($_ := got.Real), Failure) ?? False !! nextwith $_
}
multi method ACCEPTS(Range:D: Range \topic) {
(topic.min > $!min
|| topic.min == $!min
&& !(!topic.excludes-min && $!excludes-min))
&&
(topic.max < $!max
|| topic.max == $!max
&& !(!topic.excludes-max && $!excludes-max))
}
multi method AT-POS(Range:D: int \pos) {
$!is-int
?? self.EXISTS-POS(pos)
?? $!min + $!excludes-min + pos
!! pos < 0
?? Failure.new(X::OutOfRange.new(
:what($*INDEX // 'Index'), :got(pos), :range<0..^Inf>
)) !! Nil
!! self.list.AT-POS(pos);
}
multi method AT-POS(Range:D: Int:D \pos) {
$!is-int
?? self.EXISTS-POS(pos)
?? $!min + $!excludes-min + pos
!! pos < 0
?? Failure.new(X::OutOfRange.new(
:what($*INDEX // 'Index'), :got(pos), :range<0..^Inf>
)) !! Nil
!! self.list.AT-POS(nqp::unbox_i(pos));
}
multi method perl(Range:D:) {
$!is-int && $!min == 0 && !$!excludes-min && $!excludes-max
?? "^$!max"
!! "{$!min.perl}{'^' if $!excludes-min}..{'^' if $!excludes-max}$!max.perl()"
}
proto method roll(|) { * }
multi method roll(Range:D: Whatever) {
if self.elems -> $elems {
$!is-int
?? Seq.new(class :: does Iterator {
has int $!min;
has Int $!elems;
method !SET-SELF(\min,\elems) {
$!min = min;
$!elems := nqp::decont(elems);
self
}
method new(\b,\e) { nqp::create(self)!SET-SELF(b,e) }
method pull-one() { $!min + nqp::rand_I($!elems, Int) }
method is-lazy() { True }
}.new($!min + $!excludes-min, $elems))
!! self.list.roll(*)
}
else {
Nil xx *
}
}
multi method roll(Range:D:) {
if $!is-int {
my $elems = $!max - $!excludes-max - $!min - $!excludes-min + 1;
$elems > 0
?? $!min + $!excludes-min + nqp::rand_I(nqp::decont($elems),Int)
!! Nil
}
else {
self.list.roll
}
}
multi method roll(Int(Cool) $todo) {
if self.elems -> $elems {
$!is-int
?? Seq.new(class :: does Iterator {
has int $!min;
has Int $!elems;
has int $!todo;
method !SET-SELF(\min,\elems,\todo) {
$!min = min;
$!elems := nqp::decont(elems);
$!todo = todo;
self
}
method new(\m,\e,\t) { nqp::create(self)!SET-SELF(m,e,t) }
method pull-one() {
$!todo
?? $!min + nqp::rand_I($!elems, Int)
!! IterationEnd
}
method push-all($target --> IterationEnd) {
$target.push($!min + nqp::rand_I($!elems, Int))
while $!todo
}
}.new($!min + $!excludes-min,$elems,0 max $todo))
!! self.list.roll($todo)
}
else {
Nil xx $todo
}
}
proto method pick(|) { * }
multi method pick() { self.roll };
multi method pick(Whatever) { self.list.pick(*) };
multi method pick(Int(Cool) $todo) {
if self.elems -> $elems {
$!is-int && $elems > 3 * $todo # heuristic for sparse lookup
?? Seq.new(class :: does Iterator {
has int $!min;
has Int $!elems;
has int $!todo;
has $!seen;
method !SET-SELF(\min,\elems,\todo) {
$!min = min;
$!elems := nqp::decont(elems);
$!todo = todo;
$!seen := nqp::hash();
self
}
method new(\m,\e,\t) { nqp::create(self)!SET-SELF(m,e,t) }
method pull-one() {
my Int $value;
my str $key;
if $!todo {
repeat {
$value = $!min + nqp::rand_I($!elems, Int);
$key = nqp::tostr_I(nqp::decont($value));
} while nqp::existskey($!seen,$key);
$!todo = $!todo - 1;
nqp::bindkey($!seen,$key,1);
$value
}
else {
IterationEnd
}
}
method push-all($target --> IterationEnd) {
my str $key;
while $!todo {
my Int $value = $!min + nqp::rand_I($!elems, Int);
$key = nqp::tostr_I(nqp::decont($value));
unless nqp::existskey($!seen,$key) {
$target.push($value);
$!todo = $!todo - 1;
nqp::bindkey($!seen,$key,1);
}
}
}
}.new($!min + $!excludes-min,$elems,0 max $todo))
!! self.list.pick($todo)
}
else {
Nil xx $todo
}
}
multi method Numeric(Range:D:) {
$!is-int
?? self.elems
!! nqp::istype($!min,Numeric) && nqp::istype($!max,Numeric)
?? do {
my $diff = 0 max $!max - $!min - $!excludes-min;
my $floor = $diff.floor;
$floor + 1 - ($floor == $diff ?? $!excludes-max !! 0)
}
!! self.flat.elems
}
method clone-with-op(&op, $value) {
my $min = $!min [&op] $value;
my $max = $!max [&op] $value;
my $is-int = nqp::istype($min,Int) && nqp::istype($max,Int);
my $clone := self.clone( :$min, :$max );
nqp::bindattr_i($clone, $clone.WHAT, '$!is-int', $is-int);
$clone;
}
method push(|) is nodal {
X::Immutable.new(:typename<Range>,:method<push>).throw
}
method append(|) is nodal {
X::Immutable.new(:typename<Range>,:method<append>).throw
}
method unshift(|) is nodal {
X::Immutable.new(:typename<Range>,:method<unshift>).throw
}
method prepend(|) is nodal {
X::Immutable.new(:typename<Range>,:method<prepend>).throw
}
method shift(|) is nodal {
X::Immutable.new(:typename<Range>,:method<shift>).throw
}
method pop(|) is nodal {
X::Immutable.new(:typename<Range>, :method<pop>).throw
}
method sum() is nodal {
my ($start,$stop) = self.int-bounds || nextsame;
my $elems = 0 max $stop - $start + 1;
($start + $stop) * $elems div 2;
}
method rand() {
fail "Can only get a random value on Real values, did you mean .pick?"
unless nqp::istype($!min,Real) && nqp::istype($!max,Real);
fail "Can only get a random value from numeric values"
if $!min === NaN || $!max === NaN;
fail "Can not get a random value from an infinite range"
if $!min === -Inf || $!max === Inf;
my $range = $!max - $!min;
fail "Can only get a random value if the range is positive"
unless $range > 0;
my $value = 0;
if $!excludes-min || $!excludes-max {
if $!excludes-min {
if $!excludes-max {
$value = $range.rand
while $value+$!min == $!min || $value+$!min == $!max;
}
else {
$value = $range.rand while $value+$!min == $!min;
}
}
else { # $!excludes-max
repeat {
$value = $range.rand
} while $value+$!min == $!max;
}
}
else {
$value = $range.rand
}
$value + $!min;
}
method in-range($got, $what?) {
self.ACCEPTS($got)
|| X::OutOfRange.new(:what($what // 'Value'),:got($got.perl),:range(self)).throw
}
multi method minmax(Range:D:) {
$!is-int
?? self.int-bounds
!! $!excludes-min || $!excludes-max
?? Failure.new("Cannot return minmax on Range with excluded ends")
!! ($!min,$!max)
}
}
sub infix:<..>($min, $max) is pure {
Range.new($min, $max)
}
sub infix:<^..>($min, $max) is pure {
Range.new($min, $max, :excludes-min)
}
sub infix:<..^>($min, $max) is pure {
Range.new($min, $max, :excludes-max)
}
sub infix:<^..^>($min, $max) is pure {
Range.new($min, $max, :excludes-min, :excludes-max)
}
sub prefix:<^>($max) is pure {
Range.new(0, $max.Numeric, :excludes-max)
}
multi sub infix:<eqv>(Range:D \a, Range:D \b) {
nqp::p6bool(
nqp::eqaddr(a,b)
|| (nqp::eqaddr(a.WHAT,b.WHAT)
&& a.min eqv b.min
&& a.max eqv b.max
&& nqp::iseq_i(
nqp::getattr_i(nqp::decont(a),Range,'$!excludes-min'),
nqp::getattr_i(nqp::decont(b),Range,'$!excludes-min')
)
&& nqp::iseq_i(
nqp::getattr_i(nqp::decont(a),Range,'$!excludes-max'),
nqp::getattr_i(nqp::decont(b),Range,'$!excludes-max')
))
)
}
multi sub infix:<+>(Range:D \a, Real:D \b) { a.clone-with-op(&[+], b) }
multi sub infix:<+>(Real:D \a, Range:D \b) { b.clone-with-op(&[+], a) }
multi sub infix:<->(Range:D \a, Real:D \b) { a.clone-with-op(&[-], b) }
multi sub infix:<*>(Range:D \a, Real:D \b) { a.clone-with-op(&[*], b) }
multi sub infix:<*>(Real:D \a, Range:D \b) { b.clone-with-op(&[*], a) }
multi sub infix:</>(Range:D \a, Real:D \b) { a.clone-with-op(&[/], b) }
multi sub infix:<cmp>(Range:D \a, Range:D \b) returns Order:D {
a.min cmp b.min || a.excludes-min cmp b.excludes-min || a.max cmp b.max || b.excludes-max cmp a.excludes-max
}
multi sub infix:<cmp>(Num(Real) \a, Range:D \b) returns Order:D { (a..a) cmp b }
multi sub infix:<cmp>(Range:D \a, Num(Real) \b) returns Order:D { a cmp (b..b) }
multi sub infix:<cmp>(Positional \a, Range:D \b) returns Order:D { a cmp b.list }
multi sub infix:<cmp>(Range:D \a, Positional \b) returns Order:D { a.list cmp b }
# vim: ft=perl6 expandtab sw=4 |
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
namespace Mazzaroth {
public class LevelButton : BaseMonoBehaviour {
public Text percentageField;
public string LevelName = "";
void Start() {
}
void Update() {
if (Application.<API key>(LevelName) == 1)
percentageField.enabled = false;
else {
percentageField.enabled = true;
percentageField.text = Mathf.Floor(Application.<API key>(1) * 100) + "%";
}
}
}
} |
package org.displaytag.jsptests;
import org.apache.commons.lang.StringUtils;
import org.displaytag.test.DisplaytagCase;
import com.meterware.httpunit.GetMethodWebRequest;
import com.meterware.httpunit.WebLink;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
import com.meterware.httpunit.WebTable;
public class Displ056Test extends DisplaytagCase
{
/**
* @see org.displaytag.test.DisplaytagCase#getJspName()
*/
public String getJspName()
{
return "DISPL-056.jsp";
}
/**
* Try to sort generated tables.
* @param jspName jsp name, with full path
* @throws Exception any axception thrown during test.
*/
public void doTest(String jspName) throws Exception
{
WebRequest request = new GetMethodWebRequest(jspName);
WebResponse response;
response = runner.getResponse(request);
if (log.isDebugEnabled())
{
log.debug(response.getText());
}
WebTable[] tables = response.getTables();
assertEquals("Wrong number of tables in result.", 3, tables.length);
for (int j = 0; j < tables.length; j++)
{
assertEquals("invalid id", "row" + j, tables[j].getID());
}
WebLink[] links = response.getLinks();
assertEquals("Wrong number of links in result.", 3, links.length);
// click to sort the first table
response = links[0].click();
// get the links
links = response.getLinks();
assertEquals("Wrong number of links in result.", 3, links.length);
// and click again to sort in reversed order
response = links[0].click();
if (log.isDebugEnabled())
{
log.debug(response.getText());
}
tables = response.getTables();
assertEquals("Wrong number of tables in result.", 3, tables.length);
// first is sorted, other aren't
assertTrue("First table should be sorted. Wrong class attribute.",
StringUtils.contains(tables[0].getTableCell(0, 0).getClassName(), "sorted"));
assertEquals("Second table should not be sorted. Wrong class attribute.",
"sortable",
tables[1].getTableCell(0, 0).getClassName());
assertEquals("Third table should not be sorted. Wrong class attribute.",
"sortable",
tables[2].getTableCell(0, 0).getClassName());
// and just to be sure also check values: sorted table
for (int j = 1; j < tables[0].getRowCount(); j++)
{
assertEquals("Unexpected value in table cell", Integer.toString(4 - j), tables[0].getCellAsText(j, 0));
}
// unsorted tables:
for (int j = 1; j < tables[1].getRowCount(); j++)
{
assertEquals("Unexpected value in table cell", Integer.toString(j), tables[1].getCellAsText(j, 0));
assertEquals("Unexpected value in table cell", Integer.toString(j), tables[2].getCellAsText(j, 0));
}
}
} |
<HTML>
<HEAD>
<TITLE>Radio Rotor Amsterdam BV - pdf</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<LINK REL="SHORTCUT ICON" HREF="favicon.ico">
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
<!
if (top.frames.length != 0) top.location.href=self.location.href;
</SCRIPT>
</HEAD>
<FRAMESET ROWS="60,*" BORDER="0" FRAMEBORDER="0" FRAMESPACING="0">
<FRAME SRC="pdfboven.html" NAME="pdfboven" FRAMEBORDER="0" FRAMESPACING="0" MARGINWIDTH ="3" MARGINHEIGHT="3" NORESIZE SCROLLING="no">
<FRAME SRC="pdf.php?pdf=http:
</FRAMESET>
</HTML> |
__author__ = 'dalewesa'
import flask
from flask import Flask
from flask import render_template
import json
from werkzeug.serving import run_simple
app = Flask(__name__)
@app.route("/")
def home():
return render_template('index.html')
@app.route("/new")
def sendembed():
embedHTML = {'embed': '<iframe width="100%" height="80%" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/users/12006695&color=ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false"></iframe>'}
return flask.jsonify(embedHTML)
if __name__ == "__main__":
#run_simple("homestylebeatz.com", 80, app)
app.run(debug=True) |
package Mojolicious::Routes::Route;
use Mojo::Base -base;
use Carp ();
use Mojo::Util;
use Mojolicious::Routes::Pattern;
use Scalar::Util ();
has [qw(inline parent partial)];
has 'children' => sub { [] };
has pattern => sub { Mojolicious::Routes::Pattern->new };
sub AUTOLOAD {
my $self = shift;
my ($package, $method) = our $AUTOLOAD =~ /^(.+)::(.+)$/;
Carp::croak "Undefined subroutine &${package}::$method called"
unless Scalar::Util::blessed $self && $self->isa(__PACKAGE__);
# Call shortcut with current route
Carp::croak qq{Can't locate object method "$method" via package "$package"}
unless my $shortcut = $self->root->shortcuts->{$method};
return $self->$shortcut(@_);
}
sub add_child {
my ($self, $route) = @_;
Scalar::Util::weaken $route->remove->parent($self)->{parent};
push @{$self->children}, $route;
return $self;
}
sub any { shift->_generate_route(ref $_[0] eq 'ARRAY' ? shift : [], @_) }
sub delete { shift->_generate_route(DELETE => @_) }
sub detour { shift->partial(1)->to(@_) }
sub find {
my ($self, $name) = @_;
my @children = (@{$self->children});
my $candidate;
while (my $child = shift @children) {
# Custom names have priority
$candidate = $child->has_custom_name ? return $child : $child
if $child->name eq $name;
push @children, @{$child->children};
}
return $candidate;
}
sub get { shift->_generate_route(GET => @_) }
sub has_custom_name { !!shift->{custom} }
sub has_websocket {
my $self = shift;
return $self->{has_websocket} if exists $self->{has_websocket};
return $self->{has_websocket} = grep { $_->is_websocket } @{$self->_chain};
}
sub is_endpoint { $_[0]->inline ? undef : !@{$_[0]->children} }
sub is_websocket { !!shift->{websocket} }
sub name {
my $self = shift;
return $self->{name} unless @_;
@$self{qw(name custom)} = (shift, 1);
return $self;
}
sub new { shift->SUPER::new->parse(@_) }
sub options { shift->_generate_route(OPTIONS => @_) }
sub over {
my $self = shift;
# Routes with conditions can't be cached
return $self->{over} unless @_;
my $conditions = ref $_[0] eq 'ARRAY' ? $_[0] : [@_];
return $self unless @$conditions;
$self->{over} = $conditions;
$self->root->cache->max_keys(0);
return $self;
}
sub parse {
my $self = shift;
$self->{name} = $self->pattern->parse(@_)->unparsed
$self->{name} =~ s/\W+
return $self;
}
sub patch { shift->_generate_route(PATCH => @_) }
sub post { shift->_generate_route(POST => @_) }
sub put { shift->_generate_route(PUT => @_) }
sub remove {
my $self = shift;
return $self unless my $parent = $self->parent;
@{$parent->children} = grep { $_ ne $self } @{$parent->children};
return $self->parent(undef);
}
sub render {
my ($self, $values) = @_;
my $path = join '',
map { $_->pattern->render($values, !@{$_->children} && !$_->partial) }
@{$self->_chain};
return $path || '/';
}
sub root { shift->_chain->[0] }
sub route {
my $self = shift;
my $route = $self->add_child(__PACKAGE__->new(@_))->children->[-1];
my $format = $self->pattern->constraints->{format};
$route->pattern->constraints->{format} //= 0 if defined $format && !$format;
return $route;
}
sub suggested_method {
my $self = shift;
my %via;
for my $route (@{$self->_chain}) {
next unless my @via = @{$route->via || []};
%via = map { $_ => 1 } keys %via ? grep { $via{$_} } @via : @via;
}
return 'POST' if $via{POST} && !$via{GET};
return $via{GET} ? 'GET' : (sort keys %via)[0] || 'GET';
}
sub to {
my $self = shift;
my $pattern = $self->pattern;
return $pattern->defaults unless @_;
my ($shortcut, %defaults) = Mojo::Util::_options(@_);
if ($shortcut) {
# Application
if (ref $shortcut || $shortcut =~ /^[\w:]+$/) {
$defaults{app} = $shortcut;
}
# Controller and action
elsif ($shortcut =~ /^([\w\-:]+)?\
$defaults{controller} = $1 if defined $1;
$defaults{action} = $2 if defined $2;
}
}
@{$pattern->defaults}{keys %defaults} = values %defaults;
return $self;
}
sub to_string {
join '', map { $_->pattern->unparsed // '' } @{shift->_chain};
}
sub under { shift->_generate_route(under => @_) }
sub via {
my $self = shift;
return $self->{via} unless @_;
my $methods = [map uc($_), @{ref $_[0] ? $_[0] : [@_]}];
$self->{via} = $methods if @$methods;
return $self;
}
sub websocket {
my $route = shift->get(@_);
$route->{websocket} = 1;
return $route;
}
sub _chain {
my @chain = (my $parent = shift);
unshift @chain, $parent while $parent = $parent->parent;
return \@chain;
}
sub _generate_route {
my ($self, $methods, @args) = @_;
my (@conditions, @constraints, %defaults, $name, $pattern);
while (defined(my $arg = shift @args)) {
# First scalar is the pattern
if (!ref $arg && !$pattern) { $pattern = $arg }
# Scalar
elsif (!ref $arg && @args) { push @conditions, $arg, shift @args }
# Last scalar is the route name
elsif (!ref $arg) { $name = $arg }
# Callback
elsif (ref $arg eq 'CODE') { $defaults{cb} = $arg }
# Constraints
elsif (ref $arg eq 'ARRAY') { push @constraints, @$arg }
# Defaults
elsif (ref $arg eq 'HASH') { %defaults = (%defaults, %$arg) }
}
my $route
= $self->route($pattern, @constraints)->over(\@conditions)->to(\%defaults);
$methods eq 'under' ? $route->inline(1) : $route->via($methods);
return defined $name ? $route->name($name) : $route;
}
1;
=encoding utf8
=head1 NAME
Mojolicious::Routes::Route - Route
=head1 SYNOPSIS
use Mojolicious::Routes::Route;
my $r = Mojolicious::Routes::Route->new;
=head1 DESCRIPTION
L<Mojolicious::Routes::Route> is the route container used by
L<Mojolicious::Routes>.
=head1 ATTRIBUTES
L<Mojolicious::Routes::Route> implements the following attributes.
=head2 children
my $children = $r->children;
$r = $r->children([Mojolicious::Routes::Route->new]);
The children of this route, used for nesting routes.
=head2 inline
my $bool = $r->inline;
$r = $r->inline($bool);
Allow L</"under"> semantics for this route.
=head2 parent
my $parent = $r->parent;
$r = $r->parent(Mojolicious::Routes::Route->new);
The parent of this route, usually a L<Mojolicious::Routes::Route> object.
=head2 partial
my $bool = $r->partial;
$r = $r->partial($bool);
Route has no specific end, remaining characters will be captured in C<path>.
=head2 pattern
my $pattern = $r->pattern;
$r = $r->pattern(Mojolicious::Routes::Pattern->new);
Pattern for this route, defaults to a L<Mojolicious::Routes::Pattern> object.
=head1 METHODS
L<Mojolicious::Routes::Route> inherits all methods from L<Mojo::Base> and
implements the following new ones.
=head2 add_child
$r = $r->add_child(Mojolicious::Routes::Route->new);
Add a child to this route, it will be automatically removed from its current
parent if necessary.
# Reattach route
$r->add_child($r->find('foo'));
=head2 any
my $route = $r->any('/:foo');
my $route = $r->any('/:foo' => sub {...});
my $route = $r->any('/:foo' => {foo => 'bar'} => sub {...});
my $route = $r->any('/:foo' => [foo => qr/\w+/] => sub {...});
my $route = $r->any([qw(GET POST)] => '/:foo' => sub {...});
my $route = $r->any([qw(GET POST)] => '/:foo' => [foo => qr/\w+/]);
Generate L<Mojolicious::Routes::Route> object matching any of the listed HTTP
request methods or all. See also L<Mojolicious::Guides::Tutorial> for many more
argument variations.
# Route with destination
$r->any('/user')->to('user#whatever');
=head2 delete
my $route = $r->delete('/:foo');
my $route = $r->delete('/:foo' => sub {...});
my $route = $r->delete('/:foo' => {foo => 'bar'} => sub {...});
my $route = $r->delete('/:foo' => [foo => qr/\w+/] => sub {...});
Generate L<Mojolicious::Routes::Route> object matching only C<DELETE> requests.
See also L<Mojolicious::Guides::Tutorial> for many more argument variations.
# Route with destination
$r->delete('/user')->to('user#remove');
=head2 detour
$r = $r->detour(action => 'foo');
$r = $r->detour('controller#action');
$r = $r->detour(Mojolicious->new, foo => 'bar');
$r = $r->detour('MyApp', {foo => 'bar'});
Set default parameters for this route and allow partial matching to simplify
application embedding, takes the same arguments as L</"to">.
=head2 find
my $route = $r->find('foo');
Find child route by name, custom names have precedence over automatically
generated ones.
# Change default parameters of a named route
$r->find('show_user')->to(foo => 'bar');
=head2 get
my $route = $r->get('/:foo');
my $route = $r->get('/:foo' => sub {...});
my $route = $r->get('/:foo' => {foo => 'bar'} => sub {...});
my $route = $r->get('/:foo' => [foo => qr/\w+/] => sub {...});
Generate L<Mojolicious::Routes::Route> object matching only C<GET> requests.
See also L<Mojolicious::Guides::Tutorial> for many more argument variations.
# Route with destination
$r->get('/user')->to('user#show');
=head2 has_custom_name
my $bool = $r->has_custom_name;
Check if this route has a custom name.
=head2 has_websocket
my $bool = $r->has_websocket;
Check if this route has a WebSocket ancestor and cache the result for future
checks.
=head2 is_endpoint
my $bool = $r->is_endpoint;
Check if this route qualifies as an endpoint.
=head2 is_websocket
my $bool = $r->is_websocket;
Check if this route is a WebSocket.
=head2 name
my $name = $r->name;
$r = $r->name('foo');
The name of this route, defaults to an automatically generated name based on
the route pattern. Note that the name C<current> is reserved for referring to
the current route.
# Route with destination and custom name
$r->get('/user')->to('user#show')->name('show_user');
=head2 new
my $r = Mojolicious::Routes::Route->new;
my $r = Mojolicious::Routes::Route->new('/:action');
my $r = Mojolicious::Routes::Route->new('/:action', action => qr/\w+/);
my $r = Mojolicious::Routes::Route->new(format => 0);
Construct a new L<Mojolicious::Routes::Route> object and L</"parse"> pattern if
necessary.
=head2 options
my $route = $r->options('/:foo');
my $route = $r->options('/:foo' => sub {...});
my $route = $r->options('/:foo' => {foo => 'bar'} => sub {...});
my $route = $r->options('/:foo' => [foo => qr/\w+/] => sub {...});
Generate L<Mojolicious::Routes::Route> object matching only C<OPTIONS>
requests. See also L<Mojolicious::Guides::Tutorial> for many more argument
variations.
# Route with destination
$r->options('/user')->to('user#overview');
=head2 over
my $over = $r->over;
$r = $r->over(foo => 1);
$r = $r->over(foo => 1, bar => {baz => 'yada'});
$r = $r->over([foo => 1, bar => {baz => 'yada'}]);
Activate conditions for this route. Note that this automatically disables the
routing cache, since conditions are too complex for caching.
# Route with condition and destination
$r->get('/foo')->over(host => qr/mojolicio\.us/)->to('foo#bar');
=head2 parse
$r = $r->parse('/:action');
$r = $r->parse('/:action', action => qr/\w+/);
$r = $r->parse(format => 0);
Parse pattern.
=head2 patch
my $route = $r->patch('/:foo');
my $route = $r->patch('/:foo' => sub {...});
my $route = $r->patch('/:foo' => {foo => 'bar'} => sub {...});
my $route = $r->patch('/:foo' => [foo => qr/\w+/] => sub {...});
Generate L<Mojolicious::Routes::Route> object matching only C<PATCH> requests.
See also L<Mojolicious::Guides::Tutorial> for many more argument variations.
# Route with destination
$r->patch('/user')->to('user#update');
=head2 post
my $route = $r->post('/:foo');
my $route = $r->post('/:foo' => sub {...});
my $route = $r->post('/:foo' => {foo => 'bar'} => sub {...});
my $route = $r->post('/:foo' => [foo => qr/\w+/] => sub {...});
Generate L<Mojolicious::Routes::Route> object matching only C<POST> requests.
See also L<Mojolicious::Guides::Tutorial> for many more argument variations.
# Route with destination
$r->post('/user')->to('user#create');
=head2 put
my $route = $r->put('/:foo');
my $route = $r->put('/:foo' => sub {...});
my $route = $r->put('/:foo' => {foo => 'bar'} => sub {...});
my $route = $r->put('/:foo' => [foo => qr/\w+/] => sub {...});
Generate L<Mojolicious::Routes::Route> object matching only C<PUT> requests.
See also L<Mojolicious::Guides::Tutorial> for many more argument variations.
# Route with destination
$r->put('/user')->to('user#replace');
=head2 remove
$r = $r->remove;
Remove route from parent.
# Remove route completely
$r->find('foo')->remove;
# Reattach route to new parent
$r->route('/foo')->add_child($r->find('bar')->remove);
=head2 render
my $path = $r->render({foo => 'bar'});
Render route with parameters into a path.
=head2 root
my $root = $r->root;
The L<Mojolicious::Routes> object this route is a descendant of.
=head2 route
my $route = $r->route;
my $route = $r->route('/:action');
my $route = $r->route('/:action', action => qr/\w+/);
my $route = $r->route(format => 0);
Low-level generator for routes matching all HTTP request methods, returns a
L<Mojolicious::Routes::Route> object.
=head2 suggested_method
my $method = $r->suggested_method;
Suggested HTTP method for reaching this route, C<GET> and C<POST> are
preferred.
=head2 to
my $defaults = $r->to;
$r = $r->to(action => 'foo');
$r = $r->to({action => 'foo'});
$r = $r->to('controller#action');
$r = $r->to('controller#action', foo => 'bar');
$r = $r->to('controller#action', {foo => 'bar'});
$r = $r->to(Mojolicious->new);
$r = $r->to(Mojolicious->new, foo => 'bar');
$r = $r->to(Mojolicious->new, {foo => 'bar'});
$r = $r->to('MyApp');
$r = $r->to('MyApp', foo => 'bar');
$r = $r->to('MyApp', {foo => 'bar'});
Set default parameters for this route.
=head2 to_string
my $str = $r->to_string;
Stringify the whole route.
=head2 under
my $route = $r->under(sub {...});
my $route = $r->under('/:foo' => sub {...});
my $route = $r->under('/:foo' => {foo => 'bar'});
my $route = $r->under('/:foo' => [foo => qr/\w+/]);
my $route = $r->under([format => 0]);
Generate L<Mojolicious::Routes::Route> object for a nested route with its own
intermediate destination. See also L<Mojolicious::Guides::Tutorial> for many
more argument variations.
# Intermediate destination and prefix shared between two routes
my $auth = $r->under('/user')->to('user#auth');
$auth->get('/show')->to('#show');
$auth->post('/create')->to('#create');
=head2 via
my $methods = $r->via;
$r = $r->via('GET');
$r = $r->via(qw(GET POST));
$r = $r->via([qw(GET POST)]);
Restrict HTTP methods this route is allowed to handle, defaults to no
restrictions.
# Route with two methods and destination
$r->route('/foo')->via(qw(GET POST))->to('foo#bar');
=head2 websocket
my $route = $r->websocket('/:foo');
my $route = $r->websocket('/:foo' => sub {...});
my $route = $r->websocket('/:foo' => {foo => 'bar'} => sub {...});
my $route = $r->websocket('/:foo' => [foo => qr/\w+/] => sub {...});
Generate L<Mojolicious::Routes::Route> object matching only WebSocket
handshakes. See also L<Mojolicious::Guides::Tutorial> for many more argument
variations.
# Route with destination
$r->websocket('/echo')->to('example#echo');
=head1 AUTOLOAD
In addition to the L</"ATTRIBUTES"> and L</"METHODS"> above you can also call
shortcuts provided by L</"root"> on L<Mojolicious::Routes::Route> objects.
# Add a "firefox" shortcut
$r->root->add_shortcut(firefox => sub {
my ($r, $path) = @_;
$r->get($path, agent => qr/Firefox/);
});
# Use "firefox" shortcut to generate routes
$r->firefox('/welcome')->to('firefox#welcome');
$r->firefox('/bye')->to('firefox#bye');
=head1 SEE ALSO
L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>.
=cut |
%% packages typical for exams that need to show source code listings.
%% It is good practice to not copy the program code into the latex
%% files, but instead to use \lstinputlisting commands to include the
%% source code. This avoids syntax clashes between latex and source code.
\usepackage{listings}
\usepackage{times}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{caption}
\usepackage{tikz}
\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
\definecolor{darkblue}{rgb}{0,0,.2}
\definecolor{darkgreen}{rgb}{0,0.2,0}
%% these listing settings define a nice box with a caption around each
%% listing.
\lstset{
aboveskip={1.5\baselineskip},
basicstyle=\footnotesize\ttfamily,
breaklines=true,
columns=fixed,
commentstyle=\color[rgb]{0,0.2,0},
extendedchars=true,
frame=t,
framexbottommargin=4pt,
framexleftmargin=17pt,
framexrightmargin=5pt,
identifierstyle=\ttfamily,
keywordstyle=\color{darkblue}\textbf,
language=java,
numbersep=5pt,
% numberstyle=\tiny,
prebreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
showspaces=false,
showstringspaces=false,
showstringspaces=false,
showtabs=false,
stringstyle={\color{darkgreen}\ttfamily\textbf},
tabsize=4,
upquote=true,
}
\DeclareCaptionFont{black}{\color{black}}
\<API key>{listing}{\colorbox[gray]{.9}{\parbox{\textwidth}{\hspace{15pt}#1#2#3}}}
\captionsetup[lstlisting]{format=listing,%
labelfont=black,%
textfont=black,%
singlelinecheck=false,%
margin=0pt,%
font={bf,footnotesize}}
%% end of file |
package Mojo::Util;
use Mojo::Base -strict;
use Carp qw(carp croak);
use Data::Dumper ();
use Digest::MD5 qw(md5 md5_hex);
use Digest::SHA qw(hmac_sha1_hex sha1 sha1_hex);
use Encode 'find_encoding';
use Exporter 'import';
use IO::Poll qw(POLLIN POLLPRI);
use List::Util 'min';
use MIME::Base64 qw(decode_base64 encode_base64);
use Symbol 'delete_package';
use Time::HiRes ();
# Check for monotonic clock support
use constant MONOTONIC =>
eval { !!Time::HiRes::clock_gettime(Time::HiRes::CLOCK_MONOTONIC()) };
# Punycode bootstring parameters
use constant {
PC_BASE => 36,
PC_TMIN => 1,
PC_TMAX => 26,
PC_SKEW => 38,
PC_DAMP => 700,
PC_INITIAL_BIAS => 72,
PC_INITIAL_N => 128
};
# To generate a new HTML entity table run this command
# perl examples/entities.pl
my %ENTITIES;
while (my $line = <DATA>) {
next unless $line =~ /^(\S+)\s+U\+(\S+)(?:\s+U\+(\S+))?/;
$ENTITIES{$1} = defined $3 ? (chr(hex $2) . chr(hex $3)) : chr(hex $2);
}
# Characters that should be escaped in XML
my %XML = (
'&' => '&',
'<' => '<',
'>' => '>',
'"' => '"',
'\'' => '&
);
# "Sun, 06 Nov 1994 08:49:37 GMT" and "Sunday, 06-Nov-94 08:49:37 GMT"
my $EXPIRES_RE = qr/(\w+\W+\d+\W+\w+\W+\d+\W+\d+:\d+:\d+\W*\w+)/;
# Encoding cache
my %CACHE;
our @EXPORT_OK = (
qw(b64_decode b64_encode camelize class_to_file class_to_path decamelize),
qw(decode deprecated dumper encode hmac_sha1_sum html_unescape md5_bytes),
qw(md5_sum monkey_patch punycode_decode punycode_encode quote),
qw(secure_compare sha1_bytes sha1_sum slurp split_cookie_header),
qw(split_header spurt squish steady_time tablify term_escape trim unindent),
qw(unquote url_escape url_unescape xml_escape xor_encode xss_escape)
);
sub b64_decode { decode_base64 $_[0] }
sub b64_encode { encode_base64 $_[0], $_[1] }
sub camelize {
my $str = shift;
return $str if $str =~ /^[A-Z]/;
# CamelCase words
return join '::', map {
join('', map { ucfirst lc } split '_')
} split '-', $str;
}
sub class_to_file {
my $class = shift;
$class =~ s/::|'
$class =~ s/([A-Z])([A-Z]*)/$1 . lc $2/ge;
return decamelize($class);
}
sub class_to_path { join '.', join('/', split(/::|'/, shift)), 'pm' }
sub decamelize {
my $str = shift;
return $str if $str !~ /^[A-Z]/;
# snake_case words
return join '-', map {
join('_', map {lc} grep {length} split /([A-Z]{1}[^A-Z]*)/)
} split '::', $str;
}
sub decode {
my ($encoding, $bytes) = @_;
return undef
unless eval { $bytes = _encoding($encoding)->decode("$bytes", 1); 1 };
return $bytes;
}
sub deprecated {
local $Carp::CarpLevel = 1;
$ENV{<API key>} ? croak @_ : carp @_;
}
sub dumper {
Data::Dumper->new([@_])->Indent(1)->Sortkeys(1)->Terse(1)->Useqq(1)->Dump;
}
sub encode { _encoding($_[0])->encode("$_[1]") }
sub hmac_sha1_sum { hmac_sha1_hex @_ }
sub html_unescape {
my $str = shift;
$str =~ s/&(?:\#((?:\d{1,7}|x[0-9a-fA-F]{1,6}));|(\w+;?))/_decode($1, $2)/ge;
return $str;
}
sub md5_bytes { md5 @_ }
sub md5_sum { md5_hex @_ }
# Declared in Mojo::Base to avoid circular require problems
sub monkey_patch { Mojo::Base::_monkey_patch(@_) }
# Direct translation of RFC 3492
sub punycode_decode {
my $input = shift;
use integer;
my $n = PC_INITIAL_N;
my $i = 0;
my $bias = PC_INITIAL_BIAS;
my @output;
# Consume all code points before the last delimiter
push @output, split('', $1) if $input =~ s/(.*)\x2d
while ($input ne '') {
my $oldi = $i;
my $w = 1;
# Base to infinity in steps of base
for (my $k = PC_BASE; 1; $k += PC_BASE) {
my $digit = ord substr $input, 0, 1, '';
$digit = $digit < 0x40 ? $digit + (26 - 0x30) : ($digit & 0x1f) - 1;
$i += $digit * $w;
my $t = $k - $bias;
$t = $t < PC_TMIN ? PC_TMIN : $t > PC_TMAX ? PC_TMAX : $t;
last if $digit < $t;
$w *= PC_BASE - $t;
}
$bias = _adapt($i - $oldi, @output + 1, $oldi == 0);
$n += $i / (@output + 1);
$i = $i % (@output + 1);
splice @output, $i++, 0, chr $n;
}
return join '', @output;
}
# Direct translation of RFC 3492
sub punycode_encode {
my $output = shift;
use integer;
my $n = PC_INITIAL_N;
my $delta = 0;
my $bias = PC_INITIAL_BIAS;
# Extract basic code points
my $len = length $output;
my @input = map {ord} split '', $output;
my @chars = sort grep { $_ >= PC_INITIAL_N } @input;
$output =~ s/[^\x00-\x7f]+
my $h = my $basic = length $output;
$output .= "\x2d" if $basic > 0;
for my $m (@chars) {
next if $m < $n;
$delta += ($m - $n) * ($h + 1);
$n = $m;
for (my $i = 0; $i < $len; $i++) {
my $c = $input[$i];
if ($c < $n) { $delta++ }
elsif ($c == $n) {
my $q = $delta;
# Base to infinity in steps of base
for (my $k = PC_BASE; 1; $k += PC_BASE) {
my $t = $k - $bias;
$t = $t < PC_TMIN ? PC_TMIN : $t > PC_TMAX ? PC_TMAX : $t;
last if $q < $t;
my $o = $t + (($q - $t) % (PC_BASE - $t));
$output .= chr $o + ($o < 26 ? 0x61 : 0x30 - 26);
$q = ($q - $t) / (PC_BASE - $t);
}
$output .= chr $q + ($q < 26 ? 0x61 : 0x30 - 26);
$bias = _adapt($delta, $h + 1, $h == $basic);
$delta = 0;
$h++;
}
}
$delta++;
$n++;
}
return $output;
}
sub quote {
my $str = shift;
$str =~ s/(["\\])/\\$1/g;
return qq{"$str"};
}
sub secure_compare {
my ($one, $two) = @_;
return undef if length $one != length $two;
my $r = 0;
$r |= ord(substr $one, $_) ^ ord(substr $two, $_) for 0 .. length($one) - 1;
return $r == 0;
}
sub sha1_bytes { sha1 @_ }
sub sha1_sum { sha1_hex @_ }
sub slurp {
my $path = shift;
open my $file, '<', $path or croak qq{Can't open file "$path": $!};
my $ret = my $content = '';
while ($ret = $file->sysread(my $buffer, 131072, 0)) { $content .= $buffer }
croak qq{Can't read from file "$path": $!} unless defined $ret;
return $content;
}
sub split_cookie_header { _header(shift, 1) }
sub split_header { _header(shift, 0) }
sub spurt {
my ($content, $path) = @_;
open my $file, '>', $path or croak qq{Can't open file "$path": $!};
defined $file->syswrite($content)
or croak qq{Can't write to file "$path": $!};
return $content;
}
sub squish {
my $str = trim(@_);
$str =~ s/\s+/ /g;
return $str;
}
sub steady_time () {
MONOTONIC
? Time::HiRes::clock_gettime(Time::HiRes::CLOCK_MONOTONIC())
: Time::HiRes::time;
}
sub tablify {
my $rows = shift;
my @spec;
for my $row (@$rows) {
for my $i (0 .. $#$row) {
($row->[$i] //= '') =~ s/[\r\n]//g;
my $len = length $row->[$i];
$spec[$i] = $len if $len >= ($spec[$i]
}
}
my $format = join ' ', map({"\%-${_}s"} @spec[0 .. $#spec - 1]), '%s';
return join '', map { sprintf "$format\n", @$_ } @$rows;
}
sub term_escape {
my $str = shift;
$str =~ s/([\x00-\x09\x0b-\x1f\x7f\x80-\x9f])/sprintf '\\x%02x', ord $1/ge;
return $str;
}
sub trim {
my $str = shift;
$str =~ s/^\s+
$str =~ s/\s+$
return $str;
}
sub unindent {
my $str = shift;
my $min = min map { m/^([ \t]*)/; length $1 || () } split "\n", $str;
$str =~ s/^[ \t]{0,$min}//gm if $min;
return $str;
}
sub unquote {
my $str = shift;
return $str unless $str =~ s/^"(.*)"$/$1/g;
$str =~ s/\\\\/\\/g;
$str =~ s/\\"/"/g;
return $str;
}
sub url_escape {
my ($str, $pattern) = @_;
if ($pattern) { $str =~ s/([$pattern])/sprintf '%%%02X', ord $1/ge }
else { $str =~ s/([^A-Za-z0-9\-._~])/sprintf '%%%02X', ord $1/ge }
return $str;
}
sub url_unescape {
my $str = shift;
$str =~ s/%([0-9a-fA-F]{2})/chr hex $1/ge;
return $str;
}
sub xml_escape {
my $str = shift;
$str =~ s/([&<>"'])/$XML{$1}/ge;
return $str;
}
sub xor_encode {
my ($input, $key) = @_;
# Encode with variable key length
my $len = length $key;
my $buffer = my $output = '';
$output .= $buffer ^ $key
while length($buffer = substr($input, 0, $len, '')) == $len;
return $output .= $buffer ^ substr($key, 0, length $buffer, '');
}
sub xss_escape {
no warnings 'uninitialized';
ref $_[0] eq 'Mojo::ByteStream' ? $_[0] : xml_escape("$_[0]");
}
sub _adapt {
my ($delta, $numpoints, $firsttime) = @_;
use integer;
$delta = $firsttime ? $delta / PC_DAMP : $delta / 2;
$delta += $delta / $numpoints;
my $k = 0;
while ($delta > ((PC_BASE - PC_TMIN) * PC_TMAX) / 2) {
$delta /= PC_BASE - PC_TMIN;
$k += PC_BASE;
}
return $k + (((PC_BASE - PC_TMIN + 1) * $delta) / ($delta + PC_SKEW));
}
sub _decode {
my ($point, $name) = @_;
# Code point
return chr($point !~ /^x/ ? $point : hex $point) unless defined $name;
# Find entity name
my $rest = '';
while ($name ne '') {
return "$ENTITIES{$name}$rest" if exists $ENTITIES{$name};
$rest = chop($name) . $rest;
}
return "&$rest";
}
sub _encoding {
$CACHE{$_[0]} //= find_encoding($_[0]) // croak "Unknown encoding '$_[0]'";
}
# Supported on Perl 5.14+
sub _global_destruction {
defined ${^GLOBAL_PHASE} && ${^GLOBAL_PHASE} eq 'DESTRUCT';
}
sub _header {
my ($str, $cookie) = @_;
my (@tree, @part);
while ($str =~ /\G[,;\s]*([^=;, ]+)\s*/gc) {
push @part, $1, undef;
my $expires = $cookie && @part > 2 && lc $1 eq 'expires';
# Special "expires" value
if ($expires && $str =~ /\G=\s*$EXPIRES_RE/gco) { $part[-1] = $1 }
# Quoted value
elsif ($str =~ /\G=\s*("(?:\\\\|\\"|[^"])*")/gc) { $part[-1] = unquote $1 }
# Unquoted value
elsif ($str =~ /\G=\s*([^;, ]*)/gc) { $part[-1] = $1 }
# Separator
next unless $str =~ /\G[;\s]*,\s*/gc;
push @tree, [@part];
@part = ();
}
# Take care of final part
return [@part ? (@tree, \@part) : @tree];
}
sub _options {
# Hash or name (one)
return ref $_[0] eq 'HASH' ? (undef, %{shift()}) : @_ if @_ == 1;
# Name and values (odd)
return shift, @_ if @_ % 2;
# Name and hash or just values (even)
return ref $_[1] eq 'HASH' ? (shift, %{shift()}) : (undef, @_);
}
# This may break in the future, but is worth it for performance
sub _readable { !!(IO::Poll::_poll(@_[0, 1], my $m = POLLIN | POLLPRI) > 0) }
sub _stash {
my ($name, $object) = (shift, shift);
# Hash
my $dict = $object->{$name} ||= {};
return $dict unless @_;
# Get
return $dict->{$_[0]} unless @_ > 1 || ref $_[0];
# Set
my $values = ref $_[0] ? $_[0] : {@_};
@$dict{keys %$values} = values %$values;
return $object;
}
sub _teardown {
return unless my $class = shift;
# @ISA has to be cleared first because of circular references
no strict 'refs';
@{"${class}::ISA"} = ();
delete_package $class;
}
1;
=encoding utf8
=head1 NAME
Mojo::Util - Portable utility functions
=head1 SYNOPSIS
use Mojo::Util qw(b64_encode url_escape url_unescape);
my $str = 'test=23';
my $escaped = url_escape $str;
say url_unescape $escaped;
say b64_encode $escaped, '';
=head1 DESCRIPTION
L<Mojo::Util> provides portable utility functions for L<Mojo>.
=head1 FUNCTIONS
L<Mojo::Util> implements the following functions, which can be imported
individually.
=head2 b64_decode
my $bytes = b64_decode $b64;
Base64 decode bytes.
=head2 b64_encode
my $b64 = b64_encode $bytes;
my $b64 = b64_encode $bytes, "\n";
Base64 encode bytes, the line ending defaults to a newline.
=head2 camelize
my $camelcase = camelize $snakecase;
Convert C<snake_case> string to C<CamelCase> and replace C<-> with C<::>.
# "FooBar"
camelize 'foo_bar';
# "FooBar::Baz"
camelize 'foo_bar-baz';
# "FooBar::Baz"
camelize 'FooBar::Baz';
=head2 class_to_file
my $file = class_to_file 'Foo::Bar';
Convert a class name to a file.
# "foo_bar"
class_to_file 'Foo::Bar';
# "foobar"
class_to_file 'FOO::Bar';
# "foo_bar"
class_to_file 'FooBar';
# "foobar"
class_to_file 'FOOBar';
=head2 class_to_path
my $path = class_to_path 'Foo::Bar';
Convert class name to path.
# "Foo/Bar.pm"
class_to_path 'Foo::Bar';
# "FooBar.pm"
class_to_path 'FooBar';
=head2 decamelize
my $snakecase = decamelize $camelcase;
Convert C<CamelCase> string to C<snake_case> and replace C<::> with C<->.
# "foo_bar"
decamelize 'FooBar';
# "foo_bar-baz"
decamelize 'FooBar::Baz';
# "foo_bar-baz"
decamelize 'foo_bar-baz';
=head2 decode
my $chars = decode 'UTF-8', $bytes;
Decode bytes to characters and return C<undef> if decoding failed.
=head2 deprecated
deprecated 'foo is DEPRECATED in favor of bar';
Warn about deprecated feature from perspective of caller. You can also set the
C<<API key>> environment variable to make them die instead.
=head2 dumper
my $perl = dumper {some => 'data'};
Dump a Perl data structure with L<Data::Dumper>.
=head2 encode
my $bytes = encode 'UTF-8', $chars;
Encode characters to bytes.
=head2 hmac_sha1_sum
my $checksum = hmac_sha1_sum $bytes, 'passw0rd';
Generate HMAC-SHA1 checksum for bytes.
# "<SHA1-like>"
hmac_sha1_sum 'foo', 'passw0rd';
=head2 html_unescape
my $str = html_unescape $escaped;
Unescape all HTML entities in string.
# "<div>"
html_unescape '<div>';
=head2 md5_bytes
my $checksum = md5_bytes $bytes;
Generate binary MD5 checksum for bytes.
=head2 md5_sum
my $checksum = md5_sum $bytes;
Generate MD5 checksum for bytes.
# "<API key>"
md5_sum 'foo';
=head2 monkey_patch
monkey_patch $package, foo => sub {...};
monkey_patch $package, foo => sub {...}, bar => sub {...};
Monkey patch functions into package.
monkey_patch 'MyApp',
one => sub { say 'One!' },
two => sub { say 'Two!' },
three => sub { say 'Three!' };
=head2 punycode_decode
my $str = punycode_decode $punycode;
Punycode decode string as described in
L<RFC 3492|http://tools.ietf.org/html/rfc3492>.
punycode_decode 'bcher-kva';
=head2 punycode_encode
my $punycode = punycode_encode $str;
Punycode encode string as described in
L<RFC 3492|http://tools.ietf.org/html/rfc3492>.
# "bcher-kva"
punycode_encode 'bücher';
=head2 quote
my $quoted = quote $str;
Quote string.
=head2 secure_compare
my $bool = secure_compare $str1, $str2;
Constant time comparison algorithm to prevent timing attacks.
=head2 sha1_bytes
my $checksum = sha1_bytes $bytes;
Generate binary SHA1 checksum for bytes.
=head2 sha1_sum
my $checksum = sha1_sum $bytes;
Generate SHA1 checksum for bytes.
# "<SHA1-like>"
sha1_sum 'foo';
=head2 slurp
my $bytes = slurp '/etc/passwd';
Read all data at once from file.
=head2 split_cookie_header
my $tree = split_cookie_header 'a=b; expires=Thu, 07 Aug 2008 07:07:59 GMT';
Same as L</"split_header">, but handles C<expires> values from
L<RFC 6265|http://tools.ietf.org/html/rfc6265>.
=head2 split_header
my $tree = split_header 'foo="bar baz"; test=123, yada';
Split HTTP header value into key/value pairs, each comma separated part gets
its own array reference, and keys without a value get C<undef> assigned.
# "one"
split_header('one; two="three four", five=six')->[0][0];
# "two"
split_header('one; two="three four", five=six')->[0][2];
# "three four"
split_header('one; two="three four", five=six')->[0][3];
# "five"
split_header('one; two="three four", five=six')->[1][0];
# "six"
split_header('one; two="three four", five=six')->[1][1];
=head2 spurt
$bytes = spurt $bytes, '/etc/passwd';
Write all data at once to file.
=head2 squish
my $squished = squish $str;
Trim whitespace characters from both ends of string and then change all
consecutive groups of whitespace into one space each.
# "foo bar"
squish ' foo bar ';
=head2 steady_time
my $time = steady_time;
High resolution time elapsed from an arbitrary fixed point in the past,
resilient to time jumps if a monotonic clock is available through
L<Time::HiRes>.
=head2 tablify
my $table = tablify [['foo', 'bar'], ['baz', 'yada']];
Row-oriented generator for text tables.
# "foo bar\nyada yada\nbaz yada\n"
tablify [['foo', 'bar'], ['yada', 'yada'], ['baz', 'yada']];
=head2 term_escape
my $escaped = term_escape $str;
Escape all POSIX control characters except for C<\n>.
# "foo\\x09bar\\x0d\n"
term_escape "foo\tbar\r\n";
=head2 trim
my $trimmed = trim $str;
Trim whitespace characters from both ends of string.
# "foo bar"
trim ' foo bar ';
=head2 unindent
my $unindented = unindent $str;
Unindent multiline string.
# "foo\nbar\nbaz\n"
unindent " foo\n bar\n baz\n";
=head2 unquote
my $str = unquote $quoted;
Unquote string.
=head2 url_escape
my $escaped = url_escape $str;
my $escaped = url_escape $str, '^A-Za-z0-9\-._~';
Percent encode unsafe characters in string as described in
L<RFC 3986|http://tools.ietf.org/html/rfc3986>, the pattern used defaults to
C<^A-Za-z0-9\-._~>.
# "foo%3Bbar"
url_escape 'foo;bar';
=head2 url_unescape
my $str = url_unescape $escaped;
Decode percent encoded characters in string as described in
L<RFC 3986|http://tools.ietf.org/html/rfc3986>.
# "foo;bar"
url_unescape 'foo%3Bbar';
=head2 xml_escape
my $escaped = xml_escape $str;
Escape unsafe characters C<&>, C<E<lt>>, C<E<gt>>, C<"> and C<'> in string.
# "<div>"
xml_escape '<div>';
=head2 xor_encode
my $encoded = xor_encode $str, $key;
XOR encode string with variable length key.
=head2 xss_escape
my $escaped = xss_escape $str;
Same as L</"xml_escape">, but does not escape L<Mojo::ByteStream> objects.
=head1 SEE ALSO
L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>.
=cut
__DATA__
Aacute; U+000C1
Aacute U+000C1
aacute; U+000E1
aacute U+000E1
Abreve; U+00102
abreve; U+00103
ac; U+0223E
acd; U+0223F
acE; U+0223E U+00333
Acirc; U+000C2
Acirc U+000C2
acirc; U+000E2
acirc U+000E2
acute; U+000B4
acute U+000B4
Acy; U+00410
acy; U+00430
AElig; U+000C6
AElig U+000C6
aelig; U+000E6
aelig U+000E6
af; U+02061
Afr; U+1D504
afr; U+1D51E
Agrave; U+000C0
Agrave U+000C0
agrave; U+000E0
agrave U+000E0
alefsym; U+02135
aleph; U+02135
Alpha; U+00391
alpha; U+003B1
Amacr; U+00100
amacr; U+00101
amalg; U+02A3F
AMP; U+00026
AMP U+00026
amp; U+00026
amp U+00026
And; U+02A53
and; U+02227
andand; U+02A55
andd; U+02A5C
andslope; U+02A58
andv; U+02A5A
ang; U+02220
ange; U+029A4
angle; U+02220
angmsd; U+02221
angmsdaa; U+029A8
angmsdab; U+029A9
angmsdac; U+029AA
angmsdad; U+029AB
angmsdae; U+029AC
angmsdaf; U+029AD
angmsdag; U+029AE
angmsdah; U+029AF
angrt; U+0221F
angrtvb; U+022BE
angrtvbd; U+0299D
angsph; U+02222
angst; U+000C5
angzarr; U+0237C
Aogon; U+00104
aogon; U+00105
Aopf; U+1D538
aopf; U+1D552
ap; U+02248
apacir; U+02A6F
apE; U+02A70
ape; U+0224A
apid; U+0224B
apos; U+00027
ApplyFunction; U+02061
approx; U+02248
approxeq; U+0224A
Aring; U+000C5
Aring U+000C5
aring; U+000E5
aring U+000E5
Ascr; U+1D49C
ascr; U+1D4B6
Assign; U+02254
ast; U+0002A
asymp; U+02248
asympeq; U+0224D
Atilde; U+000C3
Atilde U+000C3
atilde; U+000E3
atilde U+000E3
Auml; U+000C4
Auml U+000C4
auml; U+000E4
auml U+000E4
awconint; U+02233
awint; U+02A11
backcong; U+0224C
backepsilon; U+003F6
backprime; U+02035
backsim; U+0223D
backsimeq; U+022CD
Backslash; U+02216
Barv; U+02AE7
barvee; U+022BD
Barwed; U+02306
barwed; U+02305
barwedge; U+02305
bbrk; U+023B5
bbrktbrk; U+023B6
bcong; U+0224C
Bcy; U+00411
bcy; U+00431
bdquo; U+0201E
becaus; U+02235
Because; U+02235
because; U+02235
bemptyv; U+029B0
bepsi; U+003F6
bernou; U+0212C
Bernoullis; U+0212C
Beta; U+00392
beta; U+003B2
beth; U+02136
between; U+0226C
Bfr; U+1D505
bfr; U+1D51F
bigcap; U+022C2
bigcirc; U+025EF
bigcup; U+022C3
bigodot; U+02A00
bigoplus; U+02A01
bigotimes; U+02A02
bigsqcup; U+02A06
bigstar; U+02605
bigtriangledown; U+025BD
bigtriangleup; U+025B3
biguplus; U+02A04
bigvee; U+022C1
bigwedge; U+022C0
bkarow; U+0290D
blacklozenge; U+029EB
blacksquare; U+025AA
blacktriangle; U+025B4
blacktriangledown; U+025BE
blacktriangleleft; U+025C2
blacktriangleright; U+025B8
blank; U+02423
blk12; U+02592
blk14; U+02591
blk34; U+02593
block; U+02588
bne; U+0003D U+020E5
bnequiv; U+02261 U+020E5
bNot; U+02AED
bnot; U+02310
Bopf; U+1D539
bopf; U+1D553
bot; U+022A5
bottom; U+022A5
bowtie; U+022C8
boxbox; U+029C9
boxDL; U+02557
boxDl; U+02556
boxdL; U+02555
boxdl; U+02510
boxDR; U+02554
boxDr; U+02553
boxdR; U+02552
boxdr; U+0250C
boxH; U+02550
boxh; U+02500
boxHD; U+02566
boxHd; U+02564
boxhD; U+02565
boxhd; U+0252C
boxHU; U+02569
boxHu; U+02567
boxhU; U+02568
boxhu; U+02534
boxminus; U+0229F
boxplus; U+0229E
boxtimes; U+022A0
boxUL; U+0255D
boxUl; U+0255C
boxuL; U+0255B
boxul; U+02518
boxUR; U+0255A
boxUr; U+02559
boxuR; U+02558
boxur; U+02514
boxV; U+02551
boxv; U+02502
boxVH; U+0256C
boxVh; U+0256B
boxvH; U+0256A
boxvh; U+0253C
boxVL; U+02563
boxVl; U+02562
boxvL; U+02561
boxvl; U+02524
boxVR; U+02560
boxVr; U+0255F
boxvR; U+0255E
boxvr; U+0251C
bprime; U+02035
Breve; U+002D8
breve; U+002D8
brvbar; U+000A6
brvbar U+000A6
Bscr; U+0212C
bscr; U+1D4B7
bsemi; U+0204F
bsim; U+0223D
bsime; U+022CD
bsol; U+0005C
bsolb; U+029C5
bsolhsub; U+027C8
bull; U+02022
bullet; U+02022
bump; U+0224E
bumpE; U+02AAE
bumpe; U+0224F
Bumpeq; U+0224E
bumpeq; U+0224F
Cacute; U+00106
cacute; U+00107
Cap; U+022D2
cap; U+02229
capand; U+02A44
capbrcup; U+02A49
capcap; U+02A4B
capcup; U+02A47
capdot; U+02A40
<API key>; U+02145
caps; U+02229 U+0FE00
caret; U+02041
caron; U+002C7
Cayleys; U+0212D
ccaps; U+02A4D
Ccaron; U+0010C
ccaron; U+0010D
Ccedil; U+000C7
Ccedil U+000C7
ccedil; U+000E7
ccedil U+000E7
Ccirc; U+00108
ccirc; U+00109
Cconint; U+02230
ccups; U+02A4C
ccupssm; U+02A50
Cdot; U+0010A
cdot; U+0010B
cedil; U+000B8
cedil U+000B8
Cedilla; U+000B8
cemptyv; U+029B2
cent; U+000A2
cent U+000A2
CenterDot; U+000B7
centerdot; U+000B7
Cfr; U+0212D
cfr; U+1D520
CHcy; U+00427
chcy; U+00447
check; U+02713
checkmark; U+02713
Chi; U+003A7
chi; U+003C7
cir; U+025CB
circ; U+002C6
circeq; U+02257
circlearrowleft; U+021BA
circlearrowright; U+021BB
circledast; U+0229B
circledcirc; U+0229A
circleddash; U+0229D
CircleDot; U+02299
circledR; U+000AE
circledS; U+024C8
CircleMinus; U+02296
CirclePlus; U+02295
CircleTimes; U+02297
cirE; U+029C3
cire; U+02257
cirfnint; U+02A10
cirmid; U+02AEF
cirscir; U+029C2
<API key>; U+02232
<API key>; U+0201D
CloseCurlyQuote; U+02019
clubs; U+02663
clubsuit; U+02663
Colon; U+02237
colon; U+0003A
Colone; U+02A74
colone; U+02254
coloneq; U+02254
comma; U+0002C
commat; U+00040
comp; U+02201
compfn; U+02218
complement; U+02201
complexes; U+02102
cong; U+02245
congdot; U+02A6D
Congruent; U+02261
Conint; U+0222F
conint; U+0222E
ContourIntegral; U+0222E
Copf; U+02102
copf; U+1D554
coprod; U+02210
Coproduct; U+02210
COPY; U+000A9
COPY U+000A9
copy; U+000A9
copy U+000A9
copysr; U+02117
<API key>; U+02233
crarr; U+021B5
Cross; U+02A2F
cross; U+02717
Cscr; U+1D49E
cscr; U+1D4B8
csub; U+02ACF
csube; U+02AD1
csup; U+02AD0
csupe; U+02AD2
ctdot; U+022EF
cudarrl; U+02938
cudarrr; U+02935
cuepr; U+022DE
cuesc; U+022DF
cularr; U+021B6
cularrp; U+0293D
Cup; U+022D3
cup; U+0222A
cupbrcap; U+02A48
CupCap; U+0224D
cupcap; U+02A46
cupcup; U+02A4A
cupdot; U+0228D
cupor; U+02A45
cups; U+0222A U+0FE00
curarr; U+021B7
curarrm; U+0293C
curlyeqprec; U+022DE
curlyeqsucc; U+022DF
curlyvee; U+022CE
curlywedge; U+022CF
curren; U+000A4
curren U+000A4
curvearrowleft; U+021B6
curvearrowright; U+021B7
cuvee; U+022CE
cuwed; U+022CF
cwconint; U+02232
cwint; U+02231
cylcty; U+0232D
Dagger; U+02021
dagger; U+02020
daleth; U+02138
Darr; U+021A1
dArr; U+021D3
darr; U+02193
dash; U+02010
Dashv; U+02AE4
dashv; U+022A3
dbkarow; U+0290F
dblac; U+002DD
Dcaron; U+0010E
dcaron; U+0010F
Dcy; U+00414
dcy; U+00434
DD; U+02145
dd; U+02146
ddagger; U+02021
ddarr; U+021CA
DDotrahd; U+02911
ddotseq; U+02A77
deg; U+000B0
deg U+000B0
Del; U+02207
Delta; U+00394
delta; U+003B4
demptyv; U+029B1
dfisht; U+0297F
Dfr; U+1D507
dfr; U+1D521
dHar; U+02965
dharl; U+021C3
dharr; U+021C2
DiacriticalAcute; U+000B4
DiacriticalDot; U+002D9
<API key>; U+002DD
DiacriticalGrave; U+00060
DiacriticalTilde; U+002DC
diam; U+022C4
Diamond; U+022C4
diamond; U+022C4
diamondsuit; U+02666
diams; U+02666
die; U+000A8
DifferentialD; U+02146
digamma; U+003DD
disin; U+022F2
div; U+000F7
divide; U+000F7
divide U+000F7
divideontimes; U+022C7
divonx; U+022C7
DJcy; U+00402
djcy; U+00452
dlcorn; U+0231E
dlcrop; U+0230D
dollar; U+00024
Dopf; U+1D53B
dopf; U+1D555
Dot; U+000A8
dot; U+002D9
DotDot; U+020DC
doteq; U+02250
doteqdot; U+02251
DotEqual; U+02250
dotminus; U+02238
dotplus; U+02214
dotsquare; U+022A1
doublebarwedge; U+02306
<API key>; U+0222F
DoubleDot; U+000A8
DoubleDownArrow; U+021D3
DoubleLeftArrow; U+021D0
<API key>; U+021D4
DoubleLeftTee; U+02AE4
DoubleLongLeftArrow; U+027F8
<API key>; U+027FA
<API key>; U+027F9
DoubleRightArrow; U+021D2
DoubleRightTee; U+022A8
DoubleUpArrow; U+021D1
DoubleUpDownArrow; U+021D5
DoubleVerticalBar; U+02225
DownArrow; U+02193
Downarrow; U+021D3
downarrow; U+02193
DownArrowBar; U+02913
DownArrowUpArrow; U+021F5
DownBreve; U+00311
downdownarrows; U+021CA
downharpoonleft; U+021C3
downharpoonright; U+021C2
DownLeftRightVector; U+02950
DownLeftTeeVector; U+0295E
DownLeftVector; U+021BD
DownLeftVectorBar; U+02956
DownRightTeeVector; U+0295F
DownRightVector; U+021C1
DownRightVectorBar; U+02957
DownTee; U+022A4
DownTeeArrow; U+021A7
drbkarow; U+02910
drcorn; U+0231F
drcrop; U+0230C
Dscr; U+1D49F
dscr; U+1D4B9
DScy; U+00405
dscy; U+00455
dsol; U+029F6
Dstrok; U+00110
dstrok; U+00111
dtdot; U+022F1
dtri; U+025BF
dtrif; U+025BE
duarr; U+021F5
duhar; U+0296F
dwangle; U+029A6
DZcy; U+0040F
dzcy; U+0045F
dzigrarr; U+027FF
Eacute; U+000C9
Eacute U+000C9
eacute; U+000E9
eacute U+000E9
easter; U+02A6E
Ecaron; U+0011A
ecaron; U+0011B
ecir; U+02256
Ecirc; U+000CA
Ecirc U+000CA
ecirc; U+000EA
ecirc U+000EA
ecolon; U+02255
Ecy; U+0042D
ecy; U+0044D
eDDot; U+02A77
Edot; U+00116
eDot; U+02251
edot; U+00117
ee; U+02147
efDot; U+02252
Efr; U+1D508
efr; U+1D522
eg; U+02A9A
Egrave; U+000C8
Egrave U+000C8
egrave; U+000E8
egrave U+000E8
egs; U+02A96
egsdot; U+02A98
el; U+02A99
Element; U+02208
elinters; U+023E7
ell; U+02113
els; U+02A95
elsdot; U+02A97
Emacr; U+00112
emacr; U+00113
empty; U+02205
emptyset; U+02205
EmptySmallSquare; U+025FB
emptyv; U+02205
<API key>; U+025AB
emsp; U+02003
emsp13; U+02004
emsp14; U+02005
ENG; U+0014A
eng; U+0014B
ensp; U+02002
Eogon; U+00118
eogon; U+00119
Eopf; U+1D53C
eopf; U+1D556
epar; U+022D5
eparsl; U+029E3
eplus; U+02A71
epsi; U+003B5
Epsilon; U+00395
epsilon; U+003B5
epsiv; U+003F5
eqcirc; U+02256
eqcolon; U+02255
eqsim; U+02242
eqslantgtr; U+02A96
eqslantless; U+02A95
Equal; U+02A75
equals; U+0003D
EqualTilde; U+02242
equest; U+0225F
Equilibrium; U+021CC
equiv; U+02261
equivDD; U+02A78
eqvparsl; U+029E5
erarr; U+02971
erDot; U+02253
Escr; U+02130
escr; U+0212F
esdot; U+02250
Esim; U+02A73
esim; U+02242
Eta; U+00397
eta; U+003B7
ETH; U+000D0
ETH U+000D0
eth; U+000F0
eth U+000F0
Euml; U+000CB
Euml U+000CB
euml; U+000EB
euml U+000EB
euro; U+020AC
excl; U+00021
exist; U+02203
Exists; U+02203
expectation; U+02130
ExponentialE; U+02147
exponentiale; U+02147
fallingdotseq; U+02252
Fcy; U+00424
fcy; U+00444
female; U+02640
ffilig; U+0FB03
fflig; U+0FB00
ffllig; U+0FB04
Ffr; U+1D509
ffr; U+1D523
filig; U+0FB01
FilledSmallSquare; U+025FC
<API key>; U+025AA
fjlig; U+00066 U+0006A
flat; U+0266D
fllig; U+0FB02
fltns; U+025B1
fnof; U+00192
Fopf; U+1D53D
fopf; U+1D557
ForAll; U+02200
forall; U+02200
fork; U+022D4
forkv; U+02AD9
Fouriertrf; U+02131
fpartint; U+02A0D
frac12; U+000BD
frac12 U+000BD
frac13; U+02153
frac14; U+000BC
frac14 U+000BC
frac15; U+02155
frac16; U+02159
frac18; U+0215B
frac23; U+02154
frac25; U+02156
frac34; U+000BE
frac34 U+000BE
frac35; U+02157
frac38; U+0215C
frac45; U+02158
frac56; U+0215A
frac58; U+0215D
frac78; U+0215E
frasl; U+02044
frown; U+02322
Fscr; U+02131
fscr; U+1D4BB
gacute; U+001F5
Gamma; U+00393
gamma; U+003B3
Gammad; U+003DC
gammad; U+003DD
gap; U+02A86
Gbreve; U+0011E
gbreve; U+0011F
Gcedil; U+00122
Gcirc; U+0011C
gcirc; U+0011D
Gcy; U+00413
gcy; U+00433
Gdot; U+00120
gdot; U+00121
gE; U+02267
ge; U+02265
gEl; U+02A8C
gel; U+022DB
geq; U+02265
geqq; U+02267
geqslant; U+02A7E
ges; U+02A7E
gescc; U+02AA9
gesdot; U+02A80
gesdoto; U+02A82
gesdotol; U+02A84
gesl; U+022DB U+0FE00
gesles; U+02A94
Gfr; U+1D50A
gfr; U+1D524
Gg; U+022D9
gg; U+0226B
ggg; U+022D9
gimel; U+02137
GJcy; U+00403
gjcy; U+00453
gl; U+02277
gla; U+02AA5
glE; U+02A92
glj; U+02AA4
gnap; U+02A8A
gnapprox; U+02A8A
gnE; U+02269
gne; U+02A88
gneq; U+02A88
gneqq; U+02269
gnsim; U+022E7
Gopf; U+1D53E
gopf; U+1D558
grave; U+00060
GreaterEqual; U+02265
GreaterEqualLess; U+022DB
GreaterFullEqual; U+02267
GreaterGreater; U+02AA2
GreaterLess; U+02277
GreaterSlantEqual; U+02A7E
GreaterTilde; U+02273
Gscr; U+1D4A2
gscr; U+0210A
gsim; U+02273
gsime; U+02A8E
gsiml; U+02A90
GT; U+0003E
GT U+0003E
Gt; U+0226B
gt; U+0003E
gt U+0003E
gtcc; U+02AA7
gtcir; U+02A7A
gtdot; U+022D7
gtlPar; U+02995
gtquest; U+02A7C
gtrapprox; U+02A86
gtrarr; U+02978
gtrdot; U+022D7
gtreqless; U+022DB
gtreqqless; U+02A8C
gtrless; U+02277
gtrsim; U+02273
gvertneqq; U+02269 U+0FE00
gvnE; U+02269 U+0FE00
Hacek; U+002C7
hairsp; U+0200A
half; U+000BD
hamilt; U+0210B
HARDcy; U+0042A
hardcy; U+0044A
hArr; U+021D4
harr; U+02194
harrcir; U+02948
harrw; U+021AD
Hat; U+0005E
hbar; U+0210F
Hcirc; U+00124
hcirc; U+00125
hearts; U+02665
heartsuit; U+02665
hellip; U+02026
hercon; U+022B9
Hfr; U+0210C
hfr; U+1D525
HilbertSpace; U+0210B
hksearow; U+02925
hkswarow; U+02926
hoarr; U+021FF
homtht; U+0223B
hookleftarrow; U+021A9
hookrightarrow; U+021AA
Hopf; U+0210D
hopf; U+1D559
horbar; U+02015
HorizontalLine; U+02500
Hscr; U+0210B
hscr; U+1D4BD
hslash; U+0210F
Hstrok; U+00126
hstrok; U+00127
HumpDownHump; U+0224E
HumpEqual; U+0224F
hybull; U+02043
hyphen; U+02010
Iacute; U+000CD
Iacute U+000CD
iacute; U+000ED
iacute U+000ED
ic; U+02063
Icirc; U+000CE
Icirc U+000CE
icirc; U+000EE
icirc U+000EE
Icy; U+00418
icy; U+00438
Idot; U+00130
IEcy; U+00415
iecy; U+00435
iexcl; U+000A1
iexcl U+000A1
iff; U+021D4
Ifr; U+02111
ifr; U+1D526
Igrave; U+000CC
Igrave U+000CC
igrave; U+000EC
igrave U+000EC
ii; U+02148
iiiint; U+02A0C
iiint; U+0222D
iinfin; U+029DC
iiota; U+02129
IJlig; U+00132
ijlig; U+00133
Im; U+02111
Imacr; U+0012A
imacr; U+0012B
image; U+02111
ImaginaryI; U+02148
imagline; U+02110
imagpart; U+02111
imath; U+00131
imof; U+022B7
imped; U+001B5
Implies; U+021D2
in; U+02208
incare; U+02105
infin; U+0221E
infintie; U+029DD
inodot; U+00131
Int; U+0222C
int; U+0222B
intcal; U+022BA
integers; U+02124
Integral; U+0222B
intercal; U+022BA
Intersection; U+022C2
intlarhk; U+02A17
intprod; U+02A3C
InvisibleComma; U+02063
InvisibleTimes; U+02062
IOcy; U+00401
iocy; U+00451
Iogon; U+0012E
iogon; U+0012F
Iopf; U+1D540
iopf; U+1D55A
Iota; U+00399
iota; U+003B9
iprod; U+02A3C
iquest; U+000BF
iquest U+000BF
Iscr; U+02110
iscr; U+1D4BE
isin; U+02208
isindot; U+022F5
isinE; U+022F9
isins; U+022F4
isinsv; U+022F3
isinv; U+02208
it; U+02062
Itilde; U+00128
itilde; U+00129
Iukcy; U+00406
iukcy; U+00456
Iuml; U+000CF
Iuml U+000CF
iuml; U+000EF
iuml U+000EF
Jcirc; U+00134
jcirc; U+00135
Jcy; U+00419
jcy; U+00439
Jfr; U+1D50D
jfr; U+1D527
jmath; U+00237
Jopf; U+1D541
jopf; U+1D55B
Jscr; U+1D4A5
jscr; U+1D4BF
Jsercy; U+00408
jsercy; U+00458
Jukcy; U+00404
jukcy; U+00454
Kappa; U+0039A
kappa; U+003BA
kappav; U+003F0
Kcedil; U+00136
kcedil; U+00137
Kcy; U+0041A
kcy; U+0043A
Kfr; U+1D50E
kfr; U+1D528
kgreen; U+00138
KHcy; U+00425
khcy; U+00445
KJcy; U+0040C
kjcy; U+0045C
Kopf; U+1D542
kopf; U+1D55C
Kscr; U+1D4A6
kscr; U+1D4C0
lAarr; U+021DA
Lacute; U+00139
lacute; U+0013A
laemptyv; U+029B4
lagran; U+02112
Lambda; U+0039B
lambda; U+003BB
Lang; U+027EA
lang; U+027E8
langd; U+02991
langle; U+027E8
lap; U+02A85
Laplacetrf; U+02112
laquo; U+000AB
laquo U+000AB
Larr; U+0219E
lArr; U+021D0
larr; U+02190
larrb; U+021E4
larrbfs; U+0291F
larrfs; U+0291D
larrhk; U+021A9
larrlp; U+021AB
larrpl; U+02939
larrsim; U+02973
larrtl; U+021A2
lat; U+02AAB
lAtail; U+0291B
latail; U+02919
late; U+02AAD
lates; U+02AAD U+0FE00
lBarr; U+0290E
lbarr; U+0290C
lbbrk; U+02772
lbrace; U+0007B
lbrack; U+0005B
lbrke; U+0298B
lbrksld; U+0298F
lbrkslu; U+0298D
Lcaron; U+0013D
lcaron; U+0013E
Lcedil; U+0013B
lcedil; U+0013C
lceil; U+02308
lcub; U+0007B
Lcy; U+0041B
lcy; U+0043B
ldca; U+02936
ldquo; U+0201C
ldquor; U+0201E
ldrdhar; U+02967
ldrushar; U+0294B
ldsh; U+021B2
lE; U+02266
le; U+02264
LeftAngleBracket; U+027E8
LeftArrow; U+02190
Leftarrow; U+021D0
leftarrow; U+02190
LeftArrowBar; U+021E4
LeftArrowRightArrow; U+021C6
leftarrowtail; U+021A2
LeftCeiling; U+02308
LeftDoubleBracket; U+027E6
LeftDownTeeVector; U+02961
LeftDownVector; U+021C3
LeftDownVectorBar; U+02959
LeftFloor; U+0230A
leftharpoondown; U+021BD
leftharpoonup; U+021BC
leftleftarrows; U+021C7
LeftRightArrow; U+02194
Leftrightarrow; U+021D4
leftrightarrow; U+02194
leftrightarrows; U+021C6
leftrightharpoons; U+021CB
leftrightsquigarrow; U+021AD
LeftRightVector; U+0294E
LeftTee; U+022A3
LeftTeeArrow; U+021A4
LeftTeeVector; U+0295A
leftthreetimes; U+022CB
LeftTriangle; U+022B2
LeftTriangleBar; U+029CF
LeftTriangleEqual; U+022B4
LeftUpDownVector; U+02951
LeftUpTeeVector; U+02960
LeftUpVector; U+021BF
LeftUpVectorBar; U+02958
LeftVector; U+021BC
LeftVectorBar; U+02952
lEg; U+02A8B
leg; U+022DA
leq; U+02264
leqq; U+02266
leqslant; U+02A7D
les; U+02A7D
lescc; U+02AA8
lesdot; U+02A7F
lesdoto; U+02A81
lesdotor; U+02A83
lesg; U+022DA U+0FE00
lesges; U+02A93
lessapprox; U+02A85
lessdot; U+022D6
lesseqgtr; U+022DA
lesseqqgtr; U+02A8B
LessEqualGreater; U+022DA
LessFullEqual; U+02266
LessGreater; U+02276
lessgtr; U+02276
LessLess; U+02AA1
lesssim; U+02272
LessSlantEqual; U+02A7D
LessTilde; U+02272
lfisht; U+0297C
lfloor; U+0230A
Lfr; U+1D50F
lfr; U+1D529
lg; U+02276
lgE; U+02A91
lHar; U+02962
lhard; U+021BD
lharu; U+021BC
lharul; U+0296A
lhblk; U+02584
LJcy; U+00409
ljcy; U+00459
Ll; U+022D8
ll; U+0226A
llarr; U+021C7
llcorner; U+0231E
Lleftarrow; U+021DA
llhard; U+0296B
lltri; U+025FA
Lmidot; U+0013F
lmidot; U+00140
lmoust; U+023B0
lmoustache; U+023B0
lnap; U+02A89
lnapprox; U+02A89
lnE; U+02268
lne; U+02A87
lneq; U+02A87
lneqq; U+02268
lnsim; U+022E6
loang; U+027EC
loarr; U+021FD
lobrk; U+027E6
LongLeftArrow; U+027F5
Longleftarrow; U+027F8
longleftarrow; U+027F5
LongLeftRightArrow; U+027F7
Longleftrightarrow; U+027FA
longleftrightarrow; U+027F7
longmapsto; U+027FC
LongRightArrow; U+027F6
Longrightarrow; U+027F9
longrightarrow; U+027F6
looparrowleft; U+021AB
looparrowright; U+021AC
lopar; U+02985
Lopf; U+1D543
lopf; U+1D55D
loplus; U+02A2D
lotimes; U+02A34
lowast; U+02217
lowbar; U+0005F
LowerLeftArrow; U+02199
LowerRightArrow; U+02198
loz; U+025CA
lozenge; U+025CA
lozf; U+029EB
lpar; U+00028
lparlt; U+02993
lrarr; U+021C6
lrcorner; U+0231F
lrhar; U+021CB
lrhard; U+0296D
lrm; U+0200E
lrtri; U+022BF
lsaquo; U+02039
Lscr; U+02112
lscr; U+1D4C1
Lsh; U+021B0
lsh; U+021B0
lsim; U+02272
lsime; U+02A8D
lsimg; U+02A8F
lsqb; U+0005B
lsquo; U+02018
lsquor; U+0201A
Lstrok; U+00141
lstrok; U+00142
LT; U+0003C
LT U+0003C
Lt; U+0226A
lt; U+0003C
lt U+0003C
ltcc; U+02AA6
ltcir; U+02A79
ltdot; U+022D6
lthree; U+022CB
ltimes; U+022C9
ltlarr; U+02976
ltquest; U+02A7B
ltri; U+025C3
ltrie; U+022B4
ltrif; U+025C2
ltrPar; U+02996
lurdshar; U+0294A
luruhar; U+02966
lvertneqq; U+02268 U+0FE00
lvnE; U+02268 U+0FE00
macr; U+000AF
macr U+000AF
male; U+02642
malt; U+02720
maltese; U+02720
Map; U+02905
map; U+021A6
mapsto; U+021A6
mapstodown; U+021A7
mapstoleft; U+021A4
mapstoup; U+021A5
marker; U+025AE
mcomma; U+02A29
Mcy; U+0041C
mcy; U+0043C
mdash; U+02014
mDDot; U+0223A
measuredangle; U+02221
MediumSpace; U+0205F
Mellintrf; U+02133
Mfr; U+1D510
mfr; U+1D52A
mho; U+02127
micro; U+000B5
micro U+000B5
mid; U+02223
midast; U+0002A
midcir; U+02AF0
middot; U+000B7
middot U+000B7
minus; U+02212
minusb; U+0229F
minusd; U+02238
minusdu; U+02A2A
MinusPlus; U+02213
mlcp; U+02ADB
mldr; U+02026
mnplus; U+02213
models; U+022A7
Mopf; U+1D544
mopf; U+1D55E
mp; U+02213
Mscr; U+02133
mscr; U+1D4C2
mstpos; U+0223E
Mu; U+0039C
mu; U+003BC
multimap; U+022B8
mumap; U+022B8
nabla; U+02207
Nacute; U+00143
nacute; U+00144
nang; U+02220 U+020D2
nap; U+02249
napE; U+02A70 U+00338
napid; U+0224B U+00338
napos; U+00149
napprox; U+02249
natur; U+0266E
natural; U+0266E
naturals; U+02115
nbsp; U+000A0
nbsp U+000A0
nbump; U+0224E U+00338
nbumpe; U+0224F U+00338
ncap; U+02A43
Ncaron; U+00147
ncaron; U+00148
Ncedil; U+00145
ncedil; U+00146
ncong; U+02247
ncongdot; U+02A6D U+00338
ncup; U+02A42
Ncy; U+0041D
ncy; U+0043D
ndash; U+02013
ne; U+02260
nearhk; U+02924
neArr; U+021D7
nearr; U+02197
nearrow; U+02197
nedot; U+02250 U+00338
NegativeMediumSpace; U+0200B
NegativeThickSpace; U+0200B
NegativeThinSpace; U+0200B
<API key>; U+0200B
nequiv; U+02262
nesear; U+02928
nesim; U+02242 U+00338
<API key>; U+0226B
NestedLessLess; U+0226A
NewLine; U+0000A
nexist; U+02204
nexists; U+02204
Nfr; U+1D511
nfr; U+1D52B
ngE; U+02267 U+00338
nge; U+02271
ngeq; U+02271
ngeqq; U+02267 U+00338
ngeqslant; U+02A7E U+00338
nges; U+02A7E U+00338
nGg; U+022D9 U+00338
ngsim; U+02275
nGt; U+0226B U+020D2
ngt; U+0226F
ngtr; U+0226F
nGtv; U+0226B U+00338
nhArr; U+021CE
nharr; U+021AE
nhpar; U+02AF2
ni; U+0220B
nis; U+022FC
nisd; U+022FA
niv; U+0220B
NJcy; U+0040A
njcy; U+0045A
nlArr; U+021CD
nlarr; U+0219A
nldr; U+02025
nlE; U+02266 U+00338
nle; U+02270
nLeftarrow; U+021CD
nleftarrow; U+0219A
nLeftrightarrow; U+021CE
nleftrightarrow; U+021AE
nleq; U+02270
nleqq; U+02266 U+00338
nleqslant; U+02A7D U+00338
nles; U+02A7D U+00338
nless; U+0226E
nLl; U+022D8 U+00338
nlsim; U+02274
nLt; U+0226A U+020D2
nlt; U+0226E
nltri; U+022EA
nltrie; U+022EC
nLtv; U+0226A U+00338
nmid; U+02224
NoBreak; U+02060
NonBreakingSpace; U+000A0
Nopf; U+02115
nopf; U+1D55F
Not; U+02AEC
not; U+000AC
not U+000AC
NotCongruent; U+02262
NotCupCap; U+0226D
<API key>; U+02226
NotElement; U+02209
NotEqual; U+02260
NotEqualTilde; U+02242 U+00338
NotExists; U+02204
NotGreater; U+0226F
NotGreaterEqual; U+02271
NotGreaterFullEqual; U+02267 U+00338
NotGreaterGreater; U+0226B U+00338
NotGreaterLess; U+02279
<API key>; U+02A7E U+00338
NotGreaterTilde; U+02275
NotHumpDownHump; U+0224E U+00338
NotHumpEqual; U+0224F U+00338
notin; U+02209
notindot; U+022F5 U+00338
notinE; U+022F9 U+00338
notinva; U+02209
notinvb; U+022F7
notinvc; U+022F6
NotLeftTriangle; U+022EA
NotLeftTriangleBar; U+029CF U+00338
<API key>; U+022EC
NotLess; U+0226E
NotLessEqual; U+02270
NotLessGreater; U+02278
NotLessLess; U+0226A U+00338
NotLessSlantEqual; U+02A7D U+00338
NotLessTilde; U+02274
<API key>; U+02AA2 U+00338
NotNestedLessLess; U+02AA1 U+00338
notni; U+0220C
notniva; U+0220C
notnivb; U+022FE
notnivc; U+022FD
NotPrecedes; U+02280
NotPrecedesEqual; U+02AAF U+00338
<API key>; U+022E0
NotReverseElement; U+0220C
NotRightTriangle; U+022EB
NotRightTriangleBar; U+029D0 U+00338
<API key>; U+022ED
NotSquareSubset; U+0228F U+00338
<API key>; U+022E2
NotSquareSuperset; U+02290 U+00338
<API key>; U+022E3
NotSubset; U+02282 U+020D2
NotSubsetEqual; U+02288
NotSucceeds; U+02281
NotSucceedsEqual; U+02AB0 U+00338
<API key>; U+022E1
NotSucceedsTilde; U+0227F U+00338
NotSuperset; U+02283 U+020D2
NotSupersetEqual; U+02289
NotTilde; U+02241
NotTildeEqual; U+02244
NotTildeFullEqual; U+02247
NotTildeTilde; U+02249
NotVerticalBar; U+02224
npar; U+02226
nparallel; U+02226
nparsl; U+02AFD U+020E5
npart; U+02202 U+00338
npolint; U+02A14
npr; U+02280
nprcue; U+022E0
npre; U+02AAF U+00338
nprec; U+02280
npreceq; U+02AAF U+00338
nrArr; U+021CF
nrarr; U+0219B
nrarrc; U+02933 U+00338
nrarrw; U+0219D U+00338
nRightarrow; U+021CF
nrightarrow; U+0219B
nrtri; U+022EB
nrtrie; U+022ED
nsc; U+02281
nsccue; U+022E1
nsce; U+02AB0 U+00338
Nscr; U+1D4A9
nscr; U+1D4C3
nshortmid; U+02224
nshortparallel; U+02226
nsim; U+02241
nsime; U+02244
nsimeq; U+02244
nsmid; U+02224
nspar; U+02226
nsqsube; U+022E2
nsqsupe; U+022E3
nsub; U+02284
nsubE; U+02AC5 U+00338
nsube; U+02288
nsubset; U+02282 U+020D2
nsubseteq; U+02288
nsubseteqq; U+02AC5 U+00338
nsucc; U+02281
nsucceq; U+02AB0 U+00338
nsup; U+02285
nsupE; U+02AC6 U+00338
nsupe; U+02289
nsupset; U+02283 U+020D2
nsupseteq; U+02289
nsupseteqq; U+02AC6 U+00338
ntgl; U+02279
Ntilde; U+000D1
Ntilde U+000D1
ntilde; U+000F1
ntilde U+000F1
ntlg; U+02278
ntriangleleft; U+022EA
ntrianglelefteq; U+022EC
ntriangleright; U+022EB
ntrianglerighteq; U+022ED
Nu; U+0039D
nu; U+003BD
num; U+00023
numero; U+02116
numsp; U+02007
nvap; U+0224D U+020D2
nVDash; U+022AF
nVdash; U+022AE
nvDash; U+022AD
nvdash; U+022AC
nvge; U+02265 U+020D2
nvgt; U+0003E U+020D2
nvHarr; U+02904
nvinfin; U+029DE
nvlArr; U+02902
nvle; U+02264 U+020D2
nvlt; U+0003C U+020D2
nvltrie; U+022B4 U+020D2
nvrArr; U+02903
nvrtrie; U+022B5 U+020D2
nvsim; U+0223C U+020D2
nwarhk; U+02923
nwArr; U+021D6
nwarr; U+02196
nwarrow; U+02196
nwnear; U+02927
Oacute; U+000D3
Oacute U+000D3
oacute; U+000F3
oacute U+000F3
oast; U+0229B
ocir; U+0229A
Ocirc; U+000D4
Ocirc U+000D4
ocirc; U+000F4
ocirc U+000F4
Ocy; U+0041E
ocy; U+0043E
odash; U+0229D
Odblac; U+00150
odblac; U+00151
odiv; U+02A38
odot; U+02299
odsold; U+029BC
OElig; U+00152
oelig; U+00153
ofcir; U+029BF
Ofr; U+1D512
ofr; U+1D52C
ogon; U+002DB
Ograve; U+000D2
Ograve U+000D2
ograve; U+000F2
ograve U+000F2
ogt; U+029C1
ohbar; U+029B5
ohm; U+003A9
oint; U+0222E
olarr; U+021BA
olcir; U+029BE
olcross; U+029BB
oline; U+0203E
olt; U+029C0
Omacr; U+0014C
omacr; U+0014D
Omega; U+003A9
omega; U+003C9
Omicron; U+0039F
omicron; U+003BF
omid; U+029B6
ominus; U+02296
Oopf; U+1D546
oopf; U+1D560
opar; U+029B7
<API key>; U+0201C
OpenCurlyQuote; U+02018
operp; U+029B9
oplus; U+02295
Or; U+02A54
or; U+02228
orarr; U+021BB
ord; U+02A5D
order; U+02134
orderof; U+02134
ordf; U+000AA
ordf U+000AA
ordm; U+000BA
ordm U+000BA
origof; U+022B6
oror; U+02A56
orslope; U+02A57
orv; U+02A5B
oS; U+024C8
Oscr; U+1D4AA
oscr; U+02134
Oslash; U+000D8
Oslash U+000D8
oslash; U+000F8
oslash U+000F8
osol; U+02298
Otilde; U+000D5
Otilde U+000D5
otilde; U+000F5
otilde U+000F5
Otimes; U+02A37
otimes; U+02297
otimesas; U+02A36
Ouml; U+000D6
Ouml U+000D6
ouml; U+000F6
ouml U+000F6
ovbar; U+0233D
OverBar; U+0203E
OverBrace; U+023DE
OverBracket; U+023B4
OverParenthesis; U+023DC
par; U+02225
para; U+000B6
para U+000B6
parallel; U+02225
parsim; U+02AF3
parsl; U+02AFD
part; U+02202
PartialD; U+02202
Pcy; U+0041F
pcy; U+0043F
percnt; U+00025
period; U+0002E
permil; U+02030
perp; U+022A5
pertenk; U+02031
Pfr; U+1D513
pfr; U+1D52D
Phi; U+003A6
phi; U+003C6
phiv; U+003D5
phmmat; U+02133
phone; U+0260E
Pi; U+003A0
pi; U+003C0
pitchfork; U+022D4
piv; U+003D6
planck; U+0210F
planckh; U+0210E
plankv; U+0210F
plus; U+0002B
plusacir; U+02A23
plusb; U+0229E
pluscir; U+02A22
plusdo; U+02214
plusdu; U+02A25
pluse; U+02A72
PlusMinus; U+000B1
plusmn; U+000B1
plusmn U+000B1
plussim; U+02A26
plustwo; U+02A27
pm; U+000B1
Poincareplane; U+0210C
pointint; U+02A15
Popf; U+02119
popf; U+1D561
pound; U+000A3
pound U+000A3
Pr; U+02ABB
pr; U+0227A
prap; U+02AB7
prcue; U+0227C
prE; U+02AB3
pre; U+02AAF
prec; U+0227A
precapprox; U+02AB7
preccurlyeq; U+0227C
Precedes; U+0227A
PrecedesEqual; U+02AAF
PrecedesSlantEqual; U+0227C
PrecedesTilde; U+0227E
preceq; U+02AAF
precnapprox; U+02AB9
precneqq; U+02AB5
precnsim; U+022E8
precsim; U+0227E
Prime; U+02033
prime; U+02032
primes; U+02119
prnap; U+02AB9
prnE; U+02AB5
prnsim; U+022E8
prod; U+0220F
Product; U+0220F
profalar; U+0232E
profline; U+02312
profsurf; U+02313
prop; U+0221D
Proportion; U+02237
Proportional; U+0221D
propto; U+0221D
prsim; U+0227E
prurel; U+022B0
Pscr; U+1D4AB
pscr; U+1D4C5
Psi; U+003A8
psi; U+003C8
puncsp; U+02008
Qfr; U+1D514
qfr; U+1D52E
qint; U+02A0C
Qopf; U+0211A
qopf; U+1D562
qprime; U+02057
Qscr; U+1D4AC
qscr; U+1D4C6
quaternions; U+0210D
quatint; U+02A16
quest; U+0003F
questeq; U+0225F
QUOT; U+00022
QUOT U+00022
quot; U+00022
quot U+00022
rAarr; U+021DB
race; U+0223D U+00331
Racute; U+00154
racute; U+00155
radic; U+0221A
raemptyv; U+029B3
Rang; U+027EB
rang; U+027E9
rangd; U+02992
range; U+029A5
rangle; U+027E9
raquo; U+000BB
raquo U+000BB
Rarr; U+021A0
rArr; U+021D2
rarr; U+02192
rarrap; U+02975
rarrb; U+021E5
rarrbfs; U+02920
rarrc; U+02933
rarrfs; U+0291E
rarrhk; U+021AA
rarrlp; U+021AC
rarrpl; U+02945
rarrsim; U+02974
Rarrtl; U+02916
rarrtl; U+021A3
rarrw; U+0219D
rAtail; U+0291C
ratail; U+0291A
ratio; U+02236
rationals; U+0211A
RBarr; U+02910
rBarr; U+0290F
rbarr; U+0290D
rbbrk; U+02773
rbrace; U+0007D
rbrack; U+0005D
rbrke; U+0298C
rbrksld; U+0298E
rbrkslu; U+02990
Rcaron; U+00158
rcaron; U+00159
Rcedil; U+00156
rcedil; U+00157
rceil; U+02309
rcub; U+0007D
Rcy; U+00420
rcy; U+00440
rdca; U+02937
rdldhar; U+02969
rdquo; U+0201D
rdquor; U+0201D
rdsh; U+021B3
Re; U+0211C
real; U+0211C
realine; U+0211B
realpart; U+0211C
reals; U+0211D
rect; U+025AD
REG; U+000AE
REG U+000AE
reg; U+000AE
reg U+000AE
ReverseElement; U+0220B
ReverseEquilibrium; U+021CB
<API key>; U+0296F
rfisht; U+0297D
rfloor; U+0230B
Rfr; U+0211C
rfr; U+1D52F
rHar; U+02964
rhard; U+021C1
rharu; U+021C0
rharul; U+0296C
Rho; U+003A1
rho; U+003C1
rhov; U+003F1
RightAngleBracket; U+027E9
RightArrow; U+02192
Rightarrow; U+021D2
rightarrow; U+02192
RightArrowBar; U+021E5
RightArrowLeftArrow; U+021C4
rightarrowtail; U+021A3
RightCeiling; U+02309
RightDoubleBracket; U+027E7
RightDownTeeVector; U+0295D
RightDownVector; U+021C2
RightDownVectorBar; U+02955
RightFloor; U+0230B
rightharpoondown; U+021C1
rightharpoonup; U+021C0
rightleftarrows; U+021C4
rightleftharpoons; U+021CC
rightrightarrows; U+021C9
rightsquigarrow; U+0219D
RightTee; U+022A2
RightTeeArrow; U+021A6
RightTeeVector; U+0295B
rightthreetimes; U+022CC
RightTriangle; U+022B3
RightTriangleBar; U+029D0
RightTriangleEqual; U+022B5
RightUpDownVector; U+0294F
RightUpTeeVector; U+0295C
RightUpVector; U+021BE
RightUpVectorBar; U+02954
RightVector; U+021C0
RightVectorBar; U+02953
ring; U+002DA
risingdotseq; U+02253
rlarr; U+021C4
rlhar; U+021CC
rlm; U+0200F
rmoust; U+023B1
rmoustache; U+023B1
rnmid; U+02AEE
roang; U+027ED
roarr; U+021FE
robrk; U+027E7
ropar; U+02986
Ropf; U+0211D
ropf; U+1D563
roplus; U+02A2E
rotimes; U+02A35
RoundImplies; U+02970
rpar; U+00029
rpargt; U+02994
rppolint; U+02A12
rrarr; U+021C9
Rrightarrow; U+021DB
rsaquo; U+0203A
Rscr; U+0211B
rscr; U+1D4C7
Rsh; U+021B1
rsh; U+021B1
rsqb; U+0005D
rsquo; U+02019
rsquor; U+02019
rthree; U+022CC
rtimes; U+022CA
rtri; U+025B9
rtrie; U+022B5
rtrif; U+025B8
rtriltri; U+029CE
RuleDelayed; U+029F4
ruluhar; U+02968
rx; U+0211E
Sacute; U+0015A
sacute; U+0015B
sbquo; U+0201A
Sc; U+02ABC
sc; U+0227B
scap; U+02AB8
Scaron; U+00160
scaron; U+00161
sccue; U+0227D
scE; U+02AB4
sce; U+02AB0
Scedil; U+0015E
scedil; U+0015F
Scirc; U+0015C
scirc; U+0015D
scnap; U+02ABA
scnE; U+02AB6
scnsim; U+022E9
scpolint; U+02A13
scsim; U+0227F
Scy; U+00421
scy; U+00441
sdot; U+022C5
sdotb; U+022A1
sdote; U+02A66
searhk; U+02925
seArr; U+021D8
searr; U+02198
searrow; U+02198
sect; U+000A7
sect U+000A7
semi; U+0003B
seswar; U+02929
setminus; U+02216
setmn; U+02216
sext; U+02736
Sfr; U+1D516
sfr; U+1D530
sfrown; U+02322
sharp; U+0266F
SHCHcy; U+00429
shchcy; U+00449
SHcy; U+00428
shcy; U+00448
ShortDownArrow; U+02193
ShortLeftArrow; U+02190
shortmid; U+02223
shortparallel; U+02225
ShortRightArrow; U+02192
ShortUpArrow; U+02191
shy; U+000AD
shy U+000AD
Sigma; U+003A3
sigma; U+003C3
sigmaf; U+003C2
sigmav; U+003C2
sim; U+0223C
simdot; U+02A6A
sime; U+02243
simeq; U+02243
simg; U+02A9E
simgE; U+02AA0
siml; U+02A9D
simlE; U+02A9F
simne; U+02246
simplus; U+02A24
simrarr; U+02972
slarr; U+02190
SmallCircle; U+02218
smallsetminus; U+02216
smashp; U+02A33
smeparsl; U+029E4
smid; U+02223
smile; U+02323
smt; U+02AAA
smte; U+02AAC
smtes; U+02AAC U+0FE00
SOFTcy; U+0042C
softcy; U+0044C
sol; U+0002F
solb; U+029C4
solbar; U+0233F
Sopf; U+1D54A
sopf; U+1D564
spades; U+02660
spadesuit; U+02660
spar; U+02225
sqcap; U+02293
sqcaps; U+02293 U+0FE00
sqcup; U+02294
sqcups; U+02294 U+0FE00
Sqrt; U+0221A
sqsub; U+0228F
sqsube; U+02291
sqsubset; U+0228F
sqsubseteq; U+02291
sqsup; U+02290
sqsupe; U+02292
sqsupset; U+02290
sqsupseteq; U+02292
squ; U+025A1
Square; U+025A1
square; U+025A1
SquareIntersection; U+02293
SquareSubset; U+0228F
SquareSubsetEqual; U+02291
SquareSuperset; U+02290
SquareSupersetEqual; U+02292
SquareUnion; U+02294
squarf; U+025AA
squf; U+025AA
srarr; U+02192
Sscr; U+1D4AE
sscr; U+1D4C8
ssetmn; U+02216
ssmile; U+02323
sstarf; U+022C6
Star; U+022C6
star; U+02606
starf; U+02605
straightepsilon; U+003F5
straightphi; U+003D5
strns; U+000AF
Sub; U+022D0
sub; U+02282
subdot; U+02ABD
subE; U+02AC5
sube; U+02286
subedot; U+02AC3
submult; U+02AC1
subnE; U+02ACB
subne; U+0228A
subplus; U+02ABF
subrarr; U+02979
Subset; U+022D0
subset; U+02282
subseteq; U+02286
subseteqq; U+02AC5
SubsetEqual; U+02286
subsetneq; U+0228A
subsetneqq; U+02ACB
subsim; U+02AC7
subsub; U+02AD5
subsup; U+02AD3
succ; U+0227B
succapprox; U+02AB8
succcurlyeq; U+0227D
Succeeds; U+0227B
SucceedsEqual; U+02AB0
SucceedsSlantEqual; U+0227D
SucceedsTilde; U+0227F
succeq; U+02AB0
succnapprox; U+02ABA
succneqq; U+02AB6
succnsim; U+022E9
succsim; U+0227F
SuchThat; U+0220B
Sum; U+02211
sum; U+02211
sung; U+0266A
Sup; U+022D1
sup; U+02283
sup1; U+000B9
sup1 U+000B9
sup2; U+000B2
sup2 U+000B2
sup3; U+000B3
sup3 U+000B3
supdot; U+02ABE
supdsub; U+02AD8
supE; U+02AC6
supe; U+02287
supedot; U+02AC4
Superset; U+02283
SupersetEqual; U+02287
suphsol; U+027C9
suphsub; U+02AD7
suplarr; U+0297B
supmult; U+02AC2
supnE; U+02ACC
supne; U+0228B
supplus; U+02AC0
Supset; U+022D1
supset; U+02283
supseteq; U+02287
supseteqq; U+02AC6
supsetneq; U+0228B
supsetneqq; U+02ACC
supsim; U+02AC8
supsub; U+02AD4
supsup; U+02AD6
swarhk; U+02926
swArr; U+021D9
swarr; U+02199
swarrow; U+02199
swnwar; U+0292A
szlig; U+000DF
szlig U+000DF
Tab; U+00009
target; U+02316
Tau; U+003A4
tau; U+003C4
tbrk; U+023B4
Tcaron; U+00164
tcaron; U+00165
Tcedil; U+00162
tcedil; U+00163
Tcy; U+00422
tcy; U+00442
tdot; U+020DB
telrec; U+02315
Tfr; U+1D517
tfr; U+1D531
there4; U+02234
Therefore; U+02234
therefore; U+02234
Theta; U+00398
theta; U+003B8
thetasym; U+003D1
thetav; U+003D1
thickapprox; U+02248
thicksim; U+0223C
ThickSpace; U+0205F U+0200A
thinsp; U+02009
ThinSpace; U+02009
thkap; U+02248
thksim; U+0223C
THORN; U+000DE
THORN U+000DE
thorn; U+000FE
thorn U+000FE
Tilde; U+0223C
tilde; U+002DC
TildeEqual; U+02243
TildeFullEqual; U+02245
TildeTilde; U+02248
times; U+000D7
times U+000D7
timesb; U+022A0
timesbar; U+02A31
timesd; U+02A30
tint; U+0222D
toea; U+02928
top; U+022A4
topbot; U+02336
topcir; U+02AF1
Topf; U+1D54B
topf; U+1D565
topfork; U+02ADA
tosa; U+02929
tprime; U+02034
TRADE; U+02122
trade; U+02122
triangle; U+025B5
triangledown; U+025BF
triangleleft; U+025C3
trianglelefteq; U+022B4
triangleq; U+0225C
triangleright; U+025B9
trianglerighteq; U+022B5
tridot; U+025EC
trie; U+0225C
triminus; U+02A3A
TripleDot; U+020DB
triplus; U+02A39
trisb; U+029CD
tritime; U+02A3B
trpezium; U+023E2
Tscr; U+1D4AF
tscr; U+1D4C9
TScy; U+00426
tscy; U+00446
TSHcy; U+0040B
tshcy; U+0045B
Tstrok; U+00166
tstrok; U+00167
twixt; U+0226C
twoheadleftarrow; U+0219E
twoheadrightarrow; U+021A0
Uacute; U+000DA
Uacute U+000DA
uacute; U+000FA
uacute U+000FA
Uarr; U+0219F
uArr; U+021D1
uarr; U+02191
Uarrocir; U+02949
Ubrcy; U+0040E
ubrcy; U+0045E
Ubreve; U+0016C
ubreve; U+0016D
Ucirc; U+000DB
Ucirc U+000DB
ucirc; U+000FB
ucirc U+000FB
Ucy; U+00423
ucy; U+00443
udarr; U+021C5
Udblac; U+00170
udblac; U+00171
udhar; U+0296E
ufisht; U+0297E
Ufr; U+1D518
ufr; U+1D532
Ugrave; U+000D9
Ugrave U+000D9
ugrave; U+000F9
ugrave U+000F9
uHar; U+02963
uharl; U+021BF
uharr; U+021BE
uhblk; U+02580
ulcorn; U+0231C
ulcorner; U+0231C
ulcrop; U+0230F
ultri; U+025F8
Umacr; U+0016A
umacr; U+0016B
uml; U+000A8
uml U+000A8
UnderBar; U+0005F
UnderBrace; U+023DF
UnderBracket; U+023B5
UnderParenthesis; U+023DD
Union; U+022C3
UnionPlus; U+0228E
Uogon; U+00172
uogon; U+00173
Uopf; U+1D54C
uopf; U+1D566
UpArrow; U+02191
Uparrow; U+021D1
uparrow; U+02191
UpArrowBar; U+02912
UpArrowDownArrow; U+021C5
UpDownArrow; U+02195
Updownarrow; U+021D5
updownarrow; U+02195
UpEquilibrium; U+0296E
upharpoonleft; U+021BF
upharpoonright; U+021BE
uplus; U+0228E
UpperLeftArrow; U+02196
UpperRightArrow; U+02197
Upsi; U+003D2
upsi; U+003C5
upsih; U+003D2
Upsilon; U+003A5
upsilon; U+003C5
UpTee; U+022A5
UpTeeArrow; U+021A5
upuparrows; U+021C8
urcorn; U+0231D
urcorner; U+0231D
urcrop; U+0230E
Uring; U+0016E
uring; U+0016F
urtri; U+025F9
Uscr; U+1D4B0
uscr; U+1D4CA
utdot; U+022F0
Utilde; U+00168
utilde; U+00169
utri; U+025B5
utrif; U+025B4
uuarr; U+021C8
Uuml; U+000DC
Uuml U+000DC
uuml; U+000FC
uuml U+000FC
uwangle; U+029A7
vangrt; U+0299C
varepsilon; U+003F5
varkappa; U+003F0
varnothing; U+02205
varphi; U+003D5
varpi; U+003D6
varpropto; U+0221D
vArr; U+021D5
varr; U+02195
varrho; U+003F1
varsigma; U+003C2
varsubsetneq; U+0228A U+0FE00
varsubsetneqq; U+02ACB U+0FE00
varsupsetneq; U+0228B U+0FE00
varsupsetneqq; U+02ACC U+0FE00
vartheta; U+003D1
vartriangleleft; U+022B2
vartriangleright; U+022B3
Vbar; U+02AEB
vBar; U+02AE8
vBarv; U+02AE9
Vcy; U+00412
vcy; U+00432
VDash; U+022AB
Vdash; U+022A9
vDash; U+022A8
vdash; U+022A2
Vdashl; U+02AE6
Vee; U+022C1
vee; U+02228
veebar; U+022BB
veeeq; U+0225A
vellip; U+022EE
Verbar; U+02016
verbar; U+0007C
Vert; U+02016
vert; U+0007C
VerticalBar; U+02223
VerticalLine; U+0007C
VerticalSeparator; U+02758
VerticalTilde; U+02240
VeryThinSpace; U+0200A
Vfr; U+1D519
vfr; U+1D533
vltri; U+022B2
vnsub; U+02282 U+020D2
vnsup; U+02283 U+020D2
Vopf; U+1D54D
vopf; U+1D567
vprop; U+0221D
vrtri; U+022B3
Vscr; U+1D4B1
vscr; U+1D4CB
vsubnE; U+02ACB U+0FE00
vsubne; U+0228A U+0FE00
vsupnE; U+02ACC U+0FE00
vsupne; U+0228B U+0FE00
Vvdash; U+022AA
vzigzag; U+0299A
Wcirc; U+00174
wcirc; U+00175
wedbar; U+02A5F
Wedge; U+022C0
wedge; U+02227
wedgeq; U+02259
weierp; U+02118
Wfr; U+1D51A
wfr; U+1D534
Wopf; U+1D54E
wopf; U+1D568
wp; U+02118
wr; U+02240
wreath; U+02240
Wscr; U+1D4B2
wscr; U+1D4CC
xcap; U+022C2
xcirc; U+025EF
xcup; U+022C3
xdtri; U+025BD
Xfr; U+1D51B
xfr; U+1D535
xhArr; U+027FA
xharr; U+027F7
Xi; U+0039E
xi; U+003BE
xlArr; U+027F8
xlarr; U+027F5
xmap; U+027FC
xnis; U+022FB
xodot; U+02A00
Xopf; U+1D54F
xopf; U+1D569
xoplus; U+02A01
xotime; U+02A02
xrArr; U+027F9
xrarr; U+027F6
Xscr; U+1D4B3
xscr; U+1D4CD
xsqcup; U+02A06
xuplus; U+02A04
xutri; U+025B3
xvee; U+022C1
xwedge; U+022C0
Yacute; U+000DD
Yacute U+000DD
yacute; U+000FD
yacute U+000FD
YAcy; U+0042F
yacy; U+0044F
Ycirc; U+00176
ycirc; U+00177
Ycy; U+0042B
ycy; U+0044B
yen; U+000A5
yen U+000A5
Yfr; U+1D51C
yfr; U+1D536
YIcy; U+00407
yicy; U+00457
Yopf; U+1D550
yopf; U+1D56A
Yscr; U+1D4B4
yscr; U+1D4CE
YUcy; U+0042E
yucy; U+0044E
Yuml; U+00178
yuml; U+000FF
yuml U+000FF
Zacute; U+00179
zacute; U+0017A
Zcaron; U+0017D
zcaron; U+0017E
Zcy; U+00417
zcy; U+00437
Zdot; U+0017B
zdot; U+0017C
zeetrf; U+02128
ZeroWidthSpace; U+0200B
Zeta; U+00396
zeta; U+003B6
Zfr; U+02128
zfr; U+1D537
ZHcy; U+00416
zhcy; U+00436
zigrarr; U+021DD
Zopf; U+02124
zopf; U+1D56B
Zscr; U+1D4B5
zscr; U+1D4CF
zwj; U+0200D
zwnj; U+0200C |
package com.jivesoftware.boundaries.restz;
import com.jivesoftware.boundaries.restz.layers.<API key>;
import com.jivesoftware.boundaries.restz.layers.<API key>;
import java.util.Collection;
import java.util.LinkedList;
public class LayerCollection
{
private Collection<<API key>> wrappers;
private Collection<<API key>> recoverables;
public LayerCollection()
{
wrappers = new LinkedList<>();
recoverables = new LinkedList<>();
}
public LayerCollection(Layer... layers)
{
this();
add(layers);
}
public void add(Layer... layers)
{
for(Layer layer : layers)
{
if (layer instanceof <API key>)
wrappers.add((<API key>) layer);
if (layer instanceof <API key>)
recoverables.add((<API key>) layer);
}
}
public void remove(Layer... layers)
{
for(Layer layer : layers)
{
if (layer instanceof <API key>)
wrappers.remove(layer);
if (layer instanceof <API key>)
recoverables.remove(layer);
}
}
public Collection<<API key>> getWrappers()
{
return wrappers;
}
public Collection<<API key>> getRecoverables()
{
return recoverables;
}
} |
<%inherit file="base.html"/>
## SEO Stuff
<%block name="title">Index</%block>
<%block name="description">Statik API - Public API for Statik Metrics</%block>
<%block name="keywords">minecraft metrics statik api public java plugin server system stats graphs</%block>
## Main content
<h1 class="ui header">API documentation</h1>
<p> All API calls should be made to
<code>http://api.statik.io/FORMAT/ROUTE</code>.
</p>
<p> Replace <code>FORMAT</code> with either <code>xml</code>
or <code>json</code> and the API will return data in that
format. For example, <code>/xml/ROUTE</code> would return
ROUTE's data in XML format. <strong>Note,</strong> none of
us actually uses the XML API. Feel free to ask us about
improvements to the XML output!
</p>
<p> Replace <code>ROUTE</code> with the API route you want to call.
For example, <code>/json/routes</code> would return all routes
in JSON format.
</p>
<p> At lol768's
<a href="https://github.com/Statik-Metrics/Statik-API/issues/3#<API key>">request</a>,
You may also make calls using <code>api</code> as the
<code>FORMAT</code>, specifying either <code>text/xml</code>
or <code>application/json</code> in the <code>Accepts</code>
header, and you'll get your response in the format you expect.
</p>
## <p> If any route requires you to POST or PUT data, it
## <strong>must</strong> be in <strong>JSON format</strong>.
<div class="ui horizontal icon divider">
<i class="circular warning icon inverted red"></i>
</div>
<h4 class="ui header">Errors</h4>
<p> If an internal server error occurred, it will be
returned in the response instead of your expected
response. The following are examples of this in both
formats.
</p>
<div class="ui fluid accordion">
<div class="title">
<i class="dropdown icon"></i>
JSON
</div>
<div class="content">
<div class="ui secondary code-segment segment">
<div class="codehilite">
<pre><span class="p">{</span>
<span class="nt">"error"</span><span class="p">:</span> <span class="s2">"Error text."</span>
<span class="p">}</span>
</pre>
</div>
</div>
</div>
<div class="title">
<i class="dropdown icon"></i>
XML
</div>
<div class="content">
<div class="ui secondary code-segment segment">
<div class="codehilite"><pre><span class="cp"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="nt"><data></span>
<span class="nt"><error</span> <span class="na">type=</span><span class="s">"str"</span><span class="nt">></span>Error text.<span class="nt"></error></span>
<span class="nt"></data></span>
</pre></div>
</div>
</div>
</div>
<div class="ui horizontal icon divider">
<i class="circular terminal icon inverted teal"></i>
</div>
% for api in sorted(apis.keys()):
<!-- Route segment: ${api | h} -->
<h4 class="ui header">${api | h}</h4>
% for method in sorted(apis[api].keys()):
<h4 class="ui green attached message">HTTP ${method | h}</h4>
<div class="ui fluid raised attached segment">
${apis[api][method]["html"]}
</div>
% endfor
% endfor |
<?php require_once("../../database/initialize.php"); ?>
<?php if (!$session->is_logged_in()) { redirect_to("login.php"); } ?>
<?php
// must have an ID
if(empty($_GET['id'])) {
$session->message("<div class='alert alert-danger'><span class='glyphicon <API key>'></span>  No blog ID was provided.</div>");
redirect_to('admin.php');
}
$blog = Blog::find_by_id($_GET['id']);
if($blog && $blog->delete()) {
$session->message("<div class='alert alert-success' role='alert'>The Blog was deleted.</div>");
redirect_to("listblog.php");
} else {
$session->message("<div class='alert alert-danger' role='alert'>The Blog could not be deleted.</div>");
redirect_to('listblog.php');
}
?>
<?php if(isset($database)) { $database->close_connection(); } ?> |
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_292) on Fri Jul 02 16:35:39 UTC 2021 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class org.bukkit.SkullType (Glowkit 1.16.5-R0.1-SNAPSHOT API)</title>
<meta name="date" content="2021-07-02">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.bukkit.SkullType (Glowkit 1.16.5-R0.1-SNAPSHOT API)";
}
}
catch(err) {
}
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="topNav"><a name="navbar.top">
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../org/bukkit/SkullType.html" title="enum in org.bukkit">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/bukkit/class-use/SkullType.html" target="_top">Frames</a></li>
<li><a href="SkullType.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip.navbar.top">
</a></div>
<div class="header">
<h2 title="Uses of Class org.bukkit.SkullType" class="title">Uses of Class<br>org.bukkit.SkullType</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../org/bukkit/SkullType.html" title="enum in org.bukkit">SkullType</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#org.bukkit">org.bukkit</a></td>
<td class="colLast">
<div class="block">The root package of the Bukkit API, contains generalized API classes.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="#org.bukkit.block">org.bukkit.block</a></td>
<td class="colLast">
<div class="block">Classes used to manipulate the voxels in a <a href="../../../org/bukkit/World.html" title="interface in org.bukkit"><code>world</code></a>,
including special states.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.bukkit">
</a>
<h3>Uses of <a href="../../../org/bukkit/SkullType.html" title="enum in org.bukkit">SkullType</a> in <a href="../../../org/bukkit/package-summary.html">org.bukkit</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../org/bukkit/package-summary.html">org.bukkit</a> that return <a href="../../../org/bukkit/SkullType.html" title="enum in org.bukkit">SkullType</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../org/bukkit/SkullType.html" title="enum in org.bukkit">SkullType</a></code></td>
<td class="colLast"><span class="typeNameLabel">SkullType.</span><code><span class="memberNameLink"><a href="../../../org/bukkit/SkullType.html
<div class="block"><span class="deprecatedLabel">Deprecated.</span> </div>
<div class="block">Returns the enum constant of this type with the specified name.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../org/bukkit/SkullType.html" title="enum in org.bukkit">SkullType</a>[]</code></td>
<td class="colLast"><span class="typeNameLabel">SkullType.</span><code><span class="memberNameLink"><a href="../../../org/bukkit/SkullType.html#values--">values</a></span>()</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span> </div>
<div class="block">Returns an array containing the constants of this enum type, in
the order they are declared.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="org.bukkit.block">
</a>
<h3>Uses of <a href="../../../org/bukkit/SkullType.html" title="enum in org.bukkit">SkullType</a> in <a href="../../../org/bukkit/block/package-summary.html">org.bukkit.block</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../org/bukkit/block/package-summary.html">org.bukkit.block</a> that return <a href="../../../org/bukkit/SkullType.html" title="enum in org.bukkit">SkullType</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="https://javadoc.io/doc/org.jetbrains/annotations-java5/20.1.0/org/jetbrains/annotations/NotNull.html?is-external=true" title="class or interface in org.jetbrains.annotations">@NotNull</a> <a href="../../../org/bukkit/SkullType.html" title="enum in org.bukkit">SkullType</a></code></td>
<td class="colLast"><span class="typeNameLabel">Skull.</span><code><span class="memberNameLink"><a href="../../../org/bukkit/block/Skull.html#getSkullType--">getSkullType</a></span>()</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>
<div class="block"><span class="deprecationComment">check <a href="../../../org/bukkit/Material.html" title="enum in org.bukkit"><code>Material</code></a> instead</span></div>
</div>
</td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../org/bukkit/block/package-summary.html">org.bukkit.block</a> with parameters of type <a href="../../../org/bukkit/SkullType.html" title="enum in org.bukkit">SkullType</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><span class="typeNameLabel">Skull.</span><code><span class="memberNameLink"><a href="../../../org/bukkit/block/Skull.html#setSkullType-org.bukkit.SkullType-">setSkullType</a></span>(<a href="../../../org/bukkit/SkullType.html" title="enum in org.bukkit">SkullType</a> skullType)</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>
<div class="block"><span class="deprecationComment">check <a href="../../../org/bukkit/Material.html" title="enum in org.bukkit"><code>Material</code></a> instead</span></div>
</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="bottomNav"><a name="navbar.bottom">
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../org/bukkit/SkullType.html" title="enum in org.bukkit">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/bukkit/class-use/SkullType.html" target="_top">Frames</a></li>
<li><a href="SkullType.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip.navbar.bottom">
</a></div>
<p class="legalCopy"><small>Copyright &
</body>
</html> |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using PlayerTracker.Common.Util;
using PlayerTracker.Common.Net;
using PlayerTracker.Common.Net.Packets;
namespace PlayerTracker.Client.Forms {
public partial class frmLogin : Form {
public frmLogin() {
InitializeComponent();
Client.getClient();
}
private void btnLogin_Click(object sender, EventArgs e) {
if (this.txtPassword.Text.Length == 0 || this.txtUsername.Text.Length == 0) {
MessageBox.Show("Neither the username nor password field may be blank.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
Client.getClient().connect();
Packet p = new LoginPacket(txtUsername.Text, txtPassword.Text);
Client.getClient().getConnection().send(p);
while (!Client.getClient().getRequestManager().hasResponse()) ;
LoginResponsePacket r = (LoginResponsePacket)Client.getClient().getRequestManager().getResponse();
if(r.getResponse().Equals(LoginResponsePacket.LoginResponse.SUCCESS)){
this.Hide();
Client.getClient().setUser(txtUsername.Text);
Client.getClient().setUserId(r.getUserId());
new frmSearch().ShowDialog();
}else{
MessageBox.Show("Invalid username or password.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
}
private void btnExit_Click(object sender, EventArgs e) {
this.Close();
}
private void frmLogin_FormClosed(object sender, FormClosedEventArgs e) {
Client.getClient().stop();
}
private void btnConfigure_Click(object sender, EventArgs e) {
new frmConfiguration().ShowDialog();
}
}
} |
namespace AGS.Engine
{
public interface <API key>
{
bool Render();
}
} |
#pragma once
#include <modules/discretedata/<API key>.h>
#include <modules/discretedata/channels/datachannel.h>
#include <modules/discretedata/channels/channelgetter.h>
#include <modules/discretedata/channels/cachedgetter.h>
namespace inviwo {
namespace discretedata {
/**
* \brief Data channel by function evaluated at each (linear) index.
*
* Realization of DataChannel.
*
* Data is stored implicitly by a function f:index -> vec<T, N>,
* where the destination memory is pre-allocated.
* Indices are linear.
*
* @author Anke Friederici and Tino Weinkauf
*/
template <typename T, ind N, typename Vec = std::array<T, N>>
class AnalyticChannel : public DataChannel<T, N> {
public:
static_assert(sizeof(Vec) == sizeof(T) * N, "Size and type do not agree with the vector type.");
using Function = typename std::function<void(Vec&, ind)>;
public:
/**
* \brief Direct construction
* @param dataFunction Data generator, mapping of linear index to T*
* @param numElements Total number of indexed positions
* @param name Name associated with the channel
* @param definedOn GridPrimitive the data is defined on, default: 0D vertices
*/
AnalyticChannel(Function dataFunction, ind numElements, const std::string& name,
GridPrimitive definedOn = GridPrimitive::Vertex)
: DataChannel<T, N>(name, definedOn)
, numElements_(numElements)
, dataFunction_(dataFunction) {}
virtual ~AnalyticChannel() = default;
public:
ind size() const override { return numElements_; }
/**
* \brief Indexed point access, constant
* Will write to the memory of dest via reinterpret_cast.
* @param dest Position to write to, expect write of NumComponents many T
* @param index Linear point index
*/
void fillRaw(T* dest, ind index) const override {
Vec& destVec = *reinterpret_cast<Vec*>(dest);
dataFunction_(destVec, index);
}
protected:
virtual CachedGetter<AnalyticChannel>* newIterator() override {
return new CachedGetter<AnalyticChannel>(this);
}
public:
ind numElements_;
Function dataFunction_;
};
} // namespace discretedata
} // namespace inviwo |
const glob = require('glob');
const path = require('path');
const <API key> = require('<API key>');
const { CleanWebpackPlugin } = require('<API key>');
const config = {
mode: process.env.NODE_ENV,
entry: [
<API key>: ['**/*', '!leaflet.distortableimage.css'] |
// +build darwin
package sysstats
import (
"os/exec"
"strconv"
"strings"
)
// LoadAvg represents the load average of the system
// The following are the keys of the map:
// Avg1 - The average processor workload of the last minute
// Avg5 - The average processor workload of the last 5 minutes
// Avg15 - The average processor workload of the last 15 minutes
type LoadAvg map[string]float64
// getLoadAvg gets the load average of an OSX system
func getLoadAvg() (loadAvg LoadAvg, err error) {
// `sysctl -n vm.loadavg` returns the load average with the
// following format:
// { 1.33 1.27 1.38 }
out, err := exec.Command(`sysctl`, `-n`, `vm.loadavg`).Output()
if err != nil {
return nil, err
}
loadAvg = LoadAvg{}
fields := strings.Fields(string(out))
for i := 1; i < 4; i++ {
load, err := strconv.ParseFloat(fields[i], 64)
if err != nil {
return nil, err
}
switch i {
case 1:
loadAvg[`avg1`] = load
case 2:
loadAvg[`avg5`] = load
case 3:
loadAvg[`avg15`] = load
}
}
return loadAvg, nil
} |
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "chip.h"
#include "nuc_gpio.h"
#include "nutiny-nuc120.h"
#ifdef CONFIG_ARCH_LEDS
/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG
* with <API key> too)
*/
#ifdef CONFIG_DEBUG_LEDS
# define leddbg lldbg
# ifdef <API key>
# define ledvdbg lldbg
# else
# define ledvdbg(x...)
# endif
#else
# define leddbg(x...)
# define ledvdbg(x...)
#endif
/* Dump GPIO registers */
#if defined(<API key>) && defined(CONFIG_DEBUG_LEDS)
# define led_dumpgpio(m) nuc_dumpgpio(GPIO_LED, m)
#else
# define led_dumpgpio(m)
#endif
void nuc_ledinit(void)
{
led_dumpgpio("Before configuration");
nuc_configgpio(GPIO_LED);
led_dumpgpio("After configuration");
}
void board_led_on(int led)
{
nuc_gpiowrite(GPIO_LED, false);
}
void board_led_off(int led)
{
nuc_gpiowrite(GPIO_LED, true);
}
#endif /* CONFIG_ARCH_LEDS */ |
#include <string>
#include <vector>
std::string base64_encode(unsigned char const* , unsigned int len);
std::string base64_decode(std::string const& s);
std::vector<char> base64_decode_vec(std::string const& s);
char *unbase64(unsigned char *input, int length, int *_outlength); |
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
namespace dokumentasi
{
class Program
{
<summary>
The entry point of the application.
</summary>
<param name="args">command line parameters</param>
static void Main(string[] args)
{
if (args.Length < 1)
{
Console.WriteLine("Usage: dokumentasi <assembly name>");
return;
}
DateTime start = DateTime.Now;
// load documentation XML
string <API key> = args[0] + ".xml";
if (!File.Exists(<API key>))
{
Console.WriteLine("Documentation XML not found: " + <API key>);
Environment.Exit(-1);
}
var documentation = new Documentation(<API key>);
// load assembly reflection information
var assemblyfilename = args[0] + ".dll";
if (!File.Exists(<API key>))
{
Console.WriteLine("Assembly not found: " + <API key>);
Environment.Exit(-1);
}
var bytes = File.ReadAllBytes(assemblyfilename);
var assembly = Assembly.Load(bytes);
var reflection = new Reflection(assembly);
// style
File.WriteAllText("dokumentasi.css", Properties.Resources.style);
// contents
int count = 1, total = reflection.Types.Count();
foreach(var type in reflection.Types)
{
if (type.FullName.StartsWith("<<API key>>") ||
type.FullName.StartsWith("<<API key>>"))
{
continue;
}
var member = documentation.GetMemberById(type.FullName);
var inheritance = type.GetClassHierarchy();
var constructors = type.GetConstructors();
Array.Sort(constructors, new <API key>());
var properties = type.GetProperties();
Array.Sort(properties, new <API key>());
var methods = type.GetMethods();
Array.Sort(methods, new MethodInfoComparer());
var events = type.GetEvents();
Array.Sort(events, new EventInfoComparer());
var fields = type.GetFields();
Array.Sort(fields, new FieldInfoComparer());
var typeinfo = new TypeInfo
{
FullName = type.FullName,
Id = type.FullName,
DocumentMember = member,
Inheritance = inheritance,
Namespace = type.Namespace,
AssemblyName = type.Assembly.GetName().Name,
AssemblyFileName = Path.GetFileName(type.Assembly.Location),
Constructors = (from constructor in constructors select new Constructor { Signature = constructor.GetSignature(), FullName = constructor.Name, Name = type.Name }).ToArray(),
Properties = (from property in properties select new Property { Signature = property.GetSignature(), Name = property.Name, FullName = type.FullName + "." + property.Name, DocumentMember = documentation.GetMemberById(type.FullName + ". " + property.Name) }).ToArray(),
Methods = (from method in methods where !method.IsSpecialName select new Method { Signature = method.GetSignature(), Name = method.Name, FullName = type.FullName + "." + method.Name, DocumentMember = documentation.GetMemberById(type.FullName + ". " + method.Name) }).ToArray(),
Events = (from @event in events where !@event.IsSpecialName select new Event { Name = @event.Name, FullName = type.FullName + "." + @event.Name, DocumentationMember = documentation.GetMemberById(type.FullName + ". " + @event.Name) }).ToArray(),
Fields = (from field in fields where !field.IsSpecialName select new Field { Name = field.Name, FullName = type.FullName + "." + field.Name, DocumentationMember = documentation.GetMemberById(type.FullName + ". " + field.Name) }).ToArray(),
};
string xmlfilename = type.FullName + ".xml";
Console.WriteLine("[{0}/{1}] Writing {2}", count, total, xmlfilename);
using (var streamwriter = new StreamWriter(xmlfilename))
{
var xmlwriter = new XmlWriter(streamwriter);
xmlwriter.BuildContent(typeinfo);
}
string htmlfilename = type.FullName + ".html";
Console.WriteLine("[{0}/{1}] Writing {2}", count, total, htmlfilename);
var topicwriter = new HtmlWriter();
topicwriter.BuildContent(xmlfilename, htmlfilename);
count++;
}
// table of contents
string tocfilename = "toc.xml";
Console.WriteLine("Writing " + tocfilename);
using (var streamwriter = new StreamWriter(tocfilename))
{
var types = (from type in reflection.Types
orderby type.FullName
select new TypeInfo { FullName = type.FullName, Id = type.FullName }).ToArray<TypeInfo>();
var xmlwriter = new XmlWriter(streamwriter);
xmlwriter.BuildToC(types);
streamwriter.Close();
}
Console.WriteLine("Writing toc.html");
var tocwriter = new HtmlWriter();
tocwriter.BuildToC();
// timing
TimeSpan duration = DateTime.Now.Subtract(start);
Console.WriteLine("Time: " + duration);
if(Debugger.IsAttached)
{
Console.WriteLine("Press any key...");
Console.ReadKey();
}
}
}
} |
flask-ldap
=======
Flask ldap login is designed to work on top of an existing application.
It will:
* Connect to an ldap server
* Lookup ldap users using a direct bind or bind/search method
* Store the ldap user into your server's DB
* Integrate ldap into an existing web application
It will not:
* Provide `login_required` or any other route decorators
* Store the active user’s ID in the session. Use an existing framework like
[Flask-Login](https://flask-login.readthedocs.org/en/latest/) for this task.
# Examples
* [Bind/Search](https://github.com/srossross/flask-ldap-login/blob/master/examples/bind_search.py)
* [Direct Bind](https://github.com/srossross/flask-ldap-login/blob/master/examples/direct_bind.py)
# Configuring your Application
The most important part of an application that uses flask-ldap-Login is the `LDAPLoginManager` class.
You should create one for your application somewhere in your code, like this:
ldap_mgr = LDAPLoginManager()
The login manager contains the code that lets your application and ldap work together
such as how to load a user from an ldap server,
and how to store the user into the application's database.
Once the actual application object has been created, you can configure it for login with:
login_manager.init_app(app)
# Testing your Configuration
Run the `<API key>` command against your app
to test that it can successully connect to your ldap server.
<API key> examples.direct_bind:app --username 'me' --password 'super secret'
# How it Works
## save_user callback
You will need to provide a `save_user` callback.
This callback is used store any users looked up in the ldap diectory into your database. For example:
Callback must return a `user` object or `None` if the user can not be created.
@ldap_mgr.save_user
def save_user(username, userdata):
user = User.get(username=username)
if user is None:
user = create_user(username, userdata)
else:
user.update(userdata)
user.save()
return user
## LDAPLoginForm form
The `LDAPLoginForm` is provided to you for your convinience.
Once validated the form will contain a valid `form.user`
object which you can use in your application.
In this example, the user object is logged in using the `login_user` from The
[Flask-Login](https://flask-login.readthedocs.org/en/latest/) module:
@app.route('/login', methods=['GET', 'POST'])
def ldap_login():
form = LDAPLoginForm(request.form)
if form.validate_on_submit():
login_user(form.user, remember=True)
print "Valid"
return redirect('/')
else:
print "Invalid"
return render_template('login.html', form=form)
## Configuration Variables
To set the flask-ldap-login config variables
update the application like:
app.config.update(LDAP={'URI': ..., })
URI:
Start by setting URI to point to your server.
The value of this setting can be anything that your LDAP library supports.
For instance, openldap may allow you to give a comma- or space-separated
list of URIs to try in sequence.
BIND_DN:
The distinguished name to use when binding to the LDAP server (with `BIND_AUTH`).
Use the empty string (the default) for an anonymous bind.
BIND_AUTH
The password to use with `BIND_DN`
USER_SEARCH
An dict that will locate a user in the directory.
The dict object may contain `base` (required), `filter` (required) and `scope` (optional)
* base: The base DN to search
* filter: Should contain the placeholder `%(username)s` for the username.
* scope: TODO: document
e.g.:
{'base': 'dc=continuum,dc=io', 'filter': 'uid=%(username)s'}
KEY_MAP:
This is a dict mapping application context to ldap.
An application may expect user data to be consistant and not all ldap
setups use the same configuration:
'application_key': 'ldap_key'
For example:
KEY_MAP={'name':'cn', 'company': 'o', 'email': 'mail'}
START_TLS
If `True`, each connection to the LDAP server will call `start_tls_s()`
to enable TLS encryption over the standard LDAP port.
There are a number of configuration options that can be given to `OPTIONS` that affect the TLS connection.
For example, `<API key>` can be set to `OPT_X_TLS_NEVER` to disable certificate verification,
perhaps to allow self-signed certificates.
OPTIONS
This stores ldap specific options eg:
LDAP={ 'OPTIONS': { '<API key>': 3,
'<API key>': 'OPT_X_TLS_NEVER'
}
}
## TLS (secure LDAP)
To enable a secure TLS connection you must set `START_TLS` to True.
There are a number of configuration options that can be given to `OPTIONS` that affect the TLS connection.
For example, `<API key>` `OPT_X_TLS_NEVER` to disable certificate verification, perhaps to allow self-signed certificates.
LDAP={ 'START_TLS': True,
'OPTIONS': { '<API key>': 3,
'OPT_X_TLS_DEMAND', True,
'<API key>': 'OPT_X_TLS_NEVER',
'<API key>', '/path/to/certfile')
}
} |
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "5feda4ca9935"
down_revision = "9d9af47e64c8"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"<API key>",
sa.Column("time", sa.BigInteger(), nullable=False),
sa.Column("obsid_start", sa.BigInteger(), nullable=False),
sa.Column("task_name", sa.Text(), nullable=False),
sa.Column(
"event",
sa.Enum(
"started", "finished", "error", name="<API key>"
),
nullable=False,
),
sa.<API key>(
["obsid_start"],
["hera_obs.obsid"],
),
sa.<API key>("time", "obsid_start", "task_name"),
)
def downgrade():
op.drop_table("<API key>") |
#include <cstdarg>
#include <cstdio>
namespace llamaos {
int trace (const char *format, ...)
{
// prep variable arguments
va_list arg;
va_start (arg, format);
// copy formatted output to buffer
char buffer [256] = { '\0' };
int count = vsnprintf (buffer, sizeof(buffer)-1, format, arg);
// term variable arguments
va_end (arg);
// write buffer to system output/log
// return the number characters written
return count;
}
} |
// <API key>.h
// CommonMark
#import <Foundation/Foundation.h>
@interface <API key> : NSObject
- (id)copy NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)alloc NS_UNAVAILABLE;
+ (instancetype)allocWithZone:(struct _NSZone *)zone NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
@end |
#include <sophia.h>
#include <libss.h>
#include <libsf.h>
#include <libsr.h>
#include <libsv.h>
#include <libsd.h>
#include <libst.h>
static void
durability_deploy0(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_setint(env, "debug.error_injection.si_recover_0", 1) == 0 );
t( sp_open(env) == -1 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 1 );
/* recover */
env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == -1 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 ); /* reuse empty directory */
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
}
static void
durability_branch0(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
int key = 7;
void *o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
key = 8;
o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
key = 9;
o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
t( sp_setint(env, "debug.error_injection.si_branch_0", 1) == 0 );
t( sp_setint(env, "db.test.branch", 0) == -1 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
/* recover */
env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
o = sp_document(db);
t( o != NULL );
t( sp_setstring(o, "order", ">=", 0) == 0 );
void *c = sp_cursor(env);
t( c != NULL );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 7 );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 8 );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 9 );
o = sp_get(c, o);
t( o == NULL );
t( sp_destroy(c) == 0 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
}
static void
durability_build0(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
int key = 7;
void *o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
key = 8;
o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
key = 9;
o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
t( sp_setint(env, "debug.error_injection.sd_build_0", 1) == 0 );
t( sp_setint(env, "db.test.branch", 0) == -1 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
/* recover */
env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
o = sp_document(db);
t( sp_setstring(o, "order", ">=", 0) == 0 );
void *c = sp_cursor(env);
t( c != NULL );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 7 );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 8 );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 9 );
o = sp_get(c, o);
t( o == NULL );
t( sp_destroy(c) == 0 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
}
static void
durability_build1(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
int key = 7;
void *o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
key = 8;
o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
key = 9;
o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
t( sp_setint(env, "debug.error_injection.sd_build_1", 1) == 0 );
t( sp_setint(env, "db.test.branch", 0) == 0 ); /* seal crc is corrupted */
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
/* recover */
env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
o = sp_document(db);
t( sp_setstring(o, "order", ">=", 0) == 0 );
void *c = sp_cursor(env);
t( c != NULL );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 7 );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 8 );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 9 );
o = sp_get(c, o);
t( o == NULL );
t( sp_destroy(c) == 0 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
}
static void
durability_compact0(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
int key = 7;
void *o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
key = 8;
o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
key = 9;
o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
t( sp_setint(env, "debug.error_injection.si_compaction_0", 1) == 0 );
t( sp_setint(env, "db.test.branch", 0) == 0 );
t( sp_setint(env, "db.test.compact", 0) == -1 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 1 );
/* recover */
env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
o = sp_document(db);
t( sp_setstring(o, "order", ">=", 0) == 0 );
void *c = sp_cursor(env);
t( c != NULL );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 7 );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 8 );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 9 );
o = sp_get(c, o);
t( o == NULL );
t( sp_destroy(c) == 0 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
}
static void
durability_compact1(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
int key = 7;
void *o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
key = 8;
o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
key = 9;
o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
t( sp_setint(env, "debug.error_injection.si_compaction_1", 1) == 0 );
t( sp_setint(env, "db.test.branch", 0) == 0 );
t( sp_setint(env, "db.test.compact", 0) == -1 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 1 );
/* recover */
env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
o = sp_document(db);
t( sp_setstring(o, "order", ">=", 0) == 0 );
void *c = sp_cursor(env);
t( c != NULL );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 7 );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 8 );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 9 );
o = sp_get(c, o);
t( o == NULL );
t( sp_destroy(c) == 0 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
}
static void
durability_compact2(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
int key = 7;
void *o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
key = 8;
o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
key = 9;
o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
t( sp_setint(env, "debug.error_injection.si_compaction_2", 1) == 0 );
t( sp_setint(env, "db.test.branch", 0) == 0 );
t( sp_setint(env, "db.test.compact", 0) == -1 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 1 );
/* recover */
env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
o = sp_document(db);
t( sp_setstring(o, "order", ">=", 0) == 0 );
void *c = sp_cursor(env);
t( c != NULL );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 7 );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 8 );
o = sp_get(c, o);
t( o != NULL );
t( *(int*)sp_getstring(o, "key", NULL) == 9 );
o = sp_get(c, o);
t( o == NULL );
t( sp_destroy(c) == 0 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
}
static void
durability_compact3(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setint(env, "db.test.node_size", 60) == 0 );
t( sp_setint(env, "db.test.page_size", 60) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
int i = 0;
while (i < 20) {
void *o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &i, sizeof(i)) == 0 );
t( sp_set(db, o) == 0 );
i++;
}
t( sp_setint(env, "debug.error_injection.si_compaction_0", 1) == 0 );
t( sp_setint(env, "db.test.branch", 0) == 0 );
t( sp_setint(env, "db.test.compact", 0) == -1 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 0 );
/* recover */
env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
void *o = sp_document(db);
t( sp_setstring(o, "order", ">=", 0) == 0 );
void *c = sp_cursor(env);
t( c != NULL );
i = 0;
while ((o = sp_get(c, o))) {
t( *(int*)sp_getstring(o, "key", NULL) == i );
i++;
}
t( sp_destroy(c) == 0 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 0 );
}
static void
durability_compact4(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setint(env, "db.test.node_size", 45) == 0 );
t( sp_setint(env, "db.test.page_size", 45) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
int i = 0;
while (i < 20) {
void *o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &i, sizeof(i)) == 0 );
t( sp_set(db, o) == 0 );
i++;
}
t( sp_setint(env, "debug.error_injection.si_compaction_1", 1) == 0 );
t( sp_setint(env, "db.test.branch", 0) == 0 );
t( sp_setint(env, "db.test.compact", 0) == -1 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 1 );
/* recover */
env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
void *o = sp_document(db);
t( sp_setstring(o, "order", ">=", 0) == 0 );
void *c = sp_cursor(env);
t( c != NULL );
i = 0;
while ((o = sp_get(c, o))) {
t( *(int*)sp_getstring(o, "key", NULL) == i );
i++;
}
t( sp_destroy(c) == 0 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
}
static void
durability_compact5(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setint(env, "db.test.node_size", 45) == 0 );
t( sp_setint(env, "db.test.page_size", 45) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
int i = 0;
while (i < 20) {
void *o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &i, sizeof(i)) == 0 );
t( sp_set(db, o) == 0 );
i++;
}
t( sp_setint(env, "debug.error_injection.si_compaction_2", 1) == 0 );
t( sp_setint(env, "db.test.branch", 0) == 0 );
t( sp_setint(env, "db.test.compact", 0) == -1 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 1 );
/* recover */
env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
void *o = sp_document(db);
t( sp_setstring(o, "order", ">=", 0) == 0 );
void *c = sp_cursor(env);
t( c != NULL );
i = 0;
while ((o = sp_get(c, o))) {
t( *(int*)sp_getstring(o, "key", NULL) == i );
i++;
}
t( sp_destroy(c) == 0 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
}
static void
durability_compact6(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setint(env, "db.test.node_size", 45) == 0 );
t( sp_setint(env, "db.test.page_size", 45) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
int i = 0;
while (i < 20) {
void *o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &i, sizeof(i)) == 0 );
t( sp_set(db, o) == 0 );
i++;
}
t( sp_setint(env, "debug.error_injection.si_compaction_3", 1) == 0 );
t( sp_setint(env, "db.test.branch", 0) == 0 );
t( sp_setint(env, "db.test.compact", 0) == -1 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 0 );
/* recover */
env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
void *o = sp_document(db);
t( sp_setstring(o, "order", ">=", 0) == 0 );
void *c = sp_cursor(env);
t( c != NULL );
i = 0;
while ((o = sp_get(c, o))) {
t( *(int*)sp_getstring(o, "key", NULL) == i );
i++;
}
t( sp_destroy(c) == 0 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 0 );
}
static void
durability_compact7(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setint(env, "db.test.node_size", 45) == 0 );
t( sp_setint(env, "db.test.page_size", 45) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
int i = 0;
while (i < 20) {
void *o = sp_document(db);
t( o != 0 );
t( sp_setstring(o, "key", &i, sizeof(i)) == 0 );
t( sp_set(db, o) == 0 );
i++;
}
t( sp_setint(env, "debug.error_injection.si_compaction_4", 1) == 0 );
t( sp_setint(env, "db.test.branch", 0) == 0 );
t( sp_setint(env, "db.test.compact", 0) == -1 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 1 );
/* recover */
env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
void *o = sp_document(db);
t( sp_setstring(o, "order", ">=", 0) == 0 );
void *c = sp_cursor(env);
t( c != NULL );
i = 0;
while ((o = sp_get(c, o))) {
t( *(int*)sp_getstring(o, "key", NULL) == i );
i++;
}
t( sp_destroy(c) == 0 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.<API key>.db.seal") == 0 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
t( exists(st_r.conf->db_dir, "<API key>.db") == 1 );
}
static void
<API key>(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
t( sp_setint(env, "debug.error_injection.si_snapshot_0", 1) == 0 );
t( sp_setint(env, "scheduler.snapshot", 0) == 0 );
t( sp_setint(env, "scheduler.run", 0) == -1 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "index.incomplete") == 1 );
t( exists(st_r.conf->db_dir, "index") == 0 );
/* recover */
env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "index.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "index") == 0 );
}
static void
<API key>(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
t( sp_setint(env, "debug.error_injection.si_snapshot_1", 1) == 0 );
t( sp_setint(env, "scheduler.snapshot", 0) == 0 );
t( sp_setint(env, "scheduler.run", 0) == -1 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "index.incomplete") == 1 );
t( exists(st_r.conf->db_dir, "index") == 0 );
/* recover */
env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "index.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "index") == 0 );
}
static void
<API key>(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
t( sp_setint(env, "debug.error_injection.si_snapshot_2", 1) == 0 );
t( sp_setint(env, "scheduler.snapshot", 0) == 0 );
t( sp_setint(env, "scheduler.run", 0) == -1 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "index.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "index") == 1 );
/* recover */
env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
t( sp_destroy(env) == 0 );
t( exists(st_r.conf->db_dir, "index.incomplete") == 0 );
t( exists(st_r.conf->db_dir, "index") == 1 );
}
stgroup *durability_group(void)
{
stgroup *group = st_group("durability");
st_groupadd(group, st_test("deploy_case0", durability_deploy0));
st_groupadd(group, st_test("branch_case0", durability_branch0));
st_groupadd(group, st_test("build_case0", durability_build0));
st_groupadd(group, st_test("build_case1", durability_build1));
st_groupadd(group, st_test("compact_case0", durability_compact0));
st_groupadd(group, st_test("compact_case1", durability_compact1));
st_groupadd(group, st_test("compact_case2", durability_compact2));
st_groupadd(group, st_test("compact_case3", durability_compact3));
st_groupadd(group, st_test("compact_case4", durability_compact4));
st_groupadd(group, st_test("compact_case5", durability_compact5));
st_groupadd(group, st_test("compact_case6", durability_compact6));
st_groupadd(group, st_test("compact_case7", durability_compact7));
st_groupadd(group, st_test("snapshot_case0", <API key>));
st_groupadd(group, st_test("snapshot_case1", <API key>));
st_groupadd(group, st_test("snapshot_case2", <API key>));
return group;
} |
#include <iostream>
#include <string>
#include <vector>
using namespace std;
struct base{};
struct deriv:base{};
void f(base&& x)
{
cout << "f(base&&)" << endl;
}
void f(int&& x)
{
cout << "f(int&&)" << endl;
}
void f(const base&& x)
{
cout << "f(const base&&)" << endl;
}
void f(base& x)
{
cout << "f(base&)" << endl;
}
void f(int& x)
{
cout << "f(int&)" << endl;
}
void f(const base& x)
{
cout << "f(const base&)" << endl;
}
deriv g()
{
return deriv();
}
const deriv h()
{
return deriv();
}
template<typename T>void f1(T&& x)
{
f((T&&)x);
}
int main()
{
deriv a;
const deriv b;
cout << "original:" << endl;
f(g());
f(h());
f(a);
f(b);
cout << "forward:" << endl;
f1(g());
f1(h());
f1(a);
f1(b);
cout << "for class:" << endl;
deriv c[2];
for(auto x:c){
f(x);
}
cout << "for int:" << endl;
int d[2];
for(auto x:d){
f(x);
}
cout << "for int&&:" << endl;
for(auto x:[](){return vector<int>({1});}()){
f(x);
}
return 0;
} |
class Ffmpeg < Formula
desc "Play, record, convert, and stream audio and video"
homepage "https://ffmpeg.org/"
url "https://ffmpeg.org/releases/ffmpeg-2.7.1.tar.bz2"
sha256 "<SHA256-like>"
head "https://github.com/FFmpeg/FFmpeg.git"
bottle do
sha256 "<SHA256-like>" => :yosemite
sha256 "<SHA256-like>" => :mavericks
sha256 "<SHA256-like>" => :mountain_lion
end
option "without-x264", "Disable H.264 encoder"
option "without-lame", "Disable MP3 encoder"
option "<API key>", "Disable VisualOn AAC encoder"
option "without-xvid", "Disable Xvid MPEG-4 video encoder"
option "without-qtkit", "Disable deprecated QuickTime framework"
option "with-rtmpdump", "Enable RTMP protocol"
option "with-libass", "Enable ASS/SSA subtitle format"
option "with-opencore-amr", "Enable Opencore AMR NR/WB audio format"
option "with-openjpeg", "Enable JPEG 2000 image format"
option "with-openssl", "Enable SSL support"
option "with-libssh", "Enable SFTP protocol via libssh"
option "with-schroedinger", "Enable Dirac video format"
option "with-ffplay", "Enable FFplay media player"
option "with-tools", "Enable additional FFmpeg tools"
option "with-fdk-aac", "Enable the Fraunhofer FDK AAC library"
option "with-libvidstab", "Enable vid.stab support for video stabilization"
option "with-x265", "Enable x265 encoder"
option "with-libsoxr", "Enable the soxr resample library"
option "with-webp", "Enable using libwebp to encode WEBP images"
option "with-zeromq", "Enable using libzeromq to receive commands sent through a libzeromq client"
depends_on "pkg-config" => :build
# manpages won't be built without texi2html
depends_on "texi2html" => :build
depends_on "yasm" => :build
depends_on "x264" => :recommended
depends_on "lame" => :recommended
depends_on "libvo-aacenc" => :recommended
depends_on "xvid" => :recommended
depends_on "faac" => :optional
depends_on "fontconfig" => :optional
depends_on "freetype" => :optional
depends_on "theora" => :optional
depends_on "libvorbis" => :optional
depends_on "libvpx" => :optional
depends_on "rtmpdump" => :optional
depends_on "opencore-amr" => :optional
depends_on "libass" => :optional
depends_on "openjpeg" => :optional
depends_on "sdl" if build.with? "ffplay"
depends_on "speex" => :optional
depends_on "schroedinger" => :optional
depends_on "fdk-aac" => :optional
depends_on "opus" => :optional
depends_on "frei0r" => :optional
depends_on "libcaca" => :optional
depends_on "libbluray" => :optional
depends_on "libsoxr" => :optional
depends_on "libquvi" => :optional
depends_on "libvidstab" => :optional
depends_on "x265" => :optional
depends_on "openssl" => :optional
depends_on "libssh" => :optional
depends_on "webp" => :optional
depends_on "zeromq" => :optional
def install
args = ["--prefix=#{prefix}",
"--enable-shared",
"--enable-pthreads",
"--enable-gpl",
"--enable-version3",
"--<API key>",
"--enable-avresample",
"--cc=#{ENV.cc}",
"--host-cflags=#{ENV.cflags}",
"--host-ldflags=#{ENV.ldflags}",
]
args << "--enable-libx264" if build.with? "x264"
args << "--enable-libmp3lame" if build.with? "lame"
args << "--enable-libvo-aacenc" if build.with? "libvo-aacenc"
args << "--enable-libxvid" if build.with? "xvid"
args << "--<API key>" if build.with? "fontconfig"
args << "--enable-libfreetype" if build.with? "freetype"
args << "--enable-libtheora" if build.with? "theora"
args << "--enable-libvorbis" if build.with? "libvorbis"
args << "--enable-libvpx" if build.with? "libvpx"
args << "--enable-librtmp" if build.with? "rtmpdump"
args << "--<API key>" << "--<API key>" if build.with? "opencore-amr"
args << "--enable-libfaac" if build.with? "faac"
args << "--enable-libass" if build.with? "libass"
args << "--enable-ffplay" if build.with? "ffplay"
args << "--enable-libssh" if build.with? "libssh"
args << "--enable-libspeex" if build.with? "speex"
args << "--<API key>" if build.with? "schroedinger"
args << "--enable-libfdk-aac" if build.with? "fdk-aac"
args << "--enable-openssl" if build.with? "openssl"
args << "--enable-libopus" if build.with? "opus"
args << "--enable-frei0r" if build.with? "frei0r"
args << "--enable-libcaca" if build.with? "libcaca"
args << "--enable-libsoxr" if build.with? "libsoxr"
args << "--enable-libquvi" if build.with? "libquvi"
args << "--enable-libvidstab" if build.with? "libvidstab"
args << "--enable-libx265" if build.with? "x265"
args << "--enable-libwebp" if build.with? "webp"
args << "--enable-libzmq" if build.with? "zeromq"
args << "--disable-indev=qtkit" if build.without? "qtkit"
if build.with? "openjpeg"
args << "--enable-libopenjpeg"
args << "--disable-decoder=jpeg2000"
args << "--extra-cflags=" + `pkg-config --cflags libopenjpeg`.chomp
end
# These librares are GPL-incompatible, and require ffmpeg be built with
# the "--enable-nonfree" flag, which produces unredistributable libraries
if %w[faac fdk-aac openssl].any? { |f| build.with? f }
args << "--enable-nonfree"
end
# A bug in a dispatch header on 10.10, included via CoreFoundation,
# prevents GCC from building VDA support. GCC has no problems on
# 10.9 and earlier.
if MacOS.version < :yosemite || ENV.compiler == :clang
args << "--enable-vda"
else
args << "--disable-vda"
end
# For 32-bit compilation under gcc 4.2, see:
ENV.append_to_cflags "-mdynamic-no-pic" if Hardware.is_32_bit? && Hardware::CPU.intel? && ENV.compiler == :clang
ENV["GIT_DIR"] = cached_download/".git" if build.head?
if MacOS.version < :mountain_lion
system "perl", *["-pi", "-e", "s/-framework CoreGraphics/-framework ApplicationServices/", "configure"]
end
system "./configure", *args
if MacOS.prefer_64_bit?
inreplace "config.mak" do |s|
shflags = s.get_make_var "SHFLAGS"
if shflags.gsub!(" -Wl,-read_only_relocs,suppress", "")
s.change_make_var! "SHFLAGS", shflags
end
end
end
system "make", "install"
if build.with? "tools"
system "make", "alltools" |
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs for page Events.php</title>
<link rel="stylesheet" href="../../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
</head>
<body>
<div class="page-body">
<h2 class="file-name">/Handlers/Events.php</h2>
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> | <a href="#sec-classes">Classes</a>
</div>
<div class="info-box-body">
<ul class="tags">
<li><span class="field">author:</span> Marlin Cremers <<a
href="mailto:marlinc@mms-projects.net">marlinc@mms-projects.net</a>></li>
</ul>
</div>
</div>
<a name="sec-classes"></a>
<div class="info-box">
<div class="info-box-title">Classes</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> | <span class="disabled">Classes</span>
</div>
<div class="info-box-body">
<table cellpadding="2" cellspacing="0" class="class-table">
<tr>
<th class="class-table-header">Class</th>
<th class="class-table-header">Description</th>
</tr>
<tr>
<td style="padding-right: 2em; vertical-align: top"><a
href="../../IRCBot_Handlers/Events/<API key>.html"><API key></a>
</td>
<td>The IRCBot event handler</td>
</tr>
</table>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Wed, 04 Jan 2012 16:59:21 +0100 by <a
href="http:
</p>
</div>
</body>
</html> |
#ifdef GCCSTATIC
#define PREBOOT
/* Pre-boot environment: included */
/* prevent inclusion of _LINUX_KERNEL_H in pre-boot environment: lots
* errors about console_printk etc... on ARM */
#define _LINUX_KERNEL_H
#include "zlib_inflate/inftrees.c"
#include "zlib_inflate/inffast.c"
#include "zlib_inflate/inflate.c"
#else /* GCCSTATIC */
/* initramfs et al: linked */
#include <linux/zutil.h>
#include "zlib_inflate/inftrees.h"
#include "zlib_inflate/inffast.h"
#include "zlib_inflate/inflate.h"
#include "zlib_inflate/infutil.h"
#include <linux/decompress/inflate.h>
#endif /* GCCSTATIC */
#include <linux/decompress/mm.h>
#define GZIP_IOBUF_SIZE (16*1024)
static long INIT nofill(void *buffer, unsigned long len)
{
return -1;
}
/* Included from initramfs et al code */
GCCSTATIC int INIT __gunzip(unsigned char *buf, long len,
long (*fill)(void*, unsigned long),
long (*flush)(void*, unsigned long),
unsigned char *out_buf, long out_len,
long *pos,
void(*error)(char *x)) {
u8 *zbuf;
struct z_stream_s *strm;
int rc;
rc = -1;
if (flush) {
out_len = 0x8000; /* 32 K */
out_buf = malloc(out_len);
} else {
if (!out_len)
out_len = ((size_t)~0) - (size_t)out_buf; /* no limit */
}
if (!out_buf) {
error("Out of memory while allocating output buffer");
goto gunzip_nomem1;
}
if (buf)
zbuf = buf;
else {
zbuf = malloc(GZIP_IOBUF_SIZE);
len = 0;
}
if (!zbuf) {
error("Out of memory while allocating input buffer");
goto gunzip_nomem2;
}
strm = malloc(sizeof(*strm));
if (strm == NULL) {
error("Out of memory while allocating z_stream");
goto gunzip_nomem3;
}
strm->workspace = malloc(flush ? <API key>() :
sizeof(struct inflate_state));
if (strm->workspace == NULL) {
error("Out of memory while allocating workspace");
goto gunzip_nomem4;
}
if (!fill)
fill = nofill;
if (len == 0)
len = fill(zbuf, GZIP_IOBUF_SIZE);
/* verify the gzip header */
if (len < 10 ||
zbuf[0] != 0x1f || zbuf[1] != 0x8b || zbuf[2] != 0x08) {
if (pos)
*pos = 0;
error("Not a gzip file");
goto gunzip_5;
}
/* skip over gzip header (1f,8b,08... 10 bytes total +
* possible asciz filename)
*/
strm->next_in = zbuf + 10;
strm->avail_in = len - 10;
/* skip over asciz filename */
if (zbuf[3] & 0x8) {
do {
/*
* If the filename doesn't fit into the buffer,
* the file is very probably corrupt. Don't try
* to read more data.
*/
if (strm->avail_in == 0) {
error("header error");
goto gunzip_5;
}
--strm->avail_in;
} while (*strm->next_in++);
}
strm->next_out = out_buf;
strm->avail_out = out_len;
rc = zlib_inflateInit2(strm, -MAX_WBITS);
if (!flush) {
WS(strm)->inflate_state.wsize = 0;
WS(strm)->inflate_state.window = NULL;
}
while (rc == Z_OK) {
if (strm->avail_in == 0) {
/* TODO: handle case where both pos and fill are set */
len = fill(zbuf, GZIP_IOBUF_SIZE);
if (len < 0) {
rc = -1;
error("read error");
break;
}
strm->next_in = zbuf;
strm->avail_in = len;
}
rc = zlib_inflate(strm, 0);
/* Write any data generated */
if (flush && strm->next_out > out_buf) {
long l = strm->next_out - out_buf;
if (l != flush(out_buf, l)) {
rc = -1;
error("write error");
break;
}
strm->next_out = out_buf;
strm->avail_out = out_len;
}
/* after Z_FINISH, only Z_STREAM_END is "we unpacked it all" */
if (rc == Z_STREAM_END) {
rc = 0;
break;
} else if (rc != Z_OK) {
error("uncompression error");
rc = -1;
}
}
zlib_inflateEnd(strm);
if (pos)
/* add + 8 to skip over trailer */
*pos = strm->next_in - zbuf+8;
gunzip_5:
free(strm->workspace);
gunzip_nomem4:
free(strm);
gunzip_nomem3:
if (!buf)
free(zbuf);
gunzip_nomem2:
if (flush)
free(out_buf);
gunzip_nomem1:
return rc; /* returns Z_OK (0) if successful */
}
#ifndef PREBOOT
GCCSTATIC int INIT gunzip(unsigned char *buf, long len,
long (*fill)(void*, unsigned long),
long (*flush)(void*, unsigned long),
unsigned char *out_buf,
long *pos,
void (*error)(char *x))
{
return __gunzip(buf, len, fill, flush, out_buf, 0, pos, error);
}
#else
GCCSTATIC int INIT __decompress(unsigned char *buf, long len,
long (*fill)(void*, unsigned long),
long (*flush)(void*, unsigned long),
unsigned char *out_buf, long out_len,
long *pos,
void (*error)(char *x))
{
return __gunzip(buf, len, fill, flush, out_buf, out_len, pos, error);
}
#endif |
class Bear < Formula
desc "Generate compilation database for clang tooling"
homepage "https://github.com/rizsotto/Bear"
url "https://github.com/rizsotto/Bear/archive/2.3.8.tar.gz"
sha256 "<SHA256-like>"
head "https://github.com/rizsotto/Bear.git"
bottle do
cellar :any
sha256 "<SHA256-like>" => :high_sierra
sha256 "<SHA256-like>" => :sierra
sha256 "<SHA256-like>" => :el_capitan
end
depends_on :python if MacOS.version <= :snow_leopard
depends_on "cmake" => :build
def install
system "cmake", ".", *std_cmake_args
system "make", "install"
end
test do
system "#{bin}/bear", "true"
assert_predicate testpath/"compile_commands.json", :exist?
end
end |
using System.Collections.Generic;
using MatterControl.Printing;
using MatterHackers.Agg;
using MatterHackers.Agg.Platform;
using MatterHackers.MatterControl;
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.MatterControl.Tests.Automation;
using MatterHackers.VectorMath;
using NUnit.Framework;
namespace MatterControl.Tests.MatterControl
{
[TestFixture]
public class LevelingTests
{
[Test, Category("Leveling")]
public void <API key>()
{
StaticData.RootPath = TestContext.CurrentContext.ResolveProjectPath(4, "StaticData");
<API key>.<API key>(TestContext.CurrentContext.ResolveProjectPath(4));
var printerSettings = new PrinterSettings();
printerSettings.SetValue(SettingsKey.probe_offset, "0,0,0");
var printer = new PrinterConfig(printerSettings);
// a 2 x 2 mesh that goes form 0 on the left to 10 on the right
{
var levelingData = new PrintLevelingData();
// put them in left to right - bottom to top
levelingData.SampledPositions = new List<Vector3>();
levelingData.SampledPositions.Add(new Vector3(0, 0, 0));
levelingData.SampledPositions.Add(new Vector3(10, 0, 10));
levelingData.SampledPositions.Add(new Vector3(0, 10, 0));
levelingData.SampledPositions.Add(new Vector3(10, 10, 10));
LevelingFunctions <API key> = new LevelingFunctions(printer, levelingData);
// check on points
<API key>(new Vector3(0, 0, 0), new Vector3(0, 0, 0), <API key>);
<API key>(new Vector3(10, 0, 0), new Vector3(10, 0, 10), <API key>);
<API key>(new Vector3(10, 10, 0), new Vector3(10, 10, 10), <API key>);
<API key>(new Vector3(0, 10, 0), new Vector3(0, 10, 0), <API key>);
// check raised on points
<API key>(new Vector3(0, 0, 5), new Vector3(0, 0, 5), <API key>);
<API key>(new Vector3(10, 0, 5), new Vector3(10, 0, 15), <API key>);
<API key>(new Vector3(10, 10, 5), new Vector3(10, 10, 15), <API key>);
<API key>(new Vector3(0, 10, 5), new Vector3(0, 10, 5), <API key>);
// check between points
<API key>(new Vector3(5, 0, 0), new Vector3(5, 0, 5), <API key>);
<API key>(new Vector3(5, 0, 5), new Vector3(5, 0, 10), <API key>);
// check outside points
<API key>(new Vector3(-5, 0, 0), new Vector3(-5, 0, -5), <API key>);
<API key>(new Vector3(-5, 0, 5), new Vector3(-5, 0, 0), <API key>);
<API key>(new Vector3(15, 0, 0), new Vector3(15, 0, 15), <API key>);
<API key>(new Vector3(15, 0, 5), new Vector3(15, 0, 20), <API key>);
}
// a 3 x 3 mesh that goes form 0 on the left to 10 on the right
{
var levelingData = new PrintLevelingData();
// put them in left to right - bottom to top
levelingData.SampledPositions = new List<Vector3>();
levelingData.SampledPositions.Add(new Vector3(0, 0, 0));
levelingData.SampledPositions.Add(new Vector3(5, 0, 5));
levelingData.SampledPositions.Add(new Vector3(10, 0, 10));
levelingData.SampledPositions.Add(new Vector3(0, 5, 0));
levelingData.SampledPositions.Add(new Vector3(5, 5, 5));
levelingData.SampledPositions.Add(new Vector3(10, 5, 10));
levelingData.SampledPositions.Add(new Vector3(0, 10, 0));
levelingData.SampledPositions.Add(new Vector3(5, 10, 5));
levelingData.SampledPositions.Add(new Vector3(10, 10, 10));
LevelingFunctions <API key> = new LevelingFunctions(printer, levelingData);
// check on points
<API key>(new Vector3(0, 0, 0), new Vector3(0, 0, 0), <API key>);
<API key>(new Vector3(10, 0, 0), new Vector3(10, 0, 10), <API key>);
<API key>(new Vector3(10, 10, 0), new Vector3(10, 10, 10), <API key>);
<API key>(new Vector3(0, 10, 0), new Vector3(0, 10, 0), <API key>);
// check raised on points
<API key>(new Vector3(0, 0, 5), new Vector3(0, 0, 5), <API key>);
<API key>(new Vector3(10, 0, 5), new Vector3(10, 0, 15), <API key>);
<API key>(new Vector3(10, 10, 5), new Vector3(10, 10, 15), <API key>);
<API key>(new Vector3(0, 10, 5), new Vector3(0, 10, 5), <API key>);
// check between points
<API key>(new Vector3(5, 0, 0), new Vector3(5, 0, 5), <API key>);
<API key>(new Vector3(5, 0, 5), new Vector3(5, 0, 10), <API key>);
// check outside points
<API key>(new Vector3(-5, 0, 0), new Vector3(-5, 0, -5), <API key>);
<API key>(new Vector3(-5, 0, 5), new Vector3(-5, 0, 0), <API key>);
<API key>(new Vector3(15, 0, 0), new Vector3(15, 0, 15), <API key>);
<API key>(new Vector3(15, 0, 5), new Vector3(15, 0, 20), <API key>);
}
}
void <API key>(Vector3 testUnleveled, Vector3 controlLeveled, LevelingFunctions levelingFunctions)
{
Vector3 testLeveled = levelingFunctions.<API key>(testUnleveled);
Assert.AreEqual(testLeveled.X, testUnleveled.X, .001, "We don't adjust the x or y on mesh leveling");
Assert.AreEqual(testLeveled.X, controlLeveled.X, .001, "We don't adjust the x or y on mesh leveling");
Assert.AreEqual(testLeveled.Y, testUnleveled.Y, .001, "We don't adjust the x or y on mesh leveling");
Assert.AreEqual(testLeveled.Y, controlLeveled.Y, .001, "We don't adjust the x or y on mesh leveling");
Assert.AreEqual(testLeveled.Z, controlLeveled.Z, .001);
string outPositionString = levelingFunctions.ApplyLeveling(GetGCodeString(testUnleveled), testUnleveled);
Assert.AreEqual(GetGCodeString(testLeveled), outPositionString);
}
private string GetGCodeString(Vector3 destPosition)
{
return "G1 X{0:0.
}
}
} |
cask 'font-noto-sans-cham' do
version :latest
sha256 :no_check
# noto-website.storage.googleapis.com was verified as official when first introduced to the cask
url 'https://noto-website.storage.googleapis.com/pkgs/<API key>.zip'
name 'Noto Sans Cham'
homepage 'https://www.google.com/get/noto/#sans-cham'
font 'NotoSansCham-Bold.ttf'
font '<API key>.ttf'
end |
class X265 < Formula
desc "H.265/HEVC encoder"
homepage "http://x265.org"
url "https://bitbucket.org/multicoreware/x265/downloads/x265_1.9.tar.gz"
mirror "https://mirrors.kernel.org/debian/pool/main/x/x265/x265_1.9.orig.tar.gz"
sha256 "<SHA256-like>"
head "https://bitbucket.org/multicoreware/x265", :using => :hg
bottle do
cellar :any
sha256 "<SHA256-like>" => :el_capitan
sha256 "<SHA256-like>" => :yosemite
sha256 "<SHA256-like>" => :mavericks
end
option "with-16-bit", "Build a 16-bit x265 (default: 8-bit)"
deprecated_option "16-bit" => "with-16-bit"
depends_on "yasm" => :build
depends_on "cmake" => :build
depends_on :macos => :lion
depends_on 'ninja' => :build
def install
args = std_cmake_args
args << '-G' << 'Ninja'
args << "-DHIGH_BIT_DEPTH=ON" if build.with? "16-bit"
system "cmake", "source", *args
system "ninja", "install"
end
test do
yuv_path = testpath/"raw.yuv"
x265_path = testpath/"x265.265"
yuv_path.binwrite "\xCO\xFF\xEE" * 3200
system bin/"x265", "--input-res", "80x80", "--fps", "1", yuv_path, x265_path
header = "AAAAAUABDAH
assert_equal header.unpack("m"), [x265_path.read(10)]
end
end |
#include "Common.hpp"
#include <limits.h>
#include "ALUNIXAcoustic.hpp"
#include "Speaker.hpp"
#include "resource/loader/ALSndLoader.hpp"
using namespace reprize;
using namespace res;
using namespace aud;
using namespace std;
ALSndLoader sndloader(NULL);
ALUNIXAcoustic::ALUNIXAcoustic(EnvDepInfo* depinfo_)
: Acoustic(depinfo_)
{
}
ALUNIXAcoustic::~ALUNIXAcoustic(void)
{
ALCcontext* pContext;
ALCdevice* pDevice;
pContext = <API key>();
pDevice = <API key>(pContext);
<API key>(NULL);
alcDestroyContext(pContext);
alcCloseDevice(pDevice);
}
const bool ALUNIXAcoustic::init(void)
{
// ALDeviceList* pDeviceList = NULL;
ALCcontext* pContext = NULL;
ALCdevice* pDevice = NULL;
Int32 i;
bool bReturn = false;
// pDeviceList = new ALDeviceList();
<API key>();
if (//(pDeviceList) &&
(GetNumDevices()))
{
// ALFWprintf("\nSelect OpenAL Device:\n");
// for (i = 0; i < GetNumDevices(); i++)
// ALFWprintf("%d. %s%s\n", i + 1, GetDeviceName(i),
// i == GetDefaultDevice() ? "(DEFAULT)" : "");
// Char ch = _getch();
// i = atoi(&ch);
// while ((i < 1) || (i > GetNumDevices()));
pDevice = alcOpenDevice(GetDeviceName(0));
// pDevice = alcOpenDevice(GetDeviceName(i - 1));
if (pDevice)
{
pContext = alcCreateContext(pDevice, NULL);
if (pContext)
{
std::cerr << "Opened "
<< alcGetString(pDevice, <API key>)
<< "Device\n" << std::endl;
<API key>(pContext);
bReturn = true;
}
else { alcCloseDevice(pDevice); }
}
ALDeviceListDestroy();
}
return bReturn;
/*
ALDeviceList* pDeviceList = NULL;
ALCcontext* pContext = NULL;
ALCdevice* pDevice = NULL;
ALint i;
ALboolean bReturn = AL_FALSE;
pDeviceList = new ALDeviceList();
if ((pDeviceList) && (pDeviceList->GetNumDevices()))
{
ALFWprintf("\nSelect OpenAL Device:\n");
for (i = 0; i < pDeviceList->GetNumDevices(); i++)
ALFWprintf("%d. %s%s\n", i + 1, pDeviceList->GetDeviceName(i), i == pDeviceList->GetDefaultDevice() ? "(DEFAULT)" : "");
do {
ALchar ch = _getch();
i = atoi(&ch);
} while ((i < 1) || (i > pDeviceList->GetNumDevices()));
pDevice = alcOpenDevice(pDeviceList->GetDeviceName(i - 1));
if (pDevice)
{
pContext = alcCreateContext(pDevice, NULL);
if (pContext)
{
ALFWprintf("\nOpened %s Device\n", alcGetString(pDevice, <API key>));
<API key>(pContext);
bReturn = AL_TRUE;
}
else
{
alcCloseDevice(pDevice);
}
}
delete pDeviceList;
}
*/
// return bReturn;
}
void ALUNIXAcoustic::begin_play(void)
{
return;
ALuint uiBuffer, uiSource;
ALint iState;
// plz get uibuffer from whereever
alGenSources(1, &uiSource);
// Attach Source to Buffer
alSourcei(uiSource, AL_BUFFER, uiBuffer);
alSourcePlay(uiSource);
do
{
sleep(100);
// Get Source State
alGetSourcei( uiSource, AL_SOURCE_STATE, &iState);
}
while (iState == AL_PLAYING);
alSourceStop(uiSource);
alDeleteSources(1, &uiSource);
}
void ALUNIXAcoustic::finish_play(void)
{
}
void ALUNIXAcoustic::release(void)
{
}
void ALUNIXAcoustic::test(void)
{
ALuint uiBuffer, uiSource;
ALint iState;
// if (!init())
// std::cerr << "Failed to initialize OpenAL" << std::endl;
// return;
// Generate an AL Buffer
alGenBuffers(1, &uiBuffer );
// Load Wave file into OpenAL Buffer
if (!<API key>((char*)ALFWaddMediaPath("footsteps.wav"),
uiBuffer))
{
std::cerr << "Failed to load"
<< ALFWaddMediaPath("footsteps.wav") << std::endl;
}
// Generate a Source to playback the Buffer
alGenSources( 1, &uiSource );
// Attach Source to Buffer
alSourcei( uiSource, AL_BUFFER, uiBuffer );
// Play Source
alSourcePlay( uiSource );
std::cerr << "Playing Source " << std::endl;
do
{
sleep(100);
// Get Source State
alGetSourcei( uiSource, AL_SOURCE_STATE, &iState);
}
while (iState == AL_PLAYING);
// Clean up by deleting Source(s) and Buffer(s)
alSourceStop(uiSource);
alDeleteSources(1, &uiSource);
alDeleteBuffers(1, &uiBuffer);
ALFWShutdownOpenAL();
}
bool ALUNIXAcoustic::ALFWShutdownOpenAL(void)
{
ALCcontext* pContext;
ALCdevice* pDevice;
pContext = <API key>();
pDevice = <API key>(pContext);
<API key>(NULL);
alcDestroyContext(pContext);
alcCloseDevice(pDevice);
return true;
}
bool ALUNIXAcoustic::<API key>(const char* szWaveFile,
ALuint uiBufferID,
ALenum eXRAMBufferMode)
{
WAVEID WaveID;
Int32 iDataSize, iFrequency;
ALenum eBufferFormat;
Char* pData;
bool bReturn;
bReturn = false;
// if (!g_pWaveLoader) { return bReturn; }
if (WR_OK != sndloader.LoadWaveFile(szWaveFile, &WaveID))
{
std::cerr << "LoadWaveFile is failed" << std::endl;
return bReturn;
}
if (WR_OK == sndloader.GetWaveSize(WaveID, (uInt64*)&iDataSize)
&& WR_OK == sndloader.GetWaveData(WaveID, (void**)&pData)
&& WR_OK == sndloader.GetWaveFrequency(WaveID,
(uInt64*)&iFrequency)
&& WR_OK == sndloader.<API key>(WaveID, &alGetEnumValue,
(uInt64*)&eBufferFormat))
{
// Set XRAM Mode (if application)
#ifdef UNDEF
if (eaxSetBufferMode && eXRAMBufferMode)
{ eaxSetBufferMode(1, &uiBufferID, eXRAMBufferMode); }
if (alGetError() == AL_NO_ERROR)
{
std::cerr << "no_error before buffer data" << std::endl;
}
alBufferData(uiBufferID, eBufferFormat, pData, iDataSize, iFrequency);
ALenum e = alGetError();
if (e == AL_NO_ERROR)
{
std::cerr << "al_no_error" << std::endl;
bReturn = true;
}
std::cerr << e << ": al_an_error" << std::endl;
sndloader.DeleteWaveFile(WaveID);
#endif
}
return bReturn;
}
Char fullPath[PATH_MAX];
Char* ALUNIXAcoustic::ALFWaddMediaPath(const ALchar* filename)
{
sprintf(fullPath, "%s%s", "..\\..\\Media\\", filename);
return fullPath;
}
// Extension Queries
#ifdef UNDEF
ALboolean ALUNIXAcoustic::ALFWIsXRAMSupported(void)
{
ALboolean bXRAM = AL_FALSE;
if (<API key>("EAX-RAM") == AL_TRUE)
{
// Get X-RAM Function pointers
eaxSetBufferMode = (EAXSetBufferMode)alGetProcAddress("EAXSetBufferMode");
eaxGetBufferMode = (EAXGetBufferMode)alGetProcAddress("EAXGetBufferMode");
if (eaxSetBufferMode && eaxGetBufferMode)
{
eXRAMSize = alGetEnumValue("AL_EAX_RAM_SIZE");
eXRAMFree = alGetEnumValue("AL_EAX_RAM_FREE");
eXRAMAuto = alGetEnumValue("<API key>");
eXRAMHardware = alGetEnumValue("AL_STORAGE_HARDWARE");
eXRAMAccessible = alGetEnumValue("<API key>");
if (eXRAMSize && eXRAMFree && eXRAMAuto && eXRAMHardware && eXRAMAccessible)
{ bXRAM = AL_TRUE;}
}
}
return bXRAM;
}
ALboolean ALUNIXAcoustic::ALFWIsEFXSupported(void)
{
ALCdevice* pDevice = NULL;
ALCcontext* pContext = NULL;
ALboolean bEFXSupport = AL_FALSE;
pContext = <API key>();
pDevice = <API key>(pContext);
if (<API key>(pDevice, (ALCchar*)ALC_EXT_EFX_NAME))
{
// Get function pointers
alGenEffects = (LPALGENEFFECTS)alGetProcAddress("alGenEffects");
alDeleteEffects = (LPALDELETEEFFECTS )alGetProcAddress("alDeleteEffects");
alIsEffect = (LPALISEFFECT )alGetProcAddress("alIsEffect");
alEffecti = (LPALEFFECTI)alGetProcAddress("alEffecti");
alEffectiv = (LPALEFFECTIV)alGetProcAddress("alEffectiv");
alEffectf = (LPALEFFECTF)alGetProcAddress("alEffectf");
alEffectfv = (LPALEFFECTFV)alGetProcAddress("alEffectfv");
alGetEffecti = (LPALGETEFFECTI)alGetProcAddress("alGetEffecti");
alGetEffectiv = (LPALGETEFFECTIV)alGetProcAddress("alGetEffectiv");
alGetEffectf = (LPALGETEFFECTF)alGetProcAddress("alGetEffectf");
alGetEffectfv = (LPALGETEFFECTFV)alGetProcAddress("alGetEffectfv");
alGenFilters = (LPALGENFILTERS)alGetProcAddress("alGenFilters");
alDeleteFilters = (LPALDELETEFILTERS)alGetProcAddress("alDeleteFilters");
alIsFilter = (LPALISFILTER)alGetProcAddress("alIsFilter");
alFilteri = (LPALFILTERI)alGetProcAddress("alFilteri");
alFilteriv = (LPALFILTERIV)alGetProcAddress("alFilteriv");
alFilterf = (LPALFILTERF)alGetProcAddress("alFilterf");
alFilterfv = (LPALFILTERFV)alGetProcAddress("alFilterfv");
alGetFilteri = (LPALGETFILTERI )alGetProcAddress("alGetFilteri");
alGetFilteriv= (LPALGETFILTERIV )alGetProcAddress("alGetFilteriv");
alGetFilterf = (LPALGETFILTERF )alGetProcAddress("alGetFilterf");
alGetFilterfv= (LPALGETFILTERFV )alGetProcAddress("alGetFilterfv");
<API key> = (<API key>)alGetProcAddress("<API key>");
<API key> = (<API key>)alGetProcAddress("<API key>");
<API key> = (<API key>)alGetProcAddress("<API key>");
<API key> = (<API key>)alGetProcAddress("<API key>");
<API key> = (<API key>)alGetProcAddress("<API key>");
<API key> = (<API key>)alGetProcAddress("<API key>");
<API key> = (<API key>)alGetProcAddress("<API key>");
<API key> = (<API key>)alGetProcAddress("<API key>");
<API key> = (<API key>)alGetProcAddress("<API key>");
<API key> = (<API key>)alGetProcAddress("<API key>");
<API key> = (<API key>)alGetProcAddress("<API key>");
if (alGenEffects && alDeleteEffects && alIsEffect && alEffecti
&& alEffectiv && alEffectf && alEffectfv && alGetEffecti
&& alGetEffectiv && alGetEffectf && alGetEffectfv && alGenFilters
&& alDeleteFilters && alIsFilter && alFilteri && alFilteriv
&& alFilterf && alFilterfv && alGetFilteri && alGetFilteriv
&& alGetFilterf && alGetFilterfv && <API key>
&& <API key> && <API key>
&& <API key> && <API key>
&& <API key> && <API key> &&
<API key> && <API key>
&& <API key> && <API key>)
{ bEFXSupport = AL_TRUE; }
}
return bEFXSupport;
}
#endif
/*
* Init call
*/
void ALUNIXAcoustic::<API key>(void)
{
ALDEVICEINFO ALDeviceInfo;
char* devices;
int index;
const char* defaultDeviceName;
const char* actualDeviceName;
// DeviceInfo vector stores, for each enumerated device, it's device name, selection status, spec version #, and extension support
vDeviceInfo.empty();
vDeviceInfo.reserve(10);
defaultDeviceIndex = 0;
devices = (char*)alcGetString(NULL, <API key>);
defaultDeviceName = (char*)alcGetString(NULL, <API key>);
index = 0;
// go through device list (each device terminated with a single NULL,
// list terminated with double NULL)
while (*devices != NULL)
{
if (strcmp(defaultDeviceName, devices) == 0)
{ defaultDeviceIndex = index; }
ALCdevice* device = alcOpenDevice(devices);
if (device)
{
ALCcontext* context = alcCreateContext(device, NULL);
if (context)
{
<API key>(context);
// if new actual device name isn't already in the list, then add it...
actualDeviceName = alcGetString(device,
<API key>);
bool bNewName = true;
for (Size32 i = 0; i < GetNumDevices(); i++)
{
if (strcmp(GetDeviceName(i), actualDeviceName) == 0)
{ bNewName = false; }
}
{ std::cerr << "after strdevicename XXXx" << std::endl; return; }
if ((bNewName) && (actualDeviceName != NULL)
&& (strlen(actualDeviceName) > 0))
{
memset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO));
ALDeviceInfo.bSelected = true;
ALDeviceInfo.strDeviceName = actualDeviceName;
alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(Int32),
&ALDeviceInfo.iMajorVersion);
alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(Int32),
&ALDeviceInfo.iMinorVersion);
ALDeviceInfo.pvstrExtensions = new vector<string>;
// Check for ALC Extensions
if (<API key>(device, "ALC_EXT_CAPTURE") == AL_TRUE)
{ ALDeviceInfo.pvstrExtensions->push_back("ALC_EXT_CAPTURE"); }
if (<API key>(device, "ALC_EXT_EFX") == AL_TRUE)
{ ALDeviceInfo.pvstrExtensions->push_back("ALC_EXT_EFX"); }
// Check for AL Extensions
if (<API key>("AL_EXT_OFFSET") == AL_TRUE)
{ ALDeviceInfo.pvstrExtensions->push_back("AL_EXT_OFFSET"); }
if (<API key>("<API key>") == AL_TRUE)
{ ALDeviceInfo.pvstrExtensions->push_back("<API key>"); }
if (<API key>("<API key>") == AL_TRUE)
{ ALDeviceInfo.pvstrExtensions->push_back("<API key>"); }
if (<API key>("EAX2.0") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("EAX2.0");
if (<API key>("EAX3.0") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("EAX3.0");
if (<API key>("EAX4.0") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("EAX4.0");
if (<API key>("EAX5.0") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("EAX5.0");
if (<API key>("EAX-RAM") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("EAX-RAM");
// Get Source Count
ALDeviceInfo.uiSourceCount = GetMaxNumSources();
vDeviceInfo.push_back(ALDeviceInfo);
}
<API key>(NULL);
alcDestroyContext(context);
}
alcCloseDevice(device);
}
devices += strlen(devices) + 1;
index += 1;
}
ResetFilters();
}
/*
* Exit call
*/
void ALUNIXAcoustic::ALDeviceListDestroy(void)
{
for (unsigned int i = 0; i < vDeviceInfo.size(); i++)
{
if (vDeviceInfo[i].pvstrExtensions)
{
vDeviceInfo[i].pvstrExtensions->empty();
delete vDeviceInfo[i].pvstrExtensions;
}
}
vDeviceInfo.empty();
}
/*
* Returns the number of devices in the complete device list
*/
Size32 ALUNIXAcoustic::GetNumDevices(void)
{
return vDeviceInfo.size();
}
/*
* Returns the device name at an index in the complete device list
*/
char* ALUNIXAcoustic::GetDeviceName(Size32 idx_)
{
if (idx_ < GetNumDevices())
{ return (char* )vDeviceInfo[idx_].strDeviceName.c_str(); }
return NULL;
}
/*
* Returns the major and minor version numbers for a device at a specified index in the complete list
*/
void ALUNIXAcoustic::GetDeviceVersion(Size32 idx_, int* major, int* minor)
{
if (idx_ < GetNumDevices())
{
if (major) {* major = vDeviceInfo[idx_].iMajorVersion; }
if (minor) {* minor = vDeviceInfo[idx_].iMinorVersion; }
}
return;
}
/*
* Returns the maximum number of Sources that can be generate on the given device
*/
unsigned int ALUNIXAcoustic::GetMaxNumSources(Size32 idx_)
{
if (idx_ < GetNumDevices()) { return vDeviceInfo[idx_].uiSourceCount; }
return 0;
}
/*
* Checks if the extension is supported on the given device
*/
bool ALUNIXAcoustic::<API key>(Size32 idx_, char* szExtName)
{
bool bReturn = false;
if (idx_ < GetNumDevices())
{
for (unsigned int i = 0; i < vDeviceInfo[idx_].pvstrExtensions->size();
i++)
{
if (!strncmp(vDeviceInfo[idx_].pvstrExtensions->at(i).c_str(),
szExtName, 3)) // , 3 is XXX
{
bReturn = true;
break;
}
}
}
return bReturn;
}
/*
* returns the index of the default device in the complete device list
*/
int ALUNIXAcoustic::GetDefaultDevice(void)
{
return defaultDeviceIndex;
}
/*
* Deselects devices which don't have the specified minimum version
*/
void ALUNIXAcoustic::FilterDevicesMinVer(int major, int minor)
{
Int32 dMajor, dMinor;
for (unsigned int i = 0; i < vDeviceInfo.size(); i++)
{
GetDeviceVersion(i, &dMajor, &dMinor);
if ((dMajor < major) || ((dMajor == major) && (dMinor < minor)))
{ vDeviceInfo[i].bSelected = false; }
}
}
/*
* Deselects devices which don't have the specified maximum version
*/
void ALUNIXAcoustic::FilterDevicesMaxVer(int major, int minor)
{
Int32 dMajor, dMinor;
for (unsigned int i = 0; i < vDeviceInfo.size(); i++)
{
GetDeviceVersion(i, &dMajor, &dMinor);
if ((dMajor > major) || ((dMajor == major) && (dMinor > minor)))
{ vDeviceInfo[i].bSelected = false; }
}
}
/*
* Deselects device which don't support the given extension name
*/
void ALUNIXAcoustic::<API key>(char* szExtName)
{
bool bFound;
for (unsigned int i = 0; i < vDeviceInfo.size(); i++)
{
bFound = false;
for (unsigned int j = 0; j < vDeviceInfo[i].pvstrExtensions->size();
j++)
{
if (!strncmp(vDeviceInfo[i].pvstrExtensions->at(j).c_str(),
szExtName, 3)) // , 3 is XXX
{
bFound = true;
break;
}
}
if (!bFound) { vDeviceInfo[i].bSelected = false; }
}
}
/*
* Resets all filtering, such that all devices are in the list
*/
void ALUNIXAcoustic::ResetFilters(void)
{
for (Size32 i = 0; i < GetNumDevices(); i++)
{ vDeviceInfo[i].bSelected = true; }
filterIndex = 0;
}
/*
* Gets index of first filtered device
*/
Size32 ALUNIXAcoustic::<API key>(void)
{
Size32 i;
for (i = 0; i < GetNumDevices(); i++)
{
if (vDeviceInfo[i].bSelected == true) { break; }
}
filterIndex = i + 1;
return i;
}
/*
* Gets index of next filtered device
*/
Size32 ALUNIXAcoustic::<API key>(void)
{
Size32 i;
for (i = filterIndex; i < GetNumDevices(); i++)
{
if (vDeviceInfo[i].bSelected == true) { break; }
}
filterIndex = i + 1;
return i;
}
/*
* Internal function to detemine max number of Sources that can be generated
*/
unsigned int ALUNIXAcoustic::GetMaxNumSources(void)
{
ALuint uiSources[256];
unsigned int iSourceCount = 0;
// Clear AL Error Code
alGetError();
// Generate up to 256 Sources, checking for any errors
for (iSourceCount = 0; iSourceCount < 256; iSourceCount++)
{
alGenSources(1, &uiSources[iSourceCount]);
if (alGetError() != AL_NO_ERROR) { break; }
}
// Release the Sources
alDeleteSources(iSourceCount, uiSources);
if (alGetError() != AL_NO_ERROR)
{
for (unsigned int i = 0; i < 256; i++)
{ alDeleteSources(1, &uiSources[i]); }
}
return iSourceCount;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.