code
stringlengths 3
1.05M
| repo_name
stringlengths 4
116
| path
stringlengths 3
942
| language
stringclasses 30
values | license
stringclasses 15
values | size
int32 3
1.05M
|
---|---|---|---|---|---|
<p>
Disponemos de una amplia gama de piensos fisiológicos y de prescripción veterinaria; nuestras auxiliares nutricionistas le asesorarán sobre cualquier aspecto relacionado con la alimentación de su mascota.
</p>
<p>
Contamos con sección especializada en alimentación de animales exóticos.
</p>
<p>
Asimismo, podrá encontrar gran variedad de juguetes y complementos seleccionados pensando en la comodidad, seguridad y diversión de nuestras mascotas.
</p> | thingtrack/menes.mobile | www/partials/services-shop.html | HTML | mit | 467 |
class CreateVersions < ActiveRecord::Migration
def change
create_table :versions do |t|
t.string :item_type, :null => false
t.integer :item_id, :null => false
t.string :event, :null => false
t.string :whodunnit
t.text :object
t.string :locale
t.datetime :created_at
end
add_index :versions, [:item_type, :item_id]
end
end
| kostyakch/rhinoart_cms | db/migrate/20141229155334_create_versions.rb | Ruby | mit | 399 |
<!DOCTYPE html>
<html>
<head>
<title>Piframe</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="robots" content="noindex"/>
<meta name="viewport" content="width=device-width"/>
<script type="text/javascript" src="lib/jquery/jquery-1.12.0.min.js"></script>
<link rel="stylesheet" href="lib/owl-carousel/owl.carousel.css"/>
<link rel="stylesheet" href="lib/owl-carousel/owl.theme.css"/>
<link rel="stylesheet" href="lib/owl-carousel/owl.transitions.css">
<script src="lib/owl-carousel/owl.carousel.min.js"></script>
<script src="lib/date/date.js"></script>
<script src="lib/date/date-fr-FR.js"></script>
<link rel="stylesheet" href="lib/piframe/piframe.css"/>
<script src="lib/piframe/piframe.js"></script>
</head>
<body>
<div class="loadingContainer"></div>
<div class="owl-carousel mediaContainer"></div>
<div class="mediaTooltip"></div>
</body>
</html> | alex-estela/piframe | src/main/resources/static/index.html | HTML | mit | 913 |
using System;
using System.Drawing;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Input;
using MahApps.Metro.Controls;
using NHotkey;
using NHotkey.Wpf;
using QuickHelper.ViewModels;
using QuickHelper.Windows;
using Application = System.Windows.Application;
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
namespace QuickHelper
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : MetroWindow
{
public MainWindow()
{
InitializeComponent();
this.PreviewKeyDown += MainWindow_PreviewKeyDown;
this.InitTrayIcon();
HotkeyManager.Current.AddOrReplace(
"Bring to focus",
Key.OemQuestion,
ModifierKeys.Control | ModifierKeys.Windows,
OnBringToFocus);
HotkeyManager.Current.AddOrReplace(
"Bring to focus",
Key.Q, ModifierKeys.Control | ModifierKeys.Shift | ModifierKeys.Alt,
OnBringToFocus);
}
public void OnBringToFocus(object sender, HotkeyEventArgs eventArgs)
{
OpenApplication();
}
private void OpenApplication()
{
ViewModel.FilterText = WindowsHelper.GetActiveProcessFileName();
if (!this.IsVisible)
{
this.Show();
}
if (this.WindowState == WindowState.Minimized)
{
this.WindowState = WindowState.Maximized;
}
this.Activate();
this.Topmost = true; // important
this.Topmost = false; // important
this.Focus(); // important
}
protected MainViewModel ViewModel
{
get { return this.DataContext as MainViewModel; }
}
private void MainWindow_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
if (string.IsNullOrWhiteSpace(this.ViewModel.FilterText))
{
this.Hide();
}
else
{
this.ViewModel.ClearFilter();
}
}
}
private NotifyIcon _notifyIcon;
private void InitTrayIcon()
{
_notifyIcon = new NotifyIcon();
_notifyIcon.Icon = new Icon(SystemIcons.Question, 40, 40);
_notifyIcon.Visible = true;
_notifyIcon.DoubleClick += (sender, args) =>
{
this.Show();
var menu = this.FindResource("TrayContextMenu") as System.Windows.Controls.ContextMenu;
menu.IsOpen = false;
this.WindowState = WindowState.Normal;
};
_notifyIcon.MouseClick += (sender, args) =>
{
if (args.Button == MouseButtons.Right)
{
var menu = this.FindResource("TrayContextMenu") as System.Windows.Controls.ContextMenu;
menu.IsOpen = true;
}
};
}
protected override void OnStateChanged(EventArgs e)
{
if (WindowState == WindowState.Minimized)
this.Hide();
base.OnStateChanged(e);
}
protected void Menu_Exit(object sender, RoutedEventArgs e)
{
_notifyIcon.Visible = false;
Application.Current.Shutdown();
}
protected void Menu_Open(object sender, RoutedEventArgs e)
{
OpenApplication();
}
}
}
| aburok/quick-helper | QuickHelper/MainWindow.xaml.cs | C# | mit | 3,762 |
package com.comandante.creeper.command.commands;
import com.comandante.creeper.common.FriendlyTime;
import org.junit.Test;
public class FriendlyTimeTest {
@Test
public void testFriendlyParsing() throws Exception {
FriendlyTime friendlyTime = new FriendlyTime(400);
System.out.println("Friendly Long: " + friendlyTime.getFriendlyFormatted());
System.out.println("Friendly Short: " + friendlyTime.getFriendlyFormattedShort());
}
} | chriskearney/creeper | src/test/com/comandante/creeper/command/commands/FriendlyTimeTest.java | Java | mit | 472 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TrackR")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TrackR")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d9aa4e01-1571-4721-b6b8-a402f67af6b2")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| luetm/TrackR | TrackR.Client/Properties/AssemblyInfo.cs | C# | mit | 1,388 |
# React Drop-down Time Picker
Time picker for ReactJS based on the [Cozi Calendar](https://www.cozi.com/calendar) time picker. [See the demo](https://dpalma.github.io/react-dropdown-timepicker/).
[](https://travis-ci.org/dpalma/react-dropdown-timepicker)
## Installation
```shell
$ npm install --save react-dropdown-timepicker
```
## Usage
```javascript
import TimePicker from 'react-dropdown-timepicker';
render() {
<TimePicker
time={this.state.time}
onChange={this.handleTimeChange.bind(this)} />
}
```
| dpalma/react-dropdown-timepicker | README.md | Markdown | mit | 605 |
package fs.command;
import fs.App;
import fs.Disk;
import fs.util.FileUtils;
import java.util.Arrays;
/**
*
* @author José Andrés García Sáenz <[email protected]>
*/
public class CreateFileCommand extends Command {
public final static String COMMAND = "mkfile";
@Override
public void execute(String[] args) {
if (args.length != 2 && args.length != 3) {
reportSyntaxError();
return;
}
String path = args[1];
String content = String.join(" ", Arrays.copyOfRange(args, 2, args.length));
App app = App.getInstance();
Disk disk = app.getDisk();
if (disk.exists(path) && !FileUtils.promptForVirtualOverride(path)) {
return;
}
try {
disk.createFile(path, content);
}
catch (Exception ex) {
reportError(ex);
}
}
@Override
protected String getName() {
return CreateFileCommand.COMMAND;
}
@Override
protected String getDescription() {
return "Create a file and set its content.";
}
@Override
protected String getSyntax() {
return getName() + " FILENAME \"<CONTENT>\"";
}
}
| leomv09/FileSystem | src/fs/command/CreateFileCommand.java | Java | mit | 1,247 |
import { A, O } from 'b-o-a';
import { State } from '../types/state';
import currentPage$ from '../props/current-page';
import signIn$ from '../props/sign-in';
import spots$ from '../props/spots';
import spotForm$ from '../props/spot-form';
import stampRallies$ from '../props/stamp-rallies';
import stampRally$ from '../props/stamp-rally';
import stampRallyForm$ from '../props/stamp-rally-form';
import token$ from '../props/token';
const getDefaultState = (): State => {
return {
googleApiKey: process.env.GOOGLE_API_KEY,
currentPage: 'sign_in#index',
signIn: {
email: null,
password: null
},
spots: [],
spotForm: {
name: null
},
stampRallies: [],
stampRally: null,
stampRallyForm: {
name: null
},
token: {
token: null,
userId: null
}
};
};
const $ = (action$: O<A<any>>, state: State): O<State> => {
const s = (state ? state : getDefaultState());
return O
.combineLatest(
currentPage$(s.currentPage, action$),
signIn$(s.signIn, action$),
token$(s.token, action$),
spots$(s.spots, action$),
spotForm$(s.spotForm, action$),
stampRallies$(s.stampRallies, action$),
stampRally$(s.stampRally, action$),
stampRallyForm$(s.stampRallyForm, action$),
(
currentPage,
signIn,
token,
spots,
spotForm,
stampRallies,
stampRally,
stampRallyForm
): State => {
return Object.assign({}, s, {
currentPage,
signIn,
token,
spots,
spotForm,
stampRallies,
stampRally,
stampRallyForm
});
}
)
.do(console.log.bind(console)) // logger for state
.share();
};
export { $ };
| bouzuya/rally-rxjs | src/props/index.ts | TypeScript | mit | 1,793 |
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Copyright (c) 2011-2012 Litecoin Developers
// Copyright (c) 2013-2013 Bluecoin Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "netbase.h"
#include "util.h"
#ifndef WIN32
#include <sys/fcntl.h>
#endif
#include "strlcpy.h"
#include <boost/algorithm/string/case_conv.hpp> // for to_lower()
using namespace std;
// Settings
typedef std::pair<CService, int> proxyType;
static proxyType proxyInfo[NET_MAX];
static proxyType nameproxyInfo;
int nConnectTimeout = 5000;
bool fNameLookup = false;
static const unsigned char pchIPv4[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff };
enum Network ParseNetwork(std::string net) {
boost::to_lower(net);
if (net == "ipv4") return NET_IPV4;
if (net == "ipv6") return NET_IPV6;
if (net == "tor") return NET_TOR;
if (net == "i2p") return NET_I2P;
return NET_UNROUTABLE;
}
void SplitHostPort(std::string in, int &portOut, std::string &hostOut) {
size_t colon = in.find_last_of(':');
// if a : is found, and it either follows a [...], or no other : is in the string, treat it as port separator
bool fHaveColon = colon != in.npos;
bool fBracketed = fHaveColon && (in[0]=='[' && in[colon-1]==']'); // if there is a colon, and in[0]=='[', colon is not 0, so in[colon-1] is safe
bool fMultiColon = fHaveColon && (in.find_last_of(':',colon-1) != in.npos);
if (fHaveColon && (colon==0 || fBracketed || !fMultiColon)) {
char *endp = NULL;
int n = strtol(in.c_str() + colon + 1, &endp, 10);
if (endp && *endp == 0 && n >= 0) {
in = in.substr(0, colon);
if (n > 0 && n < 0x10000)
portOut = n;
}
}
if (in.size()>0 && in[0] == '[' && in[in.size()-1] == ']')
hostOut = in.substr(1, in.size()-2);
else
hostOut = in;
}
bool static LookupIntern(const char *pszName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions, bool fAllowLookup)
{
vIP.clear();
{
CNetAddr addr;
if (addr.SetSpecial(std::string(pszName))) {
vIP.push_back(addr);
return true;
}
}
struct addrinfo aiHint;
memset(&aiHint, 0, sizeof(struct addrinfo));
aiHint.ai_socktype = SOCK_STREAM;
aiHint.ai_protocol = IPPROTO_TCP;
#ifdef WIN32
# ifdef USE_IPV6
aiHint.ai_family = AF_UNSPEC;
# else
aiHint.ai_family = AF_INET;
# endif
aiHint.ai_flags = fAllowLookup ? 0 : AI_NUMERICHOST;
#else
# ifdef USE_IPV6
aiHint.ai_family = AF_UNSPEC;
# else
aiHint.ai_family = AF_INET;
# endif
aiHint.ai_flags = fAllowLookup ? AI_ADDRCONFIG : AI_NUMERICHOST;
#endif
struct addrinfo *aiRes = NULL;
int nErr = getaddrinfo(pszName, NULL, &aiHint, &aiRes);
if (nErr)
return false;
struct addrinfo *aiTrav = aiRes;
while (aiTrav != NULL && (nMaxSolutions == 0 || vIP.size() < nMaxSolutions))
{
if (aiTrav->ai_family == AF_INET)
{
assert(aiTrav->ai_addrlen >= sizeof(sockaddr_in));
vIP.push_back(CNetAddr(((struct sockaddr_in*)(aiTrav->ai_addr))->sin_addr));
}
#ifdef USE_IPV6
if (aiTrav->ai_family == AF_INET6)
{
assert(aiTrav->ai_addrlen >= sizeof(sockaddr_in6));
vIP.push_back(CNetAddr(((struct sockaddr_in6*)(aiTrav->ai_addr))->sin6_addr));
}
#endif
aiTrav = aiTrav->ai_next;
}
freeaddrinfo(aiRes);
return (vIP.size() > 0);
}
bool LookupHost(const char *pszName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions, bool fAllowLookup)
{
if (pszName[0] == 0)
return false;
char psz[256];
char *pszHost = psz;
strlcpy(psz, pszName, sizeof(psz));
if (psz[0] == '[' && psz[strlen(psz)-1] == ']')
{
pszHost = psz+1;
psz[strlen(psz)-1] = 0;
}
return LookupIntern(pszHost, vIP, nMaxSolutions, fAllowLookup);
}
bool LookupHostNumeric(const char *pszName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions)
{
return LookupHost(pszName, vIP, nMaxSolutions, false);
}
bool Lookup(const char *pszName, std::vector<CService>& vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions)
{
if (pszName[0] == 0)
return false;
int port = portDefault;
std::string hostname = "";
SplitHostPort(std::string(pszName), port, hostname);
std::vector<CNetAddr> vIP;
bool fRet = LookupIntern(hostname.c_str(), vIP, nMaxSolutions, fAllowLookup);
if (!fRet)
return false;
vAddr.resize(vIP.size());
for (unsigned int i = 0; i < vIP.size(); i++)
vAddr[i] = CService(vIP[i], port);
return true;
}
bool Lookup(const char *pszName, CService& addr, int portDefault, bool fAllowLookup)
{
std::vector<CService> vService;
bool fRet = Lookup(pszName, vService, portDefault, fAllowLookup, 1);
if (!fRet)
return false;
addr = vService[0];
return true;
}
bool LookupNumeric(const char *pszName, CService& addr, int portDefault)
{
return Lookup(pszName, addr, portDefault, false);
}
bool static Socks4(const CService &addrDest, SOCKET& hSocket)
{
printf("SOCKS4 connecting %s\n", addrDest.ToString().c_str());
if (!addrDest.IsIPv4())
{
closesocket(hSocket);
return error("Proxy destination is not IPv4");
}
char pszSocks4IP[] = "\4\1\0\0\0\0\0\0user";
struct sockaddr_in addr;
socklen_t len = sizeof(addr);
if (!addrDest.GetSockAddr((struct sockaddr*)&addr, &len) || addr.sin_family != AF_INET)
{
closesocket(hSocket);
return error("Cannot get proxy destination address");
}
memcpy(pszSocks4IP + 2, &addr.sin_port, 2);
memcpy(pszSocks4IP + 4, &addr.sin_addr, 4);
char* pszSocks4 = pszSocks4IP;
int nSize = sizeof(pszSocks4IP);
int ret = send(hSocket, pszSocks4, nSize, MSG_NOSIGNAL);
if (ret != nSize)
{
closesocket(hSocket);
return error("Error sending to proxy");
}
char pchRet[8];
if (recv(hSocket, pchRet, 8, 0) != 8)
{
closesocket(hSocket);
return error("Error reading proxy response");
}
if (pchRet[1] != 0x5a)
{
closesocket(hSocket);
if (pchRet[1] != 0x5b)
printf("ERROR: Proxy returned error %d\n", pchRet[1]);
return false;
}
printf("SOCKS4 connected %s\n", addrDest.ToString().c_str());
return true;
}
bool static Socks5(string strDest, int port, SOCKET& hSocket)
{
printf("SOCKS5 connecting %s\n", strDest.c_str());
if (strDest.size() > 255)
{
closesocket(hSocket);
return error("Hostname too long");
}
char pszSocks5Init[] = "\5\1\0";
char *pszSocks5 = pszSocks5Init;
ssize_t nSize = sizeof(pszSocks5Init) - 1;
ssize_t ret = send(hSocket, pszSocks5, nSize, MSG_NOSIGNAL);
if (ret != nSize)
{
closesocket(hSocket);
return error("Error sending to proxy");
}
char pchRet1[2];
if (recv(hSocket, pchRet1, 2, 0) != 2)
{
closesocket(hSocket);
return error("Error reading proxy response");
}
if (pchRet1[0] != 0x05 || pchRet1[1] != 0x00)
{
closesocket(hSocket);
return error("Proxy failed to initialize");
}
string strSocks5("\5\1");
strSocks5 += '\000'; strSocks5 += '\003';
strSocks5 += static_cast<char>(std::min((int)strDest.size(), 255));
strSocks5 += strDest;
strSocks5 += static_cast<char>((port >> 8) & 0xFF);
strSocks5 += static_cast<char>((port >> 0) & 0xFF);
ret = send(hSocket, strSocks5.c_str(), strSocks5.size(), MSG_NOSIGNAL);
if (ret != (ssize_t)strSocks5.size())
{
closesocket(hSocket);
return error("Error sending to proxy");
}
char pchRet2[4];
if (recv(hSocket, pchRet2, 4, 0) != 4)
{
closesocket(hSocket);
return error("Error reading proxy response");
}
if (pchRet2[0] != 0x05)
{
closesocket(hSocket);
return error("Proxy failed to accept request");
}
if (pchRet2[1] != 0x00)
{
closesocket(hSocket);
switch (pchRet2[1])
{
case 0x01: return error("Proxy error: general failure");
case 0x02: return error("Proxy error: connection not allowed");
case 0x03: return error("Proxy error: network unreachable");
case 0x04: return error("Proxy error: host unreachable");
case 0x05: return error("Proxy error: connection refused");
case 0x06: return error("Proxy error: TTL expired");
case 0x07: return error("Proxy error: protocol error");
case 0x08: return error("Proxy error: address type not supported");
default: return error("Proxy error: unknown");
}
}
if (pchRet2[2] != 0x00)
{
closesocket(hSocket);
return error("Error: malformed proxy response");
}
char pchRet3[256];
switch (pchRet2[3])
{
case 0x01: ret = recv(hSocket, pchRet3, 4, 0) != 4; break;
case 0x04: ret = recv(hSocket, pchRet3, 16, 0) != 16; break;
case 0x03:
{
ret = recv(hSocket, pchRet3, 1, 0) != 1;
if (ret)
return error("Error reading from proxy");
int nRecv = pchRet3[0];
ret = recv(hSocket, pchRet3, nRecv, 0) != nRecv;
break;
}
default: closesocket(hSocket); return error("Error: malformed proxy response");
}
if (ret)
{
closesocket(hSocket);
return error("Error reading from proxy");
}
if (recv(hSocket, pchRet3, 2, 0) != 2)
{
closesocket(hSocket);
return error("Error reading from proxy");
}
printf("SOCKS5 connected %s\n", strDest.c_str());
return true;
}
bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRet, int nTimeout)
{
hSocketRet = INVALID_SOCKET;
#ifdef USE_IPV6
struct sockaddr_storage sockaddr;
#else
struct sockaddr sockaddr;
#endif
socklen_t len = sizeof(sockaddr);
if (!addrConnect.GetSockAddr((struct sockaddr*)&sockaddr, &len)) {
printf("Cannot connect to %s: unsupported network\n", addrConnect.ToString().c_str());
return false;
}
SOCKET hSocket = socket(((struct sockaddr*)&sockaddr)->sa_family, SOCK_STREAM, IPPROTO_TCP);
if (hSocket == INVALID_SOCKET)
return false;
#ifdef SO_NOSIGPIPE
int set = 1;
setsockopt(hSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int));
#endif
#ifdef WIN32
u_long fNonblock = 1;
if (ioctlsocket(hSocket, FIONBIO, &fNonblock) == SOCKET_ERROR)
#else
int fFlags = fcntl(hSocket, F_GETFL, 0);
if (fcntl(hSocket, F_SETFL, fFlags | O_NONBLOCK) == -1)
#endif
{
closesocket(hSocket);
return false;
}
if (connect(hSocket, (struct sockaddr*)&sockaddr, len) == SOCKET_ERROR)
{
// WSAEINVAL is here because some legacy version of winsock uses it
if (WSAGetLastError() == WSAEINPROGRESS || WSAGetLastError() == WSAEWOULDBLOCK || WSAGetLastError() == WSAEINVAL)
{
struct timeval timeout;
timeout.tv_sec = nTimeout / 1000;
timeout.tv_usec = (nTimeout % 1000) * 1000;
fd_set fdset;
FD_ZERO(&fdset);
FD_SET(hSocket, &fdset);
int nRet = select(hSocket + 1, NULL, &fdset, NULL, &timeout);
if (nRet == 0)
{
printf("connection timeout\n");
closesocket(hSocket);
return false;
}
if (nRet == SOCKET_ERROR)
{
printf("select() for connection failed: %i\n",WSAGetLastError());
closesocket(hSocket);
return false;
}
socklen_t nRetSize = sizeof(nRet);
#ifdef WIN32
if (getsockopt(hSocket, SOL_SOCKET, SO_ERROR, (char*)(&nRet), &nRetSize) == SOCKET_ERROR)
#else
if (getsockopt(hSocket, SOL_SOCKET, SO_ERROR, &nRet, &nRetSize) == SOCKET_ERROR)
#endif
{
printf("getsockopt() for connection failed: %i\n",WSAGetLastError());
closesocket(hSocket);
return false;
}
if (nRet != 0)
{
printf("connect() failed after select(): %s\n",strerror(nRet));
closesocket(hSocket);
return false;
}
}
#ifdef WIN32
else if (WSAGetLastError() != WSAEISCONN)
#else
else
#endif
{
printf("connect() failed: %i\n",WSAGetLastError());
closesocket(hSocket);
return false;
}
}
// this isn't even strictly necessary
// CNode::ConnectNode immediately turns the socket back to non-blocking
// but we'll turn it back to blocking just in case
#ifdef WIN32
fNonblock = 0;
if (ioctlsocket(hSocket, FIONBIO, &fNonblock) == SOCKET_ERROR)
#else
fFlags = fcntl(hSocket, F_GETFL, 0);
if (fcntl(hSocket, F_SETFL, fFlags & !O_NONBLOCK) == SOCKET_ERROR)
#endif
{
closesocket(hSocket);
return false;
}
hSocketRet = hSocket;
return true;
}
bool SetProxy(enum Network net, CService addrProxy, int nSocksVersion) {
assert(net >= 0 && net < NET_MAX);
if (nSocksVersion != 0 && nSocksVersion != 4 && nSocksVersion != 5)
return false;
if (nSocksVersion != 0 && !addrProxy.IsValid())
return false;
proxyInfo[net] = std::make_pair(addrProxy, nSocksVersion);
return true;
}
bool GetProxy(enum Network net, CService &addrProxy) {
assert(net >= 0 && net < NET_MAX);
if (!proxyInfo[net].second)
return false;
addrProxy = proxyInfo[net].first;
return true;
}
bool SetNameProxy(CService addrProxy, int nSocksVersion) {
if (nSocksVersion != 0 && nSocksVersion != 5)
return false;
if (nSocksVersion != 0 && !addrProxy.IsValid())
return false;
nameproxyInfo = std::make_pair(addrProxy, nSocksVersion);
return true;
}
bool GetNameProxy() {
return nameproxyInfo.second != 0;
}
bool IsProxy(const CNetAddr &addr) {
for (int i=0; i<NET_MAX; i++) {
if (proxyInfo[i].second && (addr == (CNetAddr)proxyInfo[i].first))
return true;
}
return false;
}
bool ConnectSocket(const CService &addrDest, SOCKET& hSocketRet, int nTimeout)
{
const proxyType &proxy = proxyInfo[addrDest.GetNetwork()];
// no proxy needed
if (!proxy.second)
return ConnectSocketDirectly(addrDest, hSocketRet, nTimeout);
SOCKET hSocket = INVALID_SOCKET;
// first connect to proxy server
if (!ConnectSocketDirectly(proxy.first, hSocket, nTimeout))
return false;
// do socks negotiation
switch (proxy.second) {
case 4:
if (!Socks4(addrDest, hSocket))
return false;
break;
case 5:
if (!Socks5(addrDest.ToStringIP(), addrDest.GetPort(), hSocket))
return false;
break;
default:
return false;
}
hSocketRet = hSocket;
return true;
}
bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest, int portDefault, int nTimeout)
{
string strDest;
int port = portDefault;
SplitHostPort(string(pszDest), port, strDest);
SOCKET hSocket = INVALID_SOCKET;
CService addrResolved(CNetAddr(strDest, fNameLookup && !nameproxyInfo.second), port);
if (addrResolved.IsValid()) {
addr = addrResolved;
return ConnectSocket(addr, hSocketRet, nTimeout);
}
addr = CService("0.0.0.0:0");
if (!nameproxyInfo.second)
return false;
if (!ConnectSocketDirectly(nameproxyInfo.first, hSocket, nTimeout))
return false;
switch(nameproxyInfo.second)
{
default:
case 4: return false;
case 5:
if (!Socks5(strDest, port, hSocket))
return false;
break;
}
hSocketRet = hSocket;
return true;
}
void CNetAddr::Init()
{
memset(ip, 0, 16);
}
void CNetAddr::SetIP(const CNetAddr& ipIn)
{
memcpy(ip, ipIn.ip, sizeof(ip));
}
static const unsigned char pchOnionCat[] = {0xFD,0x87,0xD8,0x7E,0xEB,0x43};
static const unsigned char pchGarliCat[] = {0xFD,0x60,0xDB,0x4D,0xDD,0xB5};
bool CNetAddr::SetSpecial(const std::string &strName)
{
if (strName.size()>6 && strName.substr(strName.size() - 6, 6) == ".onion") {
std::vector<unsigned char> vchAddr = DecodeBase32(strName.substr(0, strName.size() - 6).c_str());
if (vchAddr.size() != 16-sizeof(pchOnionCat))
return false;
memcpy(ip, pchOnionCat, sizeof(pchOnionCat));
for (unsigned int i=0; i<16-sizeof(pchOnionCat); i++)
ip[i + sizeof(pchOnionCat)] = vchAddr[i];
return true;
}
if (strName.size()>11 && strName.substr(strName.size() - 11, 11) == ".oc.b32.i2p") {
std::vector<unsigned char> vchAddr = DecodeBase32(strName.substr(0, strName.size() - 11).c_str());
if (vchAddr.size() != 16-sizeof(pchGarliCat))
return false;
memcpy(ip, pchOnionCat, sizeof(pchGarliCat));
for (unsigned int i=0; i<16-sizeof(pchGarliCat); i++)
ip[i + sizeof(pchGarliCat)] = vchAddr[i];
return true;
}
return false;
}
CNetAddr::CNetAddr()
{
Init();
}
CNetAddr::CNetAddr(const struct in_addr& ipv4Addr)
{
memcpy(ip, pchIPv4, 12);
memcpy(ip+12, &ipv4Addr, 4);
}
#ifdef USE_IPV6
CNetAddr::CNetAddr(const struct in6_addr& ipv6Addr)
{
memcpy(ip, &ipv6Addr, 16);
}
#endif
CNetAddr::CNetAddr(const char *pszIp, bool fAllowLookup)
{
Init();
std::vector<CNetAddr> vIP;
if (LookupHost(pszIp, vIP, 1, fAllowLookup))
*this = vIP[0];
}
CNetAddr::CNetAddr(const std::string &strIp, bool fAllowLookup)
{
Init();
std::vector<CNetAddr> vIP;
if (LookupHost(strIp.c_str(), vIP, 1, fAllowLookup))
*this = vIP[0];
}
int CNetAddr::GetByte(int n) const
{
return ip[15-n];
}
bool CNetAddr::IsIPv4() const
{
return (memcmp(ip, pchIPv4, sizeof(pchIPv4)) == 0);
}
bool CNetAddr::IsIPv6() const
{
return (!IsIPv4() && !IsTor() && !IsI2P());
}
bool CNetAddr::IsRFC1918() const
{
return IsIPv4() && (
GetByte(3) == 10 ||
(GetByte(3) == 192 && GetByte(2) == 168) ||
(GetByte(3) == 172 && (GetByte(2) >= 16 && GetByte(2) <= 31)));
}
bool CNetAddr::IsRFC3927() const
{
return IsIPv4() && (GetByte(3) == 169 && GetByte(2) == 254);
}
bool CNetAddr::IsRFC3849() const
{
return GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x0D && GetByte(12) == 0xB8;
}
bool CNetAddr::IsRFC3964() const
{
return (GetByte(15) == 0x20 && GetByte(14) == 0x02);
}
bool CNetAddr::IsRFC6052() const
{
static const unsigned char pchRFC6052[] = {0,0x64,0xFF,0x9B,0,0,0,0,0,0,0,0};
return (memcmp(ip, pchRFC6052, sizeof(pchRFC6052)) == 0);
}
bool CNetAddr::IsRFC4380() const
{
return (GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0 && GetByte(12) == 0);
}
bool CNetAddr::IsRFC4862() const
{
static const unsigned char pchRFC4862[] = {0xFE,0x80,0,0,0,0,0,0};
return (memcmp(ip, pchRFC4862, sizeof(pchRFC4862)) == 0);
}
bool CNetAddr::IsRFC4193() const
{
return ((GetByte(15) & 0xFE) == 0xFC);
}
bool CNetAddr::IsRFC6145() const
{
static const unsigned char pchRFC6145[] = {0,0,0,0,0,0,0,0,0xFF,0xFF,0,0};
return (memcmp(ip, pchRFC6145, sizeof(pchRFC6145)) == 0);
}
bool CNetAddr::IsRFC4843() const
{
return (GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x00 && (GetByte(12) & 0xF0) == 0x10);
}
bool CNetAddr::IsTor() const
{
return (memcmp(ip, pchOnionCat, sizeof(pchOnionCat)) == 0);
}
bool CNetAddr::IsI2P() const
{
return (memcmp(ip, pchGarliCat, sizeof(pchGarliCat)) == 0);
}
bool CNetAddr::IsLocal() const
{
// IPv4 loopback
if (IsIPv4() && (GetByte(3) == 127 || GetByte(3) == 0))
return true;
// IPv6 loopback (::1/128)
static const unsigned char pchLocal[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
if (memcmp(ip, pchLocal, 16) == 0)
return true;
return false;
}
bool CNetAddr::IsMulticast() const
{
return (IsIPv4() && (GetByte(3) & 0xF0) == 0xE0)
|| (GetByte(15) == 0xFF);
}
bool CNetAddr::IsValid() const
{
// Clean up 3-byte shifted addresses caused by garbage in size field
// of addr messages from versions before 0.2.9 checksum.
// Two consecutive addr messages look like this:
// header20 vectorlen3 addr26 addr26 addr26 header20 vectorlen3 addr26 addr26 addr26...
// so if the first length field is garbled, it reads the second batch
// of addr misaligned by 3 bytes.
if (memcmp(ip, pchIPv4+3, sizeof(pchIPv4)-3) == 0)
return false;
// unspecified IPv6 address (::/128)
unsigned char ipNone[16] = {};
if (memcmp(ip, ipNone, 16) == 0)
return false;
// documentation IPv6 address
if (IsRFC3849())
return false;
if (IsIPv4())
{
// INADDR_NONE
uint32_t ipNone = INADDR_NONE;
if (memcmp(ip+12, &ipNone, 4) == 0)
return false;
// 0
ipNone = 0;
if (memcmp(ip+12, &ipNone, 4) == 0)
return false;
}
return true;
}
bool CNetAddr::IsRoutable() const
{
return IsValid() && !(IsRFC1918() || IsRFC3927() || IsRFC4862() || (IsRFC4193() && !IsTor() && !IsI2P()) || IsRFC4843() || IsLocal());
}
enum Network CNetAddr::GetNetwork() const
{
if (!IsRoutable())
return NET_UNROUTABLE;
if (IsIPv4())
return NET_IPV4;
if (IsTor())
return NET_TOR;
if (IsI2P())
return NET_I2P;
return NET_IPV6;
}
std::string CNetAddr::ToStringIP() const
{
if (IsTor())
return EncodeBase32(&ip[6], 10) + ".onion";
if (IsI2P())
return EncodeBase32(&ip[6], 10) + ".oc.b32.i2p";
CService serv(*this, 0);
#ifdef USE_IPV6
struct sockaddr_storage sockaddr;
#else
struct sockaddr sockaddr;
#endif
socklen_t socklen = sizeof(sockaddr);
if (serv.GetSockAddr((struct sockaddr*)&sockaddr, &socklen)) {
char name[1025] = "";
if (!getnameinfo((const struct sockaddr*)&sockaddr, socklen, name, sizeof(name), NULL, 0, NI_NUMERICHOST))
return std::string(name);
}
if (IsIPv4())
return strprintf("%u.%u.%u.%u", GetByte(3), GetByte(2), GetByte(1), GetByte(0));
else
return strprintf("%x:%x:%x:%x:%x:%x:%x:%x",
GetByte(15) << 8 | GetByte(14), GetByte(13) << 8 | GetByte(12),
GetByte(11) << 8 | GetByte(10), GetByte(9) << 8 | GetByte(8),
GetByte(7) << 8 | GetByte(6), GetByte(5) << 8 | GetByte(4),
GetByte(3) << 8 | GetByte(2), GetByte(1) << 8 | GetByte(0));
}
std::string CNetAddr::ToString() const
{
return ToStringIP();
}
bool operator==(const CNetAddr& a, const CNetAddr& b)
{
return (memcmp(a.ip, b.ip, 16) == 0);
}
bool operator!=(const CNetAddr& a, const CNetAddr& b)
{
return (memcmp(a.ip, b.ip, 16) != 0);
}
bool operator<(const CNetAddr& a, const CNetAddr& b)
{
return (memcmp(a.ip, b.ip, 16) < 0);
}
bool CNetAddr::GetInAddr(struct in_addr* pipv4Addr) const
{
if (!IsIPv4())
return false;
memcpy(pipv4Addr, ip+12, 4);
return true;
}
#ifdef USE_IPV6
bool CNetAddr::GetIn6Addr(struct in6_addr* pipv6Addr) const
{
memcpy(pipv6Addr, ip, 16);
return true;
}
#endif
// get canonical identifier of an address' group
// no two connections will be attempted to addresses with the same group
std::vector<unsigned char> CNetAddr::GetGroup() const
{
std::vector<unsigned char> vchRet;
int nClass = NET_IPV6;
int nStartByte = 0;
int nBits = 16;
// all local addresses belong to the same group
if (IsLocal())
{
nClass = 255;
nBits = 0;
}
// all unroutable addresses belong to the same group
if (!IsRoutable())
{
nClass = NET_UNROUTABLE;
nBits = 0;
}
// for IPv4 addresses, '1' + the 16 higher-order bits of the IP
// includes mapped IPv4, SIIT translated IPv4, and the well-known prefix
else if (IsIPv4() || IsRFC6145() || IsRFC6052())
{
nClass = NET_IPV4;
nStartByte = 12;
}
// for 6to4 tunneled addresses, use the encapsulated IPv4 address
else if (IsRFC3964())
{
nClass = NET_IPV4;
nStartByte = 2;
}
// for Teredo-tunneled IPv6 addresses, use the encapsulated IPv4 address
else if (IsRFC4380())
{
vchRet.push_back(NET_IPV4);
vchRet.push_back(GetByte(3) ^ 0xFF);
vchRet.push_back(GetByte(2) ^ 0xFF);
return vchRet;
}
else if (IsTor())
{
nClass = NET_TOR;
nStartByte = 6;
nBits = 4;
}
else if (IsI2P())
{
nClass = NET_I2P;
nStartByte = 6;
nBits = 4;
}
// for he.net, use /36 groups
else if (GetByte(15) == 0x20 && GetByte(14) == 0x11 && GetByte(13) == 0x04 && GetByte(12) == 0x70)
nBits = 36;
// for the rest of the IPv6 network, use /32 groups
else
nBits = 32;
vchRet.push_back(nClass);
while (nBits >= 8)
{
vchRet.push_back(GetByte(15 - nStartByte));
nStartByte++;
nBits -= 8;
}
if (nBits > 0)
vchRet.push_back(GetByte(15 - nStartByte) | ((1 << nBits) - 1));
return vchRet;
}
uint64 CNetAddr::GetHash() const
{
uint256 hash = Hash(&ip[0], &ip[16]);
uint64 nRet;
memcpy(&nRet, &hash, sizeof(nRet));
return nRet;
}
void CNetAddr::print() const
{
printf("CNetAddr(%s)\n", ToString().c_str());
}
// private extensions to enum Network, only returned by GetExtNetwork,
// and only used in GetReachabilityFrom
static const int NET_UNKNOWN = NET_MAX + 0;
static const int NET_TEREDO = NET_MAX + 1;
int static GetExtNetwork(const CNetAddr *addr)
{
if (addr == NULL)
return NET_UNKNOWN;
if (addr->IsRFC4380())
return NET_TEREDO;
return addr->GetNetwork();
}
/** Calculates a metric for how reachable (*this) is from a given partner */
int CNetAddr::GetReachabilityFrom(const CNetAddr *paddrPartner) const
{
enum Reachability {
REACH_UNREACHABLE,
REACH_DEFAULT,
REACH_TEREDO,
REACH_IPV6_WEAK,
REACH_IPV4,
REACH_IPV6_STRONG,
REACH_PRIVATE
};
if (!IsRoutable())
return REACH_UNREACHABLE;
int ourNet = GetExtNetwork(this);
int theirNet = GetExtNetwork(paddrPartner);
bool fTunnel = IsRFC3964() || IsRFC6052() || IsRFC6145();
switch(theirNet) {
case NET_IPV4:
switch(ourNet) {
default: return REACH_DEFAULT;
case NET_IPV4: return REACH_IPV4;
}
case NET_IPV6:
switch(ourNet) {
default: return REACH_DEFAULT;
case NET_TEREDO: return REACH_TEREDO;
case NET_IPV4: return REACH_IPV4;
case NET_IPV6: return fTunnel ? REACH_IPV6_WEAK : REACH_IPV6_STRONG; // only prefer giving our IPv6 address if it's not tunneled
}
case NET_TOR:
switch(ourNet) {
default: return REACH_DEFAULT;
case NET_IPV4: return REACH_IPV4; // Tor users can connect to IPv4 as well
case NET_TOR: return REACH_PRIVATE;
}
case NET_I2P:
switch(ourNet) {
default: return REACH_DEFAULT;
case NET_I2P: return REACH_PRIVATE;
}
case NET_TEREDO:
switch(ourNet) {
default: return REACH_DEFAULT;
case NET_TEREDO: return REACH_TEREDO;
case NET_IPV6: return REACH_IPV6_WEAK;
case NET_IPV4: return REACH_IPV4;
}
case NET_UNKNOWN:
case NET_UNROUTABLE:
default:
switch(ourNet) {
default: return REACH_DEFAULT;
case NET_TEREDO: return REACH_TEREDO;
case NET_IPV6: return REACH_IPV6_WEAK;
case NET_IPV4: return REACH_IPV4;
case NET_I2P: return REACH_PRIVATE; // assume connections from unroutable addresses are
case NET_TOR: return REACH_PRIVATE; // either from Tor/I2P, or don't care about our address
}
}
}
void CService::Init()
{
port = 0;
}
CService::CService()
{
Init();
}
CService::CService(const CNetAddr& cip, unsigned short portIn) : CNetAddr(cip), port(portIn)
{
}
CService::CService(const struct in_addr& ipv4Addr, unsigned short portIn) : CNetAddr(ipv4Addr), port(portIn)
{
}
#ifdef USE_IPV6
CService::CService(const struct in6_addr& ipv6Addr, unsigned short portIn) : CNetAddr(ipv6Addr), port(portIn)
{
}
#endif
CService::CService(const struct sockaddr_in& addr) : CNetAddr(addr.sin_addr), port(ntohs(addr.sin_port))
{
assert(addr.sin_family == AF_INET);
}
#ifdef USE_IPV6
CService::CService(const struct sockaddr_in6 &addr) : CNetAddr(addr.sin6_addr), port(ntohs(addr.sin6_port))
{
assert(addr.sin6_family == AF_INET6);
}
#endif
bool CService::SetSockAddr(const struct sockaddr *paddr)
{
switch (paddr->sa_family) {
case AF_INET:
*this = CService(*(const struct sockaddr_in*)paddr);
return true;
#ifdef USE_IPV6
case AF_INET6:
*this = CService(*(const struct sockaddr_in6*)paddr);
return true;
#endif
default:
return false;
}
}
CService::CService(const char *pszIpPort, bool fAllowLookup)
{
Init();
CService ip;
if (Lookup(pszIpPort, ip, 0, fAllowLookup))
*this = ip;
}
CService::CService(const char *pszIpPort, int portDefault, bool fAllowLookup)
{
Init();
CService ip;
if (Lookup(pszIpPort, ip, portDefault, fAllowLookup))
*this = ip;
}
CService::CService(const std::string &strIpPort, bool fAllowLookup)
{
Init();
CService ip;
if (Lookup(strIpPort.c_str(), ip, 0, fAllowLookup))
*this = ip;
}
CService::CService(const std::string &strIpPort, int portDefault, bool fAllowLookup)
{
Init();
CService ip;
if (Lookup(strIpPort.c_str(), ip, portDefault, fAllowLookup))
*this = ip;
}
unsigned short CService::GetPort() const
{
return port;
}
bool operator==(const CService& a, const CService& b)
{
return (CNetAddr)a == (CNetAddr)b && a.port == b.port;
}
bool operator!=(const CService& a, const CService& b)
{
return (CNetAddr)a != (CNetAddr)b || a.port != b.port;
}
bool operator<(const CService& a, const CService& b)
{
return (CNetAddr)a < (CNetAddr)b || ((CNetAddr)a == (CNetAddr)b && a.port < b.port);
}
bool CService::GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const
{
if (IsIPv4()) {
if (*addrlen < (socklen_t)sizeof(struct sockaddr_in))
return false;
*addrlen = sizeof(struct sockaddr_in);
struct sockaddr_in *paddrin = (struct sockaddr_in*)paddr;
memset(paddrin, 0, *addrlen);
if (!GetInAddr(&paddrin->sin_addr))
return false;
paddrin->sin_family = AF_INET;
paddrin->sin_port = htons(port);
return true;
}
#ifdef USE_IPV6
if (IsIPv6()) {
if (*addrlen < (socklen_t)sizeof(struct sockaddr_in6))
return false;
*addrlen = sizeof(struct sockaddr_in6);
struct sockaddr_in6 *paddrin6 = (struct sockaddr_in6*)paddr;
memset(paddrin6, 0, *addrlen);
if (!GetIn6Addr(&paddrin6->sin6_addr))
return false;
paddrin6->sin6_family = AF_INET6;
paddrin6->sin6_port = htons(port);
return true;
}
#endif
return false;
}
std::vector<unsigned char> CService::GetKey() const
{
std::vector<unsigned char> vKey;
vKey.resize(18);
memcpy(&vKey[0], ip, 16);
vKey[16] = port / 0x100;
vKey[17] = port & 0x0FF;
return vKey;
}
std::string CService::ToStringPort() const
{
return strprintf("%i", port);
}
std::string CService::ToStringIPPort() const
{
if (IsIPv4() || IsTor() || IsI2P()) {
return ToStringIP() + ":" + ToStringPort();
} else {
return "[" + ToStringIP() + "]:" + ToStringPort();
}
}
std::string CService::ToString() const
{
return ToStringIPPort();
}
void CService::print() const
{
printf("CService(%s)\n", ToString().c_str());
}
void CService::SetPort(unsigned short portIn)
{
port = portIn;
}
| dallen6/bluecoin | src/netbase.cpp | C++ | mit | 32,522 |
/*
组件列表 外在肌肤,水嫩丝滑
生成时间:Sat Dec 17 2016 破门狂人R2-D2为您服务!
*/
.list{
}
.lib-list-item{
display: block;
color: #393939;
border: 1px solid #ddd;
border-radius: 5px;
text-align: center;
line-height: 2.2;
}
.lib-list-item:hover{
box-shadow:0px 2px 10px #c9c9c9;
color: #f6eaa2;
text-shadow:none;
background-color: #2c4c8c;
}
.lib-list-item>div{
width: 100%;
height: 150px;
overflow: hidden;
background-position: center;
background-size: 100% auto;
} | FaceRollTheKeyboard/Excalibur | package/list/list.css | CSS | mit | 562 |
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html lang="en" xmlns="http://www.w3.org/1999/html"> <!--<![endif]-->
<head>
<!-- Basic Page Needs
================================================== -->
<meta charset="utf-8" />
<title>icon-laptop: Font Awesome Icons</title>
<meta name="description" content="Font Awesome, the iconic font designed for Bootstrap">
<meta name="author" content="Dave Gandy">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<!--<meta name="viewport" content="initial-scale=1; maximum-scale=1">-->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- CSS
================================================== -->
<link rel="stylesheet" href="../../assets/css/site.css">
<link rel="stylesheet" href="../../assets/css/pygments.css">
<link rel="stylesheet" href="../../assets/font-awesome/css/font-awesome.css">
<!--[if IE 7]>
<link rel="stylesheet" href="../../assets/font-awesome/css/font-awesome-ie7.css">
<![endif]-->
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="../../assets/ico/favicon.ico">
<script type="text/javascript" src="//use.typekit.net/wnc7ioh.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-30136587-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body data-spy="scroll" data-target=".navbar">
<div class="wrapper"> <!-- necessary for sticky footer. wrap all content except footer -->
<div class="navbar navbar-inverse navbar-static-top hidden-print">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="../../"><i class="icon-flag"></i> Font Awesome</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="hidden-tablet "><a href="../../">Home</a></li>
<li><a href="../../get-started/">Get Started</a></li>
<li class="dropdown-split-left"><a href="../../icons/">Icons</a></li>
<li class="dropdown dropdown-split-right hidden-phone">
<a href="javascript:" class="dropdown-toggle" data-toggle="dropdown">
<i class="icon-caret-down"></i>
</a>
<ul class="dropdown-menu pull-right">
<li><a href="../../icons/"><i class="icon-flag icon-fixed-width"></i> Icons</a></li>
<li class="divider"></li>
<li><a href="../../icons/#new"><i class="icon-shield icon-fixed-width"></i> New Icons in 3.2.1</a></li>
<li><a href="../../icons/#web-application"><i class="icon-camera-retro icon-fixed-width"></i> Web Application Icons</a></li>
<li><a href="../../icons/#currency"><i class="icon-won icon-fixed-width"></i> Currency Icons</a></li>
<li><a href="../../icons/#text-editor"><i class="icon-file-text-alt icon-fixed-width"></i> Text Editor Icons</a></li>
<li><a href="../../icons/#directional"><i class="icon-hand-right icon-fixed-width"></i> Directional Icons</a></li>
<li><a href="../../icons/#video-player"><i class="icon-play-sign icon-fixed-width"></i> Video Player Icons</a></li>
<li><a href="../../icons/#brand"><i class="icon-github icon-fixed-width"></i> Brand Icons</a></li>
<li><a href="../../icons/#medical"><i class="icon-medkit icon-fixed-width"></i> Medical Icons</a></li>
</ul>
</li>
<li class="dropdown-split-left"><a href="../../examples/">Examples</a></li>
<li class="dropdown dropdown-split-right hidden-phone">
<a href="javascript:" class="dropdown-toggle" data-toggle="dropdown">
<i class="icon-caret-down"></i>
</a>
<ul class="dropdown-menu pull-right">
<li><a href="../../examples/">Examples</a></li>
<li class="divider"></li>
<li><a href="../../examples/#new-styles">New Styles</a></li>
<li><a href="../../examples/#inline-icons">Inline Icons</a></li>
<li><a href="../../examples/#larger-icons">Larger Icons</a></li>
<li><a href="../../examples/#bordered-pulled">Bordered & Pulled</a></li>
<li><a href="../../examples/#buttons">Buttons</a></li>
<li><a href="../../examples/#button-groups">Button Groups</a></li>
<li><a href="../../examples/#button-dropdowns">Button Dropdowns</a></li>
<li><a href="../../examples/#bulleted-lists">Bulleted Lists</a></li>
<li><a href="../../examples/#navigation">Navigation</a></li>
<li><a href="../../examples/#form-inputs">Form Inputs</a></li>
<li><a href="../../examples/#animated-spinner">Animated Spinner</a></li>
<li><a href="../../examples/#rotated-flipped">Rotated & Flipped</a></li>
<li><a href="../../examples/#stacked">Stacked</a></li>
<li><a href="../../examples/#custom">Custom CSS</a></li>
</ul>
</li>
<li><a href="../../whats-new/">
<span class="hidden-tablet">What's </span>New</a>
</li>
<li><a href="../../community/">Community</a></li>
<li><a href="../../license/">License</a></li>
</ul>
<ul class="nav pull-right">
<li><a href="http://blog.fontawesome.io">Blog</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="jumbotron jumbotron-icon">
<div class="container">
<div class="info-icons">
<i class="icon-laptop icon-6"></i>
<span class="hidden-phone">
<i class="icon-laptop icon-5"></i>
<span class="hidden-tablet"><i class="icon-laptop icon-4"></i> </span>
<i class="icon-laptop icon-3"></i>
<i class="icon-laptop icon-2"></i>
</span>
<i class="icon-laptop icon-1"></i>
</div>
<h1 class="info-class">
icon-laptop
<small>
<i class="icon-laptop"></i> ·
Unicode: <span class="upper">f109</span> ·
Created: v3.0 ·
Categories:
Web Application Icons
</small>
</h1>
</div>
</div>
<div class="container">
<section>
<div class="row-fluid">
<div class="span9">
<p>After you get <a href="../../integration/">up and running</a>, you can place Font Awesome icons just about anywhere with the <code><i></code> tag:</p>
<div class="well well-transparent">
<div style="font-size: 24px; line-height: 1.5em;">
<i class="icon-laptop"></i> icon-laptop
</div>
</div>
<div class="highlight"><pre><code class="html"><span class="nt"><i</span> <span class="na">class=</span><span class="s">"icon-laptop"</span><span class="nt">></i></span> icon-laptop
</code></pre></div>
<br>
<div class="lead"><i class="icon-info-sign"></i> Looking for more? Check out the <a href="../../examples/">examples</a>.</div>
</div>
<div class="span3">
<div class="info-ad"><div id="carbonads-container"><div class="carbonad"><div id="azcarbon"></div><script type="text/javascript">var z = document.createElement("script"); z.type = "text/javascript"; z.async = true; z.src = "http://engine.carbonads.com/z/32291/azcarbon_2_1_0_VERT"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(z, s);</script></div></div>
</div>
</div>
</div>
</section>
</div>
<div class="push"><!-- necessary for sticky footer --></div>
</div>
<footer class="footer hidden-print">
<div class="container text-center">
<div>
<i class="icon-flag"></i> Font Awesome 3.2.1
<span class="hidden-phone">·</span><br class="visible-phone">
Created and Maintained by <a href="http://twitter.com/davegandy">Dave Gandy</a>
</div>
<div>
Font Awesome licensed under <a href="http://scripts.sil.org/OFL">SIL OFL 1.1</a>
<span class="hidden-phone">·</span><br class="visible-phone">
Code licensed under <a href="http://opensource.org/licenses/mit-license.html">MIT License</a>
<span class="hidden-phone hidden-tablet">·</span><br class="visible-phone visible-tablet">
Documentation licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>
</div>
<div>
Thanks to <a href="http://maxcdn.com"><i class="icon-maxcdn"></i> MaxCDN</a> for providing the excellent <a href="http://www.bootstrapcdn.com/#tab_fontawesome">BootstrapCDN for Font Awesome</a>
</div>
<div class="project">
<a href="https://github.com/FortAwesome/Font-Awesome">GitHub Project</a> ·
<a href="https://github.com/FortAwesome/Font-Awesome/issues">Issues</a>
</div>
</div>
</footer>
<script src="http://platform.twitter.com/widgets.js"></script>
<script src="../../assets/js/jquery-1.7.1.min.js"></script>
<script src="../../assets/js/ZeroClipboard-1.1.7.min.js"></script>
<script src="../../assets/js/bootstrap-2.3.1.min.js"></script>
<script src="../../assets/js/site.js"></script>
</body>
</html>
| MooseFrankenstein/Bootstarlight | bower_components/font-awesome/src/3.2.1/icon/laptop/index.html | HTML | mit | 10,109 |
'use strict';
/*
* * angular-socialshare v0.0.2
* * ♡ CopyHeart 2014 by Dayanand Prabhu http://djds4rce.github.io
* * Copying is an act of love. Please copy.
* */
angular.module('djds4rce.angular-socialshare', [])
.factory('$FB', ['$window', function($window) {
return {
init: function(fbId) {
if (fbId) {
this.fbId = fbId;
$window.fbAsyncInit = function() {
FB.init({
appId: fbId,
channelUrl: 'app/channel.html',
status: true,
xfbml: true
});
};
(function(d) {
var js,
id = 'facebook-jssdk',
ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {
return;
}
js = d.createElement('script');
js.id = id;
js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
} else {
throw ("FB App Id Cannot be blank");
}
}
};
}]).directive('facebook', ['$http', function($http) {
return {
scope: {
callback: '=',
shares: '='
},
transclude: true,
template: '<div class="facebookButton">' +
'<div class="pluginButton">' +
'<div class="pluginButtonContainer">' +
'<div class="pluginButtonImage">' +
'<button type="button">' +
'<i class="pluginButtonIcon img sp_plugin-button-2x sx_plugin-button-2x_favblue"></i>' +
'</button>' +
'</div>' +
'<span class="pluginButtonLabel">Share</span>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="facebookCount">' +
'<div class="pluginCountButton pluginCountNum">' +
'<span ng-transclude></span>' +
'</div>' +
'<div class="pluginCountButtonNub"><s></s><i></i></div>' +
'</div>',
link: function(scope, element, attr) {
attr.$observe('url', function() {
if (attr.shares && attr.url) {
$http.get('https://api.facebook.com/method/links.getStats?urls=' + attr.url + '&format=json', {withCredentials: false}).success(function(res) {
var count = (res[0] && res[0].total_count) ? res[0].total_count.toString() : 0;
var decimal = '';
if (count.length > 6) {
if (count.slice(-6, -5) != "0") {
decimal = '.' + count.slice(-6, -5);
}
count = count.slice(0, -6);
count = count + decimal + 'M';
} else if (count.length > 3) {
if (count.slice(-3, -2) != "0") {
decimal = '.' + count.slice(-3, -2);
}
count = count.slice(0, -3);
count = count + decimal + 'k';
}
scope.shares = count;
}).error(function() {
scope.shares = 0;
});
}
element.unbind();
element.bind('click', function(e) {
FB.ui({
method: 'share',
href: attr.url
}, function(response){
if (scope.callback !== undefined && typeof scope.callback === "function") {
scope.callback(response);
}
});
e.preventDefault();
});
});
}
};
}]).directive('facebookFeedShare', ['$http', function($http) {
return {
scope: {
callback: '=',
shares: '='
},
transclude: true,
template: '<div class="facebookButton">' +
'<div class="pluginButton">' +
'<div class="pluginButtonContainer">' +
'<div class="pluginButtonImage">' +
'<button type="button">' +
'<i class="pluginButtonIcon img sp_plugin-button-2x sx_plugin-button-2x_favblue"></i>' +
'</button>' +
'</div>' +
'<span class="pluginButtonLabel">Share</span>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="facebookCount">' +
'<div class="pluginCountButton pluginCountNum">' +
'<span ng-transclude></span>' +
'</div>' +
'<div class="pluginCountButtonNub"><s></s><i></i></div>' +
'</div>',
link: function(scope, element, attr) {
attr.$observe('url', function() {
if (attr.shares && attr.url) {
$http.get('https://api.facebook.com/method/links.getStats?urls=' + attr.url + '&format=json', {withCredentials: false}).success(function(res) {
var count = res[0] ? res[0].total_count.toString() : 0;
var decimal = '';
if (count.length > 6) {
if (count.slice(-6, -5) != "0") {
decimal = '.' + count.slice(-6, -5);
}
count = count.slice(0, -6);
count = count + decimal + 'M';
} else if (count.length > 3) {
if (count.slice(-3, -2) != "0") {
decimal = '.' + count.slice(-3, -2);
}
count = count.slice(0, -3);
count = count + decimal + 'k';
}
scope.shares = count;
}).error(function() {
scope.shares = 0;
});
}
element.unbind();
element.bind('click', function(e) {
FB.ui({
method: 'feed',
link: attr.url,
picture: attr.picture,
name: attr.name,
caption: attr.caption,
description: attr.description
}, function(response){
if (scope.callback !== undefined && typeof scope.callback === "function") {
scope.callback(response);
}
});
e.preventDefault();
});
});
}
};
}]).directive('twitter', ['$timeout', function($timeout) {
return {
link: function(scope, element, attr) {
var renderTwitterButton = debounce(function() {
if (attr.url) {
$timeout(function() {
element[0].innerHTML = '';
twttr.widgets.createShareButton(
attr.url,
element[0],
function() {}, {
count: attr.count,
text: attr.text,
via: attr.via,
size: attr.size
}
);
});
}
}, 75);
attr.$observe('url', renderTwitterButton);
attr.$observe('text', renderTwitterButton);
}
};
}]).directive('linkedin', ['$timeout', '$http', '$window', function($timeout, $http, $window) {
return {
scope: {
shares: '='
},
transclude: true,
template: '<div class="linkedinButton">' +
'<div class="pluginButton">' +
'<div class="pluginButtonContainer">' +
'<div class="pluginButtonImage">in' +
'</div>' +
'<span class="pluginButtonLabel"><span>Share</span></span>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="linkedinCount">' +
'<div class="pluginCountButton">' +
'<div class="pluginCountButtonRight">' +
'<div class="pluginCountButtonLeft">' +
'<span ng-transclude></span>' +
'</div>' +
'</div>' +
'</div>' +
'</div>',
link: function(scope, element, attr) {
var renderLinkedinButton = debounce(function() {
if (attr.shares && attr.url) {
$http.jsonp('https://www.linkedin.com/countserv/count/share?url=' + attr.url + '&callback=JSON_CALLBACK&format=jsonp').success(function(res) {
scope.shares = res.count.toLocaleString();
}).error(function() {
scope.shares = 0;
});
}
$timeout(function() {
element.unbind();
element.bind('click', function() {
var url = encodeURIComponent(attr.url).replace(/'/g, "%27").replace(/"/g, "%22")
$window.open("//www.linkedin.com/shareArticle?mini=true&url=" + url + "&title=" + attr.title + "&summary=" + attr.summary);
});
});
}, 100);
attr.$observe('url', renderLinkedinButton);
attr.$observe('title', renderLinkedinButton);
attr.$observe('summary', renderLinkedinButton);
}
};
}]).directive('gplus', [function() {
return {
link: function(scope, element, attr) {
var googleShare = debounce(function() {
if (typeof gapi == "undefined") {
(function() {
var po = document.createElement('script');
po.type = 'text/javascript';
po.async = true;
po.src = 'https://apis.google.com/js/platform.js';
po.onload = renderGoogleButton;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
})();
} else {
renderGoogleButton();
}
}, 100);
//voodo magic
var renderGoogleButton = (function(ele, attr) {
return function() {
var googleButton = document.createElement('div');
var id = attr.id || randomString(5);
attr.id = id;
googleButton.setAttribute('id', id);
element.innerHTML = '';
element.append(googleButton);
if (attr.class && attr.class.indexOf('g-plusone') != -1) {
window.gapi.plusone.render(id, attr);
} else {
window.gapi.plus.render(id, attr);
}
}
}(element, attr));
attr.$observe('href', googleShare);
}
};
}]).directive('tumblrText', [function() {
return {
link: function(scope, element, attr) {
var tumblr_button = document.createElement("a");
var renderTumblrText = debounce(function() {
tumblr_button.setAttribute("href", "https://www.tumblr.com/share/link?url=" + encodeURIComponent(attr.url) + "&name=" + encodeURIComponent(attr.name) + "&description=" + encodeURIComponent(attr.description));
tumblr_button.setAttribute("title", attr.title || "Share on Tumblr");
tumblr_button.setAttribute("style", attr.styling || "display:inline-block; text-indent:-9999px; overflow:hidden; width:81px; height:20px; background:url('https://platform.tumblr.com/v1/share_1.png') top left no-repeat transparent;");
element[0].innerHTML = '';
element.append(tumblr_button);
}, 100);
attr.$observe('url', renderTumblrText);
attr.$observe('name', renderTumblrText);
attr.$observe('description', renderTumblrText);
}
}
}]).directive('tumblrQoute', [function() {
return {
link: function(scope, element, attr) {
var tumblr_button = document.createElement("a");
var renderTumblrQoute = debounce(function() {
tumblr_button.setAttribute("href", "https://www.tumblr.com/share/quote?quote=" + encodeURIComponent(attr.qoute) + "&source=" + encodeURIComponent(attr.source));
tumblr_button.setAttribute("title", attr.title || "Share on Tumblr");
tumblr_button.setAttribute("style", attr.styling || "display:inline-block; text-indent:-9999px; overflow:hidden; width:81px; height:20px; background:url('https://platform.tumblr.com/v1/share_1.png') top left no-repeat transparent;");
element[0].innerHTML = '';
element.append(tumblr_button);
}, 100);
attr.$observe('qoute', renderTumblrQoute);
attr.$observe('source', renderTumblrQoute);
}
}
}]).directive('tumblrImage', [function() {
return {
link: function(scope, element, attr) {
var tumblr_button = document.createElement("a");
var renderTumblrImage = debounce(function() {
tumblr_button.setAttribute("href", "https://www.tumblr.com/share/photo?source=" + encodeURIComponent(attr.source) + "&caption=" + encodeURIComponent(attr.caption) + "&clickthru=" + encodeURIComponent(attr.clickthru));
tumblr_button.setAttribute("title", attr.title || "Share on Tumblr");
tumblr_button.setAttribute("style", attr.styling || "display:inline-block; text-indent:-9999px; overflow:hidden; width:81px; height:20px; background:url('https://platform.tumblr.com/v1/share_1.png') top left no-repeat transparent;");
element[0].innerHTML = '';
element.append(tumblr_button);
}, 100);
attr.$observe('source', renderTumblrImage);
attr.$observe('caption', renderTumblrImage);
attr.$observe('clickthru', renderTumblrImage);
}
}
}]).directive('tumblrVideo', [function() {
return {
link: function(scope, element, attr) {
var tumblr_button = document.createElement("a");
var renderTumblrVideo = debounce(function() {
tumblr_button.setAttribute("href", "https://www.tumblr.com/share/video?embed=" + encodeURIComponent(attr.embedcode) + "&caption=" + encodeURIComponent(attr.caption));
tumblr_button.setAttribute("title", attr.title || "Share on Tumblr");
tumblr_button.setAttribute("style", attr.styling || "display:inline-block; text-indent:-9999px; overflow:hidden; width:81px; height:20px; background:url('https://platform.tumblr.com/v1/share_1.png') top left no-repeat transparent;");
element[0].innerHTML = '';
element.append(tumblr_button);
}, 100);
attr.$observe('embedcode', renderTumblrVideo);
attr.$observe('caption', renderTumblrVideo);
}
}
}]).directive('pintrest', ['$window', '$timeout', function($window, $timeout) {
return {
template: '<a href="{{href}}" data-pin-do="{{pinDo}}" data-pin-config="{{pinConfig}}"><img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png" /></a>',
link: function(scope, element, attr) {
var pintrestButtonRenderer = debounce(function() {
var pin_button = document.createElement("a");
pin_button.setAttribute("href", '//www.pinterest.com/pin/create/button/?url=' + encodeURIComponent(attr.href) + '&media=' + encodeURIComponent(attr.img) + '&description=' + encodeURIComponent(attr.description));
pin_button.setAttribute("pinDo", attr.pinDo || "buttonPin");
pin_button.setAttribute("pinConfig", attr.pinConfig || "beside");
element[0].innerHTML = '';
element.append(pin_button);
$timeout(function() {
$window.parsePins(element);
});
}, 100);
attr.$observe('href', pintrestButtonRenderer);
attr.$observe('img', pintrestButtonRenderer);
attr.$observe('description', pintrestButtonRenderer);
}
}
}]);
//Simple Debounce Implementation
//http://davidwalsh.name/javascript-debounce-function
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this,
args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
};
//http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript
/**
* RANDOM STRING GENERATOR
*
* Info: http://stackoverflow.com/a/27872144/383904
* Use: randomString(length [,"A"] [,"N"] );
* Default: return a random alpha-numeric string
* Arguments: If you use the optional "A", "N" flags:
* "A" (Alpha flag) return random a-Z string
* "N" (Numeric flag) return random 0-9 string
*/
function randomString(len, an) {
an = an && an.toLowerCase();
var str = "",
i = 0,
min = an == "a" ? 10 : 0,
max = an == "n" ? 10 : 62;
for (; i++ < len;) {
var r = Math.random() * (max - min) + min << 0;
str += String.fromCharCode(r += r > 9 ? r < 36 ? 55 : 61 : 48);
}
return str;
}
| khiettran/gofar | public/scripts/libs/bower/angular-socialshare.js | JavaScript | mit | 14,491 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using System.Globalization;
namespace DevTreks.Extensions
{
/// <summary>
///Purpose: Serialize and deserialize a food nutrition cost object.
/// This calculator is used with inputs to calculate costs.
///Author: www.devtreks.org
///Date: 2014, June
///References: www.devtreks.org/helptreks/linkedviews/help/linkedview/HelpFile/148
///NOTES 1. Extends the base object MNSR1 object
///</summary>
public class MNC1Calculator : MNSR1
{
public MNC1Calculator()
: base()
{
//health care cost object
InitMNC1Properties();
}
//copy constructor
public MNC1Calculator(MNC1Calculator lca1Calc)
: base(lca1Calc)
{
CopyMNC1Properties(lca1Calc);
}
//need to store locals and update parent input.ocprice, aohprice, capprice
public Input MNCInput { get; set; }
public virtual void InitMNC1Properties()
{
//avoid null references to properties
this.InitCalculatorProperties();
this.InitSharedObjectProperties();
this.InitMNSR1Properties();
this.MNCInput = new Input();
}
public virtual void CopyMNC1Properties(
MNC1Calculator calculator)
{
this.CopyCalculatorProperties(calculator);
this.CopySharedObjectProperties(calculator);
this.CopyMNSR1Properties(calculator);
this.MNCInput = new Input(calculator.MNCInput);
}
//set the class properties using the XElement
public virtual void SetMNC1Properties(XElement calculator,
XElement currentElement)
{
this.SetCalculatorProperties(calculator);
//need the aggregating params (label, groupid, typeid and Date for sorting)
this.SetSharedObjectProperties(currentElement);
this.SetMNSR1Properties(calculator);
}
//attname and attvalue generally passed in from a reader
public virtual void SetMNC1Property(string attName,
string attValue)
{
this.SetMNSR1Property(attName, attValue);
}
public void SetMNC1Attributes(string attNameExtension,
ref XElement calculator)
{
//must remove old unwanted attributes
if (calculator != null)
{
//do not remove atts here, they were removed in prior this.MNCInput.SetInputAtts
//and now include good locals
//this also sets the aggregating atts
this.SetAndRemoveCalculatorAttributes(attNameExtension, ref calculator);
}
this.SetMNSR1Attributes(attNameExtension, ref calculator);
}
public virtual void SetMNC1Attributes(string attNameExtension,
ref XmlWriter writer)
{
//note must first use use either setanalyzeratts or SetCalculatorAttributes(attNameExtension, ref writer);
this.SetMNSR1Attributes(attNameExtension, ref writer);
}
public bool SetMNC1Calculations(
MN1CalculatorHelper.CALCULATOR_TYPES calculatorType,
CalculatorParameters calcParameters, ref XElement calculator,
ref XElement currentElement)
{
bool bHasCalculations = false;
string sErrorMessage = string.Empty;
InitMNC1Properties();
//deserialize xml to object
//set the base input properties (updates base input prices)
//locals come from input
this.MNCInput.SetInputProperties(calcParameters,
calculator, currentElement);
//set the calculator
this.SetMNC1Properties(calculator, currentElement);
bHasCalculations = RunMNC1Calculations(calcParameters);
if (calcParameters.SubApplicationType == Constants.SUBAPPLICATION_TYPES.inputprices)
{
//serialize object back to xml and fill in updates list
//this also removes atts
this.MNCInput.SetInputAttributes(calcParameters,
ref currentElement, calcParameters.Updates);
}
else
{
//no db updates outside base output
this.MNCInput.SetInputAttributes(calcParameters,
ref currentElement, null);
}
//this sets and removes some atts
this.SetMNC1Attributes(string.Empty, ref calculator);
//set the totals into calculator
this.MNCInput.SetNewInputAttributes(calcParameters, ref calculator);
//set calculatorid (primary way to display calculation attributes)
CalculatorHelpers.SetCalculatorId(
calculator, currentElement);
calcParameters.ErrorMessage = sErrorMessage;
return bHasCalculations;
}
public bool RunMNC1Calculations(CalculatorParameters calcParameters)
{
bool bHasCalculations = false;
//first figure quantities
UpdateBaseInputUnitPrices(calcParameters);
//then figure whether ocamount or capamount should be used as a multiplier
//times calcd by stock.multiplier
double multiplier = GetMultiplierForMNSR1();
//run cost calcs
bHasCalculations = this.RunMNSR1Calculations(calcParameters, multiplier);
return bHasCalculations;
}
private void UpdateBaseInputUnitPrices(
CalculatorParameters calcParameters)
{
//is being able to change ins and outs in tech elements scalable?? double check
//check illegal divisors
this.ContainerSizeInSSUnits = (this.ContainerSizeInSSUnits == 0)
? -1 : this.ContainerSizeInSSUnits;
this.TypicalServingsPerContainer = this.ContainerSizeInSSUnits / this.TypicalServingSize;
this.ActualServingsPerContainer = this.ContainerSizeInSSUnits / this.ActualServingSize;
//Actual serving size has to be 1 unit of hh measure
if (calcParameters.SubApplicationType == Constants.SUBAPPLICATION_TYPES.inputprices)
{
//tech analysis can change from base
this.MNCInput.OCAmount = 1;
}
//calculate OCPrice as a unit cost per serving (not per each unit of serving or ContainerSizeInSSUnits)
this.MNCInput.OCPrice = this.ContainerPrice / this.ActualServingsPerContainer;
//serving size is the unit cost
this.MNCInput.OCUnit = string.Concat(this.ActualServingSize, " ", this.ServingSizeUnit);
//transfer capprice (benefits need to track the package price using calculator.props)
this.MNCInput.CAPPrice = this.ContainerPrice;
this.MNCInput.CAPUnit = this.ContainerUnit;
if (this.MNCInput.CAPAmount > 0)
{
this.ServingCost = this.MNCInput.CAPPrice * this.MNCInput.CAPAmount;
this.MNCInput.TotalCAP = this.ServingCost;
}
else
{
//calculate cost per actual serving
//note that this can change when the input is added elsewhere
this.ServingCost = this.MNCInput.OCPrice * this.MNCInput.OCAmount;
this.MNCInput.TotalOC = this.ServingCost;
}
}
public double GetMultiplierForMNSR1()
{
double multiplier = 1;
if (this.MNCInput.CAPAmount > 0)
{
//cap budget can use container size for nutrient values
multiplier = this.ActualServingsPerContainer * this.MNCInput.CAPAmount;
}
else if (this.MNCInput.CAPAmount <= 0)
{
//op budget can use ocamount for nutrient values
multiplier = this.MNCInput.OCAmount;
}
return multiplier;
}
}
}
| kpboyle1/devtreks | src/DevTreks.Extensions/MN1/Statistics/MNC1Calculator.cs | C# | mit | 8,301 |
angular.module('myApp.toDoController', []).
controller('ToDoCtrl', ['$scope', '$state', '$http', '$route', function ($scope, $state, $http, $route) {
$scope.$state = $state;
$scope.addToDo = function() {
// Just in case...
if ($scope.toDoList.length > 50) {
alert("Exceeded to-do limit!!!");
return;
}
if (!$scope.newToDoName || !$scope.newToDoDesc) {
alert("Please fill out both fields!");
return;
}
var newToDo = {
'todo': $scope.newToDoName,
'description': $scope.newToDoDesc
};
$http.post('/to-dos/add-to-do', newToDo).
success(function(data, status, headers, config) {
}).
then(function(answer){
$scope.newToDoName = '';
$scope.newToDoDesc = '';
getToDos();
});
};
$scope.editToDoId = '';
$scope.editToDo = function(toDo) {
// Set the ID of the todo being edited
$scope.editToDoId = toDo._id;
// Reset the to do list in case we were editing other to dos
getToDos();
};
$scope.confirmEditToDo = function() {
// Get the data from the ToDo of interest
var toDoToEdit = '';
for (var i=0; i<$scope.toDoList.length; i++) {
if ($scope.toDoList[i]._id === $scope.editToDoId){
toDoToEdit = {
"todo" : $scope.toDoList[i].todo,
"description" : $scope.toDoList[i].description
};
break;
}
}
if (!toDoToEdit) {
alert("Could not get edited to-do!");
return;
} else if (!toDoToEdit.todo || !toDoToEdit.description) {
alert("Please fill out both fields!");
return;
}
$http.put('/to-dos/update-to-do/' + $scope.editToDoId, toDoToEdit).
success(function(data, status, headers, config) {
$scope.editToDoId = '';
}).
then(function(answer){
getToDos();
});
};
$scope.deleteToDo = function(toDo) {
var confirmation = confirm('Are you sure you want to delete?');
if (!confirmation){
return;
}
$http.delete('/to-dos/delete-to-do/' + toDo._id).
success(function(data, status, headers, config) {
}).
then(function(answer){
getToDos();
});
};
$scope.cancelEditToDo = function() {
$scope.editToDoId = '';
getToDos();
};
var getToDos = function() {
$http.get('/to-dos/to-dos').success(function(data, status, headers, config) {
$scope.toDoList = data;
});
};
// Execute these functions on page load
angular.element(document).ready(function () {
getToDos();
});
}]); | The-Lando-System/personal-website | app/to-do/toDoController.js | JavaScript | mit | 2,424 |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.data.cosmos.internal.query;
import com.azure.data.cosmos.BadRequestException;
import com.azure.data.cosmos.BridgeInternal;
import com.azure.data.cosmos.CommonsBridgeInternal;
import com.azure.data.cosmos.internal.DocumentCollection;
import com.azure.data.cosmos.FeedOptions;
import com.azure.data.cosmos.Resource;
import com.azure.data.cosmos.SqlQuerySpec;
import com.azure.data.cosmos.internal.HttpConstants;
import com.azure.data.cosmos.internal.OperationType;
import com.azure.data.cosmos.internal.PartitionKeyRange;
import com.azure.data.cosmos.internal.ResourceType;
import com.azure.data.cosmos.internal.RxDocumentServiceRequest;
import com.azure.data.cosmos.internal.Strings;
import com.azure.data.cosmos.internal.Utils;
import com.azure.data.cosmos.internal.caches.RxCollectionCache;
import com.azure.data.cosmos.internal.routing.PartitionKeyInternal;
import com.azure.data.cosmos.internal.routing.Range;
import org.apache.commons.lang3.StringUtils;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
/**
* While this class is public, but it is not part of our published public APIs.
* This is meant to be internally used only by our sdk.
*/
public class DocumentQueryExecutionContextFactory {
private final static int PageSizeFactorForTop = 5;
private static Mono<Utils.ValueHolder<DocumentCollection>> resolveCollection(IDocumentQueryClient client, SqlQuerySpec query,
ResourceType resourceTypeEnum, String resourceLink) {
RxCollectionCache collectionCache = client.getCollectionCache();
RxDocumentServiceRequest request = RxDocumentServiceRequest.create(
OperationType.Query,
resourceTypeEnum,
resourceLink, null
// TODO AuthorizationTokenType.INVALID)
); //this request doesnt actually go to server
return collectionCache.resolveCollectionAsync(request);
}
public static <T extends Resource> Flux<? extends IDocumentQueryExecutionContext<T>> createDocumentQueryExecutionContextAsync(
IDocumentQueryClient client,
ResourceType resourceTypeEnum,
Class<T> resourceType,
SqlQuerySpec query,
FeedOptions feedOptions,
String resourceLink,
boolean isContinuationExpected,
UUID correlatedActivityId) {
// return proxy
Flux<Utils.ValueHolder<DocumentCollection>> collectionObs = Flux.just(new Utils.ValueHolder<>(null));
if (resourceTypeEnum.isCollectionChild()) {
collectionObs = resolveCollection(client, query, resourceTypeEnum, resourceLink).flux();
}
DefaultDocumentQueryExecutionContext<T> queryExecutionContext = new DefaultDocumentQueryExecutionContext<T>(
client,
resourceTypeEnum,
resourceType,
query,
feedOptions,
resourceLink,
correlatedActivityId,
isContinuationExpected);
if (ResourceType.Document != resourceTypeEnum) {
return Flux.just(queryExecutionContext);
}
Mono<PartitionedQueryExecutionInfo> queryExecutionInfoMono =
com.azure.data.cosmos.internal.query.QueryPlanRetriever.getQueryPlanThroughGatewayAsync(client, query, resourceLink);
return collectionObs.single().flatMap(collectionValueHolder ->
queryExecutionInfoMono.flatMap(partitionedQueryExecutionInfo -> {
QueryInfo queryInfo =
partitionedQueryExecutionInfo.getQueryInfo();
// Non value aggregates must go through
// DefaultDocumentQueryExecutionContext
// Single partition query can serve queries like SELECT AVG(c
// .age) FROM c
// SELECT MIN(c.age) + 5 FROM c
// SELECT MIN(c.age), MAX(c.age) FROM c
// while pipelined queries can only serve
// SELECT VALUE <AGGREGATE>. So we send the query down the old
// pipeline to avoid a breaking change.
// Should be fixed by adding support for nonvalueaggregates
if (queryInfo.hasAggregates() && !queryInfo.hasSelectValue()) {
if (feedOptions != null && feedOptions.enableCrossPartitionQuery()) {
return Mono.error(BridgeInternal.createCosmosClientException(HttpConstants.StatusCodes.BADREQUEST,
"Cross partition query only supports 'VALUE " +
"<AggreateFunc>' for aggregates"));
}
return Mono.just(queryExecutionContext);
}
Mono<List<PartitionKeyRange>> partitionKeyRanges;
// The partitionKeyRangeIdInternal is no more a public API on FeedOptions, but have the below condition
// for handling ParallelDocumentQueryTest#partitionKeyRangeId
if (feedOptions != null && !StringUtils.isEmpty(CommonsBridgeInternal.partitionKeyRangeIdInternal(feedOptions))) {
partitionKeyRanges = queryExecutionContext.getTargetPartitionKeyRangesById(collectionValueHolder.v.resourceId(),
CommonsBridgeInternal.partitionKeyRangeIdInternal(feedOptions));
} else {
List<Range<String>> queryRanges =
partitionedQueryExecutionInfo.getQueryRanges();
if (feedOptions != null && feedOptions.partitionKey() != null) {
PartitionKeyInternal internalPartitionKey =
feedOptions.partitionKey()
.getInternalPartitionKey();
Range<String> range = Range.getPointRange(internalPartitionKey
.getEffectivePartitionKeyString(internalPartitionKey,
collectionValueHolder.v.getPartitionKey()));
queryRanges = Collections.singletonList(range);
}
partitionKeyRanges = queryExecutionContext
.getTargetPartitionKeyRanges(collectionValueHolder.v.resourceId(), queryRanges);
}
return partitionKeyRanges
.flatMap(pkranges -> createSpecializedDocumentQueryExecutionContextAsync(client,
resourceTypeEnum,
resourceType,
query,
feedOptions,
resourceLink,
isContinuationExpected,
partitionedQueryExecutionInfo,
pkranges,
collectionValueHolder.v.resourceId(),
correlatedActivityId).single());
})).flux();
}
public static <T extends Resource> Flux<? extends IDocumentQueryExecutionContext<T>> createSpecializedDocumentQueryExecutionContextAsync(
IDocumentQueryClient client,
ResourceType resourceTypeEnum,
Class<T> resourceType,
SqlQuerySpec query,
FeedOptions feedOptions,
String resourceLink,
boolean isContinuationExpected,
PartitionedQueryExecutionInfo partitionedQueryExecutionInfo,
List<PartitionKeyRange> targetRanges,
String collectionRid,
UUID correlatedActivityId) {
if (feedOptions == null) {
feedOptions = new FeedOptions();
}
int initialPageSize = Utils.getValueOrDefault(feedOptions.maxItemCount(),
ParallelQueryConfig.ClientInternalPageSize);
BadRequestException validationError = Utils.checkRequestOrReturnException(
initialPageSize > 0 || initialPageSize == -1, "MaxItemCount", "Invalid MaxItemCount %s", initialPageSize);
if (validationError != null) {
return Flux.error(validationError);
}
QueryInfo queryInfo = partitionedQueryExecutionInfo.getQueryInfo();
if (!Strings.isNullOrEmpty(queryInfo.getRewrittenQuery())) {
query = new SqlQuerySpec(queryInfo.getRewrittenQuery(), query.parameters());
}
boolean getLazyFeedResponse = queryInfo.hasTop();
// We need to compute the optimal initial page size for order-by queries
if (queryInfo.hasOrderBy()) {
int top;
if (queryInfo.hasTop() && (top = partitionedQueryExecutionInfo.getQueryInfo().getTop()) > 0) {
int pageSizeWithTop = Math.min(
(int)Math.ceil(top / (double)targetRanges.size()) * PageSizeFactorForTop,
top);
if (initialPageSize > 0) {
initialPageSize = Math.min(pageSizeWithTop, initialPageSize);
}
else {
initialPageSize = pageSizeWithTop;
}
}
// TODO: do not support continuation in string format right now
// else if (isContinuationExpected)
// {
// if (initialPageSize < 0)
// {
// initialPageSize = (int)Math.Max(feedOptions.MaxBufferedItemCount, ParallelQueryConfig.GetConfig().DefaultMaximumBufferSize);
// }
//
// initialPageSize = Math.Min(
// (int)Math.Ceiling(initialPageSize / (double)targetRanges.Count) * PageSizeFactorForTop,
// initialPageSize);
// }
}
return PipelinedDocumentQueryExecutionContext.createAsync(
client,
resourceTypeEnum,
resourceType,
query,
feedOptions,
resourceLink,
collectionRid,
partitionedQueryExecutionInfo,
targetRanges,
initialPageSize,
isContinuationExpected,
getLazyFeedResponse,
correlatedActivityId);
}
}
| navalev/azure-sdk-for-java | sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/DocumentQueryExecutionContextFactory.java | Java | mit | 11,381 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Coq bench</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../../..">Unstable</a></li>
<li><a href=".">8.4.dev / contrib:aac-tactics dev</a></li>
<li class="active"><a href="">2014-12-13 08:31:47</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="../../../../../about.html">About</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href=".">« Up</a>
<h1>
contrib:aac-tactics
<small>
dev
<span class="label label-info">Not compatible with this Coq</span>
</small>
</h1>
<p><em><script>document.write(moment("2014-12-13 08:31:47 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2014-12-13 08:31:47 UTC)</em><p>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>ruby lint.rb unstable ../unstable/packages/coq:contrib:aac-tactics/coq:contrib:aac-tactics.dev</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
<dt>Output</dt>
<dd><pre>The package is valid.
</pre></dd>
</dl>
<h2>Dry install</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --dry-run coq:contrib:aac-tactics.dev coq.8.4.dev</code></dd>
<dt>Return code</dt>
<dd>768</dd>
<dt>Duration</dt>
<dd>0 s</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.4.dev).
The following dependencies couldn't be met:
- coq:contrib:aac-tactics -> coq >= dev
Your request can't be satisfied:
- Conflicting version constraints for coq
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq, to test if the problem was incompatibility with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --dry-run coq:contrib:aac-tactics.dev</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>3 s</dd>
<dt>Output</dt>
<dd><pre>The following actions will be performed:
- remove coq.8.4.dev
=== 1 to remove ===
=-=- Removing Packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Removing coq.8.4.dev.
[WARNING] Directory /home/bench/.opam/system/lib/coq is not empty, not removing
[WARNING] Directory /home/bench/.opam/system/share/coq is not empty, not removing
The following actions will be performed:
- install coq.hott [required by coq:contrib:aac-tactics]
- install coq:contrib:aac-tactics.dev
=== 2 to install ===
=-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Building coq.hott:
./configure -configdir /home/bench/.opam/system/lib/coq/config -mandir /home/bench/.opam/system/man -docdir /home/bench/.opam/system/doc -prefix /home/bench/.opam/system -usecamlp5 -camlp5dir /home/bench/.opam/system/lib/camlp5 -coqide no
make -j4
make install
Installing coq.hott.
Building coq:contrib:aac-tactics.dev:
coq_makefile -f Make -o Makefile
make -j4
make install
Installing coq:contrib:aac-tactics.dev.
</pre></dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
<small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small>
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html> | coq-bench/coq-bench.github.io-old | clean/Linux-x86_64-4.02.1-1.2.0/unstable/8.4.dev/contrib:aac-tactics/dev/2014-12-13_08-31-47.html | HTML | mit | 6,956 |
import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
Construct empty object.
"""
self.num_lines = 0
self.remaining_lines = MAX_NUM_LINES
self.lines = []
def insert(self, string):
"""
Insert string at the end. This always begins a new line.
"""
if (self.num_lines >= MAX_NUM_LINES):
pass
input_num_lines = num_lines(string)
#if (input_num_lines > self.remaining_lines):
# num = self.remaining_lines
#else:
# num = input_num_lines
num = input_num_lines
new_lines = get_lines(string)
self.lines += new_lines[-num:]
self.update_num_lines()
def merge_after(self, obj):
"""
Merge with another CmdText object by appending the input objects content.
"""
self.lines
def strip_lines(self):
"""
Remove excessive number of lines. This deletes the oldest half.
"""
if (self.num_lines > MAX_NUM_STORED_LINES):
for i in range(MAX_NUM_STORED_LINES // 2):
self.lines.pop(i)
def update_num_lines(self):
"""
Update the number of lines member.
"""
self.num_lines = len(self.lines)
def get_line(self, n):
"""
Return the line with index n.
"""
if n < self.num_lines:
return self.lines[n]
else:
raise IndexError("Line index out of range.")
def print_screen(self):
"""
Return MAX_NUM_LINES lines.
"""
return self.lines[-MAX_NUM_LINES:]
def __iter__(self):
"""
Iterator for CmdText object.
"""
for l in self.lines:
yield l
def __getitem__(self, ind):
return self.lines[ind]
def num_lines(string):
"""
Return number of lines.
"""
line_list = string.split("\n")
num = len(line_list)
for l in line_list:
num += (len(string) // LINEWIDTH + 1)
return num
def get_lines(string):
"""
Return list of lines extracted from string.
"""
line_list = string.split('\n')
new_list = []
for l in line_list:
new_list += [l[i*LINEWIDTH:(i+1)*LINEWIDTH] for i in range(len(l) // LINEWIDTH + 1)]
return new_list
class Command(CmdText):
def __init__(self, string, rind=None):
CmdText.__init__(self)
self.insert(string)
if (rind is not None):
self.response = rind
class Response(CmdText):
def __init__(self, string, cind=None):
CmdText.__init__(self)
self.insert(string)
if (cind is not None):
self.command = cind
class TestCase(object):
"""
Base class for tests.
"""
@classmethod
def run(cls):
"""
Runs all tests (methods which begin with 'test').
"""
#print(cls)
max_len = max([len(a) for a in cls.__dict__])
for key in cls.__dict__:
if key.startswith("test"):
fill = max_len - len(key)
sys.stdout.write("Testing {} ...{} ".format(key, '.'*fill))
try:
cls.__dict__[key]()
except:
raise
else:
print("Test passed!")
print("All tests passed!")
class StaticTest(TestCase):
"""
Tests for static methods.
"""
def test_get_lines_with_empty_string():
assert get_lines("") == [""]
def test_get_lines_with_short_string():
assert len(get_lines("a"*(LINEWIDTH-1))) == 1
def test_get_lines_with_long_string():
assert len(get_lines("a"*(2*LINEWIDTH-1))) == 2
def test_get_lines_with_very_long_string():
assert len(get_lines("a"*(4*LINEWIDTH-1))) == 4
def test_get_lines_with_long_text_string():
text = "This is a test string, which should simulate real text. The command should" \
+ " correctly split this text into two lines."
LINEWIDTH = 80
correct_lines = [text[:LINEWIDTH], text[LINEWIDTH:]]
assert len(get_lines(text)) == len(text) // LINEWIDTH + 1
assert get_lines(text) == correct_lines
class CmdTextTest(object):
"""
Tests for CmdText class methods.
"""
pass | t-mertz/slurmCompanion | django-web/webcmd/cmdtext.py | Python | mit | 4,609 |
<?php
require_once (__DIR__ . '/../lib/bootstrap.php');
require_once (__DIR__ . '/lib/TestListener.php');
use PHPUnit\Framework\TestCase;
use Selenide\By, Selenide\Condition, Selenide\Selenide;
class ListenerTest extends TestCase
{
/**
* @var Selenide
*/
protected static $wd = null;
protected static $timeout = 5;
/**
* Url for test page in tests/www/webdrivertest.html
* @var string
*/
protected static $testUrl = '/';
protected static $baseUrl = 'http://127.0.0.1:8000';
protected static $config = null;
protected $backupStaticAttributesBlacklist = array(
'SelenideTest' => array('wd'),
);
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
self::$wd = new \Selenide\Selenide();
self::$wd->configuration()->baseUrl = self::config('selenium/baseUrl');
self::$wd->configuration()->host = self::config('selenium/host');
self::$wd->configuration()->port = self::config('selenium/port');
self::$wd->connect();
self::$wd->getDriver()->webDriver()->timeout()->implicitWait(1);
self::$wd->open(self::$testUrl);
$listener = new TestListener();
self::$wd->addListener($listener);
}
public function setUp()
{
parent::setUp();
self::$wd->getReport()->disable();
self::$wd->configuration()->timeout = self::$timeout;
TestListener::clean();
}
protected static function config($path)
{
if (self::$config === null) {
$configPath = __DIR__ . '/etc/config.php';
$devPath = __DIR__ . '/etc/config.dev.php';
$config = include ($configPath);
if (file_exists($devPath)) {
//only top level group replace
$devCfg = include ($devPath);
foreach ($devCfg as $name => $opts) {
$config[$name] = $opts;
}
}
self::$config = $config;
}
$path = explode('/', trim($path, '/'));
$value = self::$config;
foreach ($path as $nodeName) {
$value = $value[$nodeName];
}
return $value;
}
public function testListener_Click_CallListener()
{
$description = __METHOD__;
self::$wd
->description($description)
->find(By::withText('textTwo'))
->should(Condition::withText("textTwo"))
->shouldNot(Condition::withText("textOne"))
->click();
$this->assertCount(2, TestListener::$data, 'No data in listener');
$event = TestListener::$data[1];
$this->assertArrayHasKey('method', $event, 'No data about method');
$this->assertArrayHasKey('element', $event, 'No data about element');
$this->assertArrayHasKey('locator', $event, 'No data about locator');
$this->assertArrayHasKey('description', $event, 'No data about description');
$this->assertEquals('beforeClick', $event['method'], 'Must be called Listener::beforeClick');
$this->assertInstanceOf('Selenide\SelenideElement', $event['element'], 'Element must be is SelenideElement');
$this->assertGreaterThan(10, strlen($event['locator']), 'Locator too short');
$this->assertEquals(
$description, $event['description'], 'Description must equals is selenide->description()'
);
}
public function testListener_SetValue_CallListener()
{
$description = __METHOD__;
$textValue = 'washtub';
self::$wd
->description($description)
->find(By::id('e_textarea'))
->setValue($textValue);
$this->assertCount(2, TestListener::$data, 'No data in listener');
$event = TestListener::$data[1];
$this->assertArrayHasKey('method', $event, 'No data about method');
$this->assertArrayHasKey('element', $event, 'No data about element');
$this->assertArrayHasKey('locator', $event, 'No data about locator');
$this->assertArrayHasKey('value', $event, 'No data about value');
$this->assertArrayHasKey('description', $event, 'No data about description');
$this->assertEquals('beforeSetValue', $event['method'], 'Must be called Listener::beforeClick');
$this->assertEquals($textValue, $event['value'], 'Bad value of setValue');
$this->assertInstanceOf('Selenide\SelenideElement', $event['element'], 'Element must be is SelenideElement');
$this->assertGreaterThan(10, strlen($event['locator']), 'Locator too short');
$this->assertEquals(
$description, $event['description'], 'Description must equals is selenide->description()'
);
}
public function testListener_Assert_CallListener()
{
$description = __METHOD__;
self::$wd
->description($description)
->find(By::withText('textTwo'))
->assert(Condition::visible());
$this->assertCount(2, TestListener::$data, 'No data in listener');
$event = TestListener::$data[1];
$this->assertArrayHasKey('method', $event, 'No data about method');
$this->assertArrayHasKey('locator', $event, 'No data about locator');
$this->assertArrayHasKey('condition', $event, 'No data about condition');
$this->assertEquals('beforeAssert', $event['method'], 'Must be called Listener::beforeAssert');
$this->assertInstanceOf(
'Selenide\Condition_Rule', $event['condition'], 'Condition must be is Selenide\Condition_Rule'
);
$this->assertGreaterThan(10, strlen($event['locator']), 'Locator too short');
}
public function testListener_AssertNot_CallListener()
{
$description = __METHOD__;
self::$wd
->description($description)
->find(By::withText('textTwo'))
->assertNot(Condition::size(20));
$this->assertCount(2, TestListener::$data, 'No data in listener');
$event = TestListener::$data[1];
$this->assertArrayHasKey('method', $event, 'No data about method');
$this->assertArrayHasKey('locator', $event, 'No data about locator');
$this->assertArrayHasKey('condition', $event, 'No data about condition');
$this->assertEquals('beforeAssertNot', $event['method'], 'Must be called Listener::beforeAssertNot');
$this->assertInstanceOf(
'Selenide\Condition_Rule', $event['condition'], 'Condition must be is Selenide\Condition_Rule'
);
$this->assertGreaterThan(10, strlen($event['locator']), 'Locator too short');
}
}
| razielsd/phpSelenide | tests/ListenerTest.php | PHP | mit | 6,663 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FlatRedBall;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
namespace Anfloga.Rendering
{
public class BloomRenderer : IEffectsRenderer
{
public int Height { get; set; }
public int Width { get; set; }
public float BloomIntensity { get; set; } = 2f;
public float BaseIntensity { get; set; } = 0.9f;
public float BloomSaturation { get; set; } = 1.5f;
public float BaseSaturation { get; set; } = 1.0f;
SpriteBatch spriteBatch;
RenderTarget2D target1;
RenderTarget2D target2;
Effect bloomEffect;
BloomExtractRenderer extractRenderer;
BlurRenderer blurRenderer;
GraphicsDevice device;
bool initialized = false;
public BloomRenderer(Effect bloomCombineEffect)
{
this.bloomEffect = bloomCombineEffect;
}
public void Initialize(GraphicsDevice device, Camera camera)
{
Height = device.PresentationParameters.BackBufferHeight;
Width = device.PresentationParameters.BackBufferWidth;
this.device = device;
spriteBatch = new SpriteBatch(this.device);
// use half size texture for extract and blur
target1 = new RenderTarget2D(device, Width / 2, Height / 2);
target2 = new RenderTarget2D(device, Width, Height);
extractRenderer = new BloomExtractRenderer();
extractRenderer.Initialize(this.device, camera);
blurRenderer = new BlurRenderer();
blurRenderer.Initialize(this.device, camera);
bloomEffect.Parameters["BloomIntensity"].SetValue(BloomIntensity);
bloomEffect.Parameters["BaseIntensity"].SetValue(BaseIntensity);
bloomEffect.Parameters["BloomSaturation"].SetValue(BloomSaturation);
bloomEffect.Parameters["BaseSaturation"].SetValue(BaseSaturation);
initialized = true;
}
public void Draw(RenderTarget2D src, RenderTarget2D dest)
{
if(!initialized)
{
throw new Exception("Draw was called before effect was initialized!");
}
// draw src buffer with extract effect to target1 buffer
extractRenderer.Draw(src, target1);
// draw extract buffer to target2 with blur
blurRenderer.Draw(target1, target2);
int destWidth = dest != null ? dest.Width : Width;
int destHeight = dest != null ? dest.Height : Height;
// finally perform our bloom combine
device.Textures[1] = src; // setting this allows the shader to operate on the src texture
device.SetRenderTarget(dest);
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, bloomEffect);
spriteBatch.Draw(target2, new Rectangle(0, 0, destWidth, destHeight), Color.White);
spriteBatch.End();
}
}
}
| vchelaru/Anfloga | Anfloga/Anfloga/Rendering/BloomRenderer.cs | C# | mit | 3,162 |
#[macro_export]
macro_rules! punctuator {
($lexer: ident, $p: ident) => ({
$lexer.iter.next();
Ok(Token::Punctuator(Punctuator::$p, $lexer.lo, $lexer.lo + 1))
})
}
// Advance iter and hi position if pattern match
#[macro_export]
macro_rules! take {
($lexer: ident, $($p: pat)|*) => (
match $lexer.iter.peek() {
$(
Some(&(i, $p)) => {
$lexer.iter.next();
$lexer.hi = i + 1;
true
}
)*
_ => false
});
}
#[macro_export]
macro_rules! take_while {
($lexer: ident, $($p: pat)|*) => ({
let mut is_taken = false;
while let Some(&(p, c)) = $lexer.iter.peek() {
match c {
$(
$p => {
$lexer.iter.next();
$lexer.hi = p + 1;
is_taken = true;
}
)*
_ => {
break;
}
}
}
is_taken
});
}
#[macro_export]
macro_rules! take_while_not {
($lexer: ident, $($p: pat)|*) => ({
let mut is_taken = false;
while let Some(&(p, c)) = $lexer.iter.peek() {
match c {
$(
$p => {
$lexer.hi = p;
break;
}
)*
_ => {
$lexer.iter.next();
is_taken = true;
}
}
}
is_taken
});
}
#[macro_export]
macro_rules! peek {
($lexer: ident, $($p: pat)|*) => (
match $lexer.iter.peek() {
$(
Some(&(_, $p)) => true,
)*
_ => false
});
}
// Advance iter if pattern match, keep hi position unchange
#[macro_export]
macro_rules! follow_by {
($lexer: ident, $($p: pat)|*) => (
match $lexer.iter.peek() {
$(
Some(&(_, $p)) => {
$lexer.iter.next();
true
}
)*
_ => false
});
}
| cksac/graphql-rs | graphql-language/src/lexer/macros.rs | Rust | mit | 1,813 |
//
// This source file is part of appleseed.
// Visit http://appleseedhq.net/ for additional information and resources.
//
// This software is released under the MIT license.
//
// Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited
// Copyright (c) 2014-2015 Francois Beaune, The appleseedhq Organization
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#ifndef APPLESEED_FOUNDATION_UTILITY_TEST_LOGGERTESTLISTENER_H
#define APPLESEED_FOUNDATION_UTILITY_TEST_LOGGERTESTLISTENER_H
// appleseed.main headers.
#include "main/dllsymbol.h"
// Forward declarations.
namespace foundation { class ITestListener; }
namespace foundation { class Logger; }
namespace foundation
{
//
// A test listener that forwards messages to a logger.
//
// Factory function.
APPLESEED_DLLSYMBOL ITestListener* create_logger_test_listener(
Logger& logger,
const bool verbose = false);
} // namespace foundation
#endif // !APPLESEED_FOUNDATION_UTILITY_TEST_LOGGERTESTLISTENER_H
| Vertexwahn/appleseed | src/appleseed/foundation/utility/test/loggertestlistener.h | C | mit | 2,026 |
/*
* Copyright (c) 2010, ETH Zurich.
* All rights reserved.
*
* INTERFACE NAME: mem
* INTEFACE FILE: ../if/mem.if
* INTERFACE DESCRIPTION: Memory allocation RPC interface
*
* This file is distributed under the terms in the attached LICENSE
* file. If you do not find this file, copies can be found by
* writing to:
* ETH Zurich D-INFK, Universitaetstr.6, CH-8092 Zurich.
* Attn: Systems Group.
*
* THIS FILE IS AUTOMATICALLY GENERATED BY FLOUNDER: DO NOT EDIT!
*/
#include <barrelfish/barrelfish.h>
#include <flounder/flounder_support.h>
#include <if/mem_defs.h>
/*
* Export function
*/
errval_t mem_export(void *st, idc_export_callback_fn *export_cb, mem_connect_fn *connect_cb, struct waitset *ws, idc_export_flags_t flags)
{
struct mem_export *e = malloc(sizeof(struct mem_export ));
if (e == NULL) {
return(LIB_ERR_MALLOC_FAIL);
}
// fill in common parts of export struct
e->connect_cb = connect_cb;
e->waitset = ws;
e->st = st;
(e->common).export_callback = export_cb;
(e->common).flags = flags;
(e->common).connect_cb_st = e;
(e->common).export_cb_st = st;
// fill in connect handler for each enabled backend
#ifdef CONFIG_FLOUNDER_BACKEND_LMP
(e->common).lmp_connect_callback = mem_lmp_connect_handler;
#endif // CONFIG_FLOUNDER_BACKEND_LMP
#ifdef CONFIG_FLOUNDER_BACKEND_UMP
(e->common).ump_connect_callback = mem_ump_connect_handler;
#endif // CONFIG_FLOUNDER_BACKEND_UMP
#ifdef CONFIG_FLOUNDER_BACKEND_UMP_IPI
(e->common).ump_connect_callback = mem_ump_ipi_connect_handler;
#endif // CONFIG_FLOUNDER_BACKEND_UMP_IPI
#ifdef CONFIG_FLOUNDER_BACKEND_MULTIHOP
(e->common).multihop_connect_callback = mem_multihop_connect_handler;
#endif // CONFIG_FLOUNDER_BACKEND_MULTIHOP
return(idc_export_service(&(e->common)));
}
/*
* Generic bind function
*/
static void mem_bind_continuation_direct(void *st, errval_t err, struct mem_binding *_binding)
{
// This bind cont function uses the different backends in the following order:
// lmp ump_ipi ump multihop
struct flounder_generic_bind_attempt *b = st;
switch (b->driver_num) {
case 0:
(b->driver_num)++;
#ifdef CONFIG_FLOUNDER_BACKEND_LMP
// try next backend
b->binding = malloc(sizeof(struct mem_lmp_binding ));
assert((b->binding) != NULL);
err = mem_lmp_bind(b->binding, b->iref, mem_bind_continuation_direct, b, b->waitset, b->flags, DEFAULT_LMP_BUF_WORDS);
if (err_is_fail(err)) {
free(b->binding);
_binding = NULL;
goto out;
} else {
return;
}
#else
// skip non-enabled backend (fall through)
#endif // CONFIG_FLOUNDER_BACKEND_LMP
case 1:
#ifdef CONFIG_FLOUNDER_BACKEND_LMP
if (err_is_ok(err)) {
goto out;
} else {
free(b->binding);
if (err_no(err) == MON_ERR_IDC_BIND_NOT_SAME_CORE) {
goto try_next_1;
} else {
// report permanent failure to user
_binding = NULL;
goto out;
}
}
try_next_1:
#endif // CONFIG_FLOUNDER_BACKEND_LMP
(b->driver_num)++;
#ifdef CONFIG_FLOUNDER_BACKEND_UMP_IPI
// try next backend
b->binding = malloc(sizeof(struct mem_ump_ipi_binding ));
assert((b->binding) != NULL);
err = mem_ump_ipi_bind(b->binding, b->iref, mem_bind_continuation_direct, b, b->waitset, b->flags, DEFAULT_UMP_BUFLEN, DEFAULT_UMP_BUFLEN);
if (err_is_fail(err)) {
free(b->binding);
_binding = NULL;
goto out;
} else {
return;
}
#else
// skip non-enabled backend (fall through)
#endif // CONFIG_FLOUNDER_BACKEND_UMP_IPI
case 2:
#ifdef CONFIG_FLOUNDER_BACKEND_UMP_IPI
if (err_is_ok(err)) {
goto out;
} else {
free(b->binding);
if (true) {
goto try_next_2;
} else {
// report permanent failure to user
_binding = NULL;
goto out;
}
}
try_next_2:
#endif // CONFIG_FLOUNDER_BACKEND_UMP_IPI
(b->driver_num)++;
#ifdef CONFIG_FLOUNDER_BACKEND_UMP
// try next backend
b->binding = malloc(sizeof(struct mem_ump_binding ));
assert((b->binding) != NULL);
err = mem_ump_bind(b->binding, b->iref, mem_bind_continuation_direct, b, b->waitset, b->flags, DEFAULT_UMP_BUFLEN, DEFAULT_UMP_BUFLEN);
if (err_is_fail(err)) {
free(b->binding);
_binding = NULL;
goto out;
} else {
return;
}
#else
// skip non-enabled backend (fall through)
#endif // CONFIG_FLOUNDER_BACKEND_UMP
case 3:
#ifdef CONFIG_FLOUNDER_BACKEND_UMP
if (err_is_ok(err)) {
goto out;
} else {
free(b->binding);
if (true) {
goto try_next_3;
} else {
// report permanent failure to user
_binding = NULL;
goto out;
}
}
try_next_3:
#endif // CONFIG_FLOUNDER_BACKEND_UMP
(b->driver_num)++;
#ifdef CONFIG_FLOUNDER_BACKEND_MULTIHOP
// try next backend
b->binding = malloc(sizeof(struct mem_multihop_binding ));
assert((b->binding) != NULL);
err = mem_multihop_bind(b->binding, b->iref, mem_bind_continuation_direct, b, b->waitset, b->flags);
if (err_is_fail(err)) {
free(b->binding);
_binding = NULL;
goto out;
} else {
return;
}
#else
// skip non-enabled backend (fall through)
#endif // CONFIG_FLOUNDER_BACKEND_MULTIHOP
case 4:
#ifdef CONFIG_FLOUNDER_BACKEND_MULTIHOP
if (err_is_ok(err)) {
goto out;
} else {
free(b->binding);
if (!true) {
_binding = NULL;
goto out;
}
}
#endif // CONFIG_FLOUNDER_BACKEND_MULTIHOP
err = FLOUNDER_ERR_GENERIC_BIND_NO_MORE_DRIVERS;
_binding = NULL;
goto out;
default:
assert(!("invalid state"));
}
out:
((mem_bind_continuation_fn *)(b->callback))(b->st, err, _binding);
free(b);
}
static void mem_bind_contination_multihop(void *st, errval_t err, struct mem_binding *_binding)
{
// This bind cont function uses the different backends in the following order:
// lmp multihop ump_ipi ump
struct flounder_generic_bind_attempt *b = st;
switch (b->driver_num) {
case 0:
(b->driver_num)++;
#ifdef CONFIG_FLOUNDER_BACKEND_LMP
// try next backend
b->binding = malloc(sizeof(struct mem_lmp_binding ));
assert((b->binding) != NULL);
err = mem_lmp_bind(b->binding, b->iref, mem_bind_contination_multihop, b, b->waitset, b->flags, DEFAULT_LMP_BUF_WORDS);
if (err_is_fail(err)) {
free(b->binding);
_binding = NULL;
goto out;
} else {
return;
}
#else
// skip non-enabled backend (fall through)
#endif // CONFIG_FLOUNDER_BACKEND_LMP
case 1:
#ifdef CONFIG_FLOUNDER_BACKEND_LMP
if (err_is_ok(err)) {
goto out;
} else {
free(b->binding);
if (err_no(err) == MON_ERR_IDC_BIND_NOT_SAME_CORE) {
goto try_next_1;
} else {
// report permanent failure to user
_binding = NULL;
goto out;
}
}
try_next_1:
#endif // CONFIG_FLOUNDER_BACKEND_LMP
(b->driver_num)++;
#ifdef CONFIG_FLOUNDER_BACKEND_MULTIHOP
// try next backend
b->binding = malloc(sizeof(struct mem_multihop_binding ));
assert((b->binding) != NULL);
err = mem_multihop_bind(b->binding, b->iref, mem_bind_contination_multihop, b, b->waitset, b->flags);
if (err_is_fail(err)) {
free(b->binding);
_binding = NULL;
goto out;
} else {
return;
}
#else
// skip non-enabled backend (fall through)
#endif // CONFIG_FLOUNDER_BACKEND_MULTIHOP
case 2:
#ifdef CONFIG_FLOUNDER_BACKEND_MULTIHOP
if (err_is_ok(err)) {
goto out;
} else {
free(b->binding);
if (true) {
goto try_next_2;
} else {
// report permanent failure to user
_binding = NULL;
goto out;
}
}
try_next_2:
#endif // CONFIG_FLOUNDER_BACKEND_MULTIHOP
(b->driver_num)++;
#ifdef CONFIG_FLOUNDER_BACKEND_UMP_IPI
// try next backend
b->binding = malloc(sizeof(struct mem_ump_ipi_binding ));
assert((b->binding) != NULL);
err = mem_ump_ipi_bind(b->binding, b->iref, mem_bind_contination_multihop, b, b->waitset, b->flags, DEFAULT_UMP_BUFLEN, DEFAULT_UMP_BUFLEN);
if (err_is_fail(err)) {
free(b->binding);
_binding = NULL;
goto out;
} else {
return;
}
#else
// skip non-enabled backend (fall through)
#endif // CONFIG_FLOUNDER_BACKEND_UMP_IPI
case 3:
#ifdef CONFIG_FLOUNDER_BACKEND_UMP_IPI
if (err_is_ok(err)) {
goto out;
} else {
free(b->binding);
if (true) {
goto try_next_3;
} else {
// report permanent failure to user
_binding = NULL;
goto out;
}
}
try_next_3:
#endif // CONFIG_FLOUNDER_BACKEND_UMP_IPI
(b->driver_num)++;
#ifdef CONFIG_FLOUNDER_BACKEND_UMP
// try next backend
b->binding = malloc(sizeof(struct mem_ump_binding ));
assert((b->binding) != NULL);
err = mem_ump_bind(b->binding, b->iref, mem_bind_contination_multihop, b, b->waitset, b->flags, DEFAULT_UMP_BUFLEN, DEFAULT_UMP_BUFLEN);
if (err_is_fail(err)) {
free(b->binding);
_binding = NULL;
goto out;
} else {
return;
}
#else
// skip non-enabled backend (fall through)
#endif // CONFIG_FLOUNDER_BACKEND_UMP
case 4:
#ifdef CONFIG_FLOUNDER_BACKEND_UMP
if (err_is_ok(err)) {
goto out;
} else {
free(b->binding);
if (!true) {
_binding = NULL;
goto out;
}
}
#endif // CONFIG_FLOUNDER_BACKEND_UMP
err = FLOUNDER_ERR_GENERIC_BIND_NO_MORE_DRIVERS;
_binding = NULL;
goto out;
default:
assert(!("invalid state"));
}
out:
((mem_bind_continuation_fn *)(b->callback))(b->st, err, _binding);
free(b);
}
errval_t mem_bind(iref_t iref, mem_bind_continuation_fn *_continuation, void *st, struct waitset *waitset, idc_bind_flags_t flags)
{
// allocate state
struct flounder_generic_bind_attempt *b = malloc(sizeof(struct flounder_generic_bind_attempt ));
if (b == NULL) {
return(LIB_ERR_MALLOC_FAIL);
}
// fill in binding state
b->iref = iref;
b->waitset = waitset;
b->driver_num = 0;
b->callback = _continuation;
b->st = st;
b->flags = flags;
if (flags & IDC_BIND_FLAG_MULTIHOP) {
mem_bind_contination_multihop(b, SYS_ERR_OK, NULL);
} else {
mem_bind_continuation_direct(b, SYS_ERR_OK, NULL);
}
return(SYS_ERR_OK);
}
/*
* Copyright (c) 2010, ETH Zurich.
* All rights reserved.
*
* INTERFACE NAME: mem
* INTEFACE FILE: ../if/mem.if
* INTERFACE DESCRIPTION: Memory allocation RPC interface
*
* This file is distributed under the terms in the attached LICENSE
* file. If you do not find this file, copies can be found by
* writing to:
* ETH Zurich D-INFK, Universitaetstr.6, CH-8092 Zurich.
* Attn: Systems Group.
*
* THIS FILE IS AUTOMATICALLY GENERATED BY FLOUNDER: DO NOT EDIT!
*/
/*
* Generated Stub for LMP on x86_64
*/
#include <string.h>
#include <barrelfish/barrelfish.h>
#include <flounder/flounder_support.h>
#include <flounder/flounder_support_lmp.h>
#include <if/mem_defs.h>
/*
* Send handler functions
*/
static void mem_allocate_call__lmp_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_lmp_binding *b = arg;
errval_t err;
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
err = lmp_chan_send3(&(b->chan), b->flags, NULL_CAP, mem_allocate_call__msgnum | (((uintptr_t )(((_binding->tx_union).allocate_call).bits)) << 16), ((_binding->tx_union).allocate_call).minbase, ((_binding->tx_union).allocate_call).maxlimit);
if (err_is_ok(err)) {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
} else {
break;
}
default:
assert(!("invalid fragment"));
err = FLOUNDER_ERR_INVALID_STATE;
}
if (lmp_err_is_transient(err)) {
// Construct retry closure and register it
struct event_closure retry_closure = (struct event_closure){ .handler = mem_allocate_call__lmp_send_handler, .arg = arg };
err = lmp_chan_register_send(&(b->chan), _binding->waitset, retry_closure);
assert(err_is_ok(err));
} else {
// Report error to user
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
}
}
static void mem_allocate_response__lmp_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_lmp_binding *b = arg;
errval_t err;
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
err = lmp_chan_send2(&(b->chan), b->flags, ((_binding->tx_union).allocate_response).mem_cap, mem_allocate_response__msgnum, ((_binding->tx_union).allocate_response).ret);
if (err_is_ok(err)) {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
} else {
break;
}
default:
assert(!("invalid fragment"));
err = FLOUNDER_ERR_INVALID_STATE;
}
if (lmp_err_is_transient(err)) {
// Construct retry closure and register it
struct event_closure retry_closure = (struct event_closure){ .handler = mem_allocate_response__lmp_send_handler, .arg = arg };
err = lmp_chan_register_send(&(b->chan), _binding->waitset, retry_closure);
assert(err_is_ok(err));
} else {
// Report error to user
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
}
}
static void mem_steal_call__lmp_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_lmp_binding *b = arg;
errval_t err;
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
err = lmp_chan_send3(&(b->chan), b->flags, NULL_CAP, mem_steal_call__msgnum | (((uintptr_t )(((_binding->tx_union).steal_call).bits)) << 16), ((_binding->tx_union).steal_call).minbase, ((_binding->tx_union).steal_call).maxlimit);
if (err_is_ok(err)) {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
} else {
break;
}
default:
assert(!("invalid fragment"));
err = FLOUNDER_ERR_INVALID_STATE;
}
if (lmp_err_is_transient(err)) {
// Construct retry closure and register it
struct event_closure retry_closure = (struct event_closure){ .handler = mem_steal_call__lmp_send_handler, .arg = arg };
err = lmp_chan_register_send(&(b->chan), _binding->waitset, retry_closure);
assert(err_is_ok(err));
} else {
// Report error to user
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
}
}
static void mem_steal_response__lmp_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_lmp_binding *b = arg;
errval_t err;
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
err = lmp_chan_send2(&(b->chan), b->flags, ((_binding->tx_union).steal_response).mem_cap, mem_steal_response__msgnum, ((_binding->tx_union).steal_response).ret);
if (err_is_ok(err)) {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
} else {
break;
}
default:
assert(!("invalid fragment"));
err = FLOUNDER_ERR_INVALID_STATE;
}
if (lmp_err_is_transient(err)) {
// Construct retry closure and register it
struct event_closure retry_closure = (struct event_closure){ .handler = mem_steal_response__lmp_send_handler, .arg = arg };
err = lmp_chan_register_send(&(b->chan), _binding->waitset, retry_closure);
assert(err_is_ok(err));
} else {
// Report error to user
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
}
}
static void mem_available_call__lmp_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_lmp_binding *b = arg;
errval_t err;
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
err = lmp_chan_send1(&(b->chan), b->flags, NULL_CAP, mem_available_call__msgnum);
if (err_is_ok(err)) {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
} else {
break;
}
default:
assert(!("invalid fragment"));
err = FLOUNDER_ERR_INVALID_STATE;
}
if (lmp_err_is_transient(err)) {
// Construct retry closure and register it
struct event_closure retry_closure = (struct event_closure){ .handler = mem_available_call__lmp_send_handler, .arg = arg };
err = lmp_chan_register_send(&(b->chan), _binding->waitset, retry_closure);
assert(err_is_ok(err));
} else {
// Report error to user
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
}
}
static void mem_available_response__lmp_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_lmp_binding *b = arg;
errval_t err;
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
err = lmp_chan_send3(&(b->chan), b->flags, NULL_CAP, mem_available_response__msgnum, ((_binding->tx_union).available_response).mem_avail, ((_binding->tx_union).available_response).mem_total);
if (err_is_ok(err)) {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
} else {
break;
}
default:
assert(!("invalid fragment"));
err = FLOUNDER_ERR_INVALID_STATE;
}
if (lmp_err_is_transient(err)) {
// Construct retry closure and register it
struct event_closure retry_closure = (struct event_closure){ .handler = mem_available_response__lmp_send_handler, .arg = arg };
err = lmp_chan_register_send(&(b->chan), _binding->waitset, retry_closure);
assert(err_is_ok(err));
} else {
// Report error to user
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
}
}
static void mem_free_monitor_call__lmp_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_lmp_binding *b = arg;
errval_t err;
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
err = lmp_chan_send2(&(b->chan), b->flags, ((_binding->tx_union).free_monitor_call).mem_cap, mem_free_monitor_call__msgnum | (((uintptr_t )(((_binding->tx_union).free_monitor_call).bits)) << 16), ((_binding->tx_union).free_monitor_call).base);
if (err_is_ok(err)) {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
} else {
break;
}
default:
assert(!("invalid fragment"));
err = FLOUNDER_ERR_INVALID_STATE;
}
if (lmp_err_is_transient(err)) {
// Construct retry closure and register it
struct event_closure retry_closure = (struct event_closure){ .handler = mem_free_monitor_call__lmp_send_handler, .arg = arg };
err = lmp_chan_register_send(&(b->chan), _binding->waitset, retry_closure);
assert(err_is_ok(err));
} else {
// Report error to user
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
}
}
static void mem_free_monitor_response__lmp_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_lmp_binding *b = arg;
errval_t err;
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
err = lmp_chan_send2(&(b->chan), b->flags, NULL_CAP, mem_free_monitor_response__msgnum, ((_binding->tx_union).free_monitor_response).err);
if (err_is_ok(err)) {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
} else {
break;
}
default:
assert(!("invalid fragment"));
err = FLOUNDER_ERR_INVALID_STATE;
}
if (lmp_err_is_transient(err)) {
// Construct retry closure and register it
struct event_closure retry_closure = (struct event_closure){ .handler = mem_free_monitor_response__lmp_send_handler, .arg = arg };
err = lmp_chan_register_send(&(b->chan), _binding->waitset, retry_closure);
assert(err_is_ok(err));
} else {
// Report error to user
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
}
}
/*
* Message sender functions
*/
static errval_t mem_allocate_call__lmp_send(struct mem_binding *_binding, struct event_closure _continuation, uint8_t bits, mem_genpaddr_t minbase, mem_genpaddr_t maxlimit)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and arguments
_binding->tx_msgnum = mem_allocate_call__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).allocate_call).bits = bits;
((_binding->tx_union).allocate_call).minbase = minbase;
((_binding->tx_union).allocate_call).maxlimit = maxlimit;
FL_DEBUG("lmp TX mem.allocate_call\n");
// try to send!
mem_allocate_call__lmp_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_allocate_response__lmp_send(struct mem_binding *_binding, struct event_closure _continuation, mem_errval_t ret, struct capref mem_cap)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and arguments
_binding->tx_msgnum = mem_allocate_response__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).allocate_response).ret = ret;
((_binding->tx_union).allocate_response).mem_cap = mem_cap;
FL_DEBUG("lmp TX mem.allocate_response\n");
// try to send!
mem_allocate_response__lmp_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_steal_call__lmp_send(struct mem_binding *_binding, struct event_closure _continuation, uint8_t bits, mem_genpaddr_t minbase, mem_genpaddr_t maxlimit)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and arguments
_binding->tx_msgnum = mem_steal_call__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).steal_call).bits = bits;
((_binding->tx_union).steal_call).minbase = minbase;
((_binding->tx_union).steal_call).maxlimit = maxlimit;
FL_DEBUG("lmp TX mem.steal_call\n");
// try to send!
mem_steal_call__lmp_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_steal_response__lmp_send(struct mem_binding *_binding, struct event_closure _continuation, mem_errval_t ret, struct capref mem_cap)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and arguments
_binding->tx_msgnum = mem_steal_response__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).steal_response).ret = ret;
((_binding->tx_union).steal_response).mem_cap = mem_cap;
FL_DEBUG("lmp TX mem.steal_response\n");
// try to send!
mem_steal_response__lmp_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_available_call__lmp_send(struct mem_binding *_binding, struct event_closure _continuation)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and arguments
_binding->tx_msgnum = mem_available_call__msgnum;
_binding->tx_msg_fragment = 0;
FL_DEBUG("lmp TX mem.available_call\n");
// try to send!
mem_available_call__lmp_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_available_response__lmp_send(struct mem_binding *_binding, struct event_closure _continuation, mem_genpaddr_t mem_avail, mem_genpaddr_t mem_total)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and arguments
_binding->tx_msgnum = mem_available_response__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).available_response).mem_avail = mem_avail;
((_binding->tx_union).available_response).mem_total = mem_total;
FL_DEBUG("lmp TX mem.available_response\n");
// try to send!
mem_available_response__lmp_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_free_monitor_call__lmp_send(struct mem_binding *_binding, struct event_closure _continuation, struct capref mem_cap, mem_genpaddr_t base, uint8_t bits)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and arguments
_binding->tx_msgnum = mem_free_monitor_call__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).free_monitor_call).mem_cap = mem_cap;
((_binding->tx_union).free_monitor_call).base = base;
((_binding->tx_union).free_monitor_call).bits = bits;
FL_DEBUG("lmp TX mem.free_monitor_call\n");
// try to send!
mem_free_monitor_call__lmp_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_free_monitor_response__lmp_send(struct mem_binding *_binding, struct event_closure _continuation, mem_errval_t err)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and arguments
_binding->tx_msgnum = mem_free_monitor_response__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).free_monitor_response).err = err;
FL_DEBUG("lmp TX mem.free_monitor_response\n");
// try to send!
mem_free_monitor_response__lmp_send_handler(_binding);
return(SYS_ERR_OK);
}
/*
* Send vtable
*/
static struct mem_tx_vtbl mem_lmp_tx_vtbl = {
.allocate_call = mem_allocate_call__lmp_send,
.allocate_response = mem_allocate_response__lmp_send,
.steal_call = mem_steal_call__lmp_send,
.steal_response = mem_steal_response__lmp_send,
.available_call = mem_available_call__lmp_send,
.available_response = mem_available_response__lmp_send,
.free_monitor_call = mem_free_monitor_call__lmp_send,
.free_monitor_response = mem_free_monitor_response__lmp_send,
};
/*
* Receive handler
*/
void mem_lmp_rx_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_lmp_binding *b = arg;
errval_t err;
struct lmp_recv_msg msg = LMP_RECV_MSG_INIT;
struct capref cap;
struct event_closure recv_closure = (struct event_closure){ .handler = mem_lmp_rx_handler, .arg = arg };
do {
// try to retrieve a message from the channel
err = lmp_chan_recv(&(b->chan), &msg, &cap);
// check if we succeeded
if (err_is_fail(err)) {
if (err_no(err) == LIB_ERR_NO_LMP_MSG) {
// no message
break;
} else {
// real error
(_binding->error_handler)(_binding, err_push(err, LIB_ERR_LMP_CHAN_RECV));
return;
}
}
// allocate a new receive slot if needed
if (!capref_is_null(cap)) {
err = lmp_chan_alloc_recv_slot(&(b->chan));
if (err_is_fail(err)) {
(_binding->error_handler)(_binding, err_push(err, LIB_ERR_LMP_ALLOC_RECV_SLOT));
}
}
// is this the start of a new message?
if ((_binding->rx_msgnum) == 0) {
// check message length
if (((msg.buf).msglen) == 0) {
(_binding->error_handler)(_binding, FLOUNDER_ERR_RX_EMPTY_MSG);
break;
}
// unmarshall message number from first word, set fragment to 0
_binding->rx_msgnum = (((msg.words)[0]) & 0xffff);
_binding->rx_msg_fragment = 0;
}
// switch on message number and fragment number
switch (_binding->rx_msgnum) {
case mem_allocate_call__msgnum:
switch (_binding->rx_msg_fragment) {
case 0:
// check length
if (((msg.buf).msglen) > 4) {
(_binding->error_handler)(_binding, FLOUNDER_ERR_RX_INVALID_LENGTH);
goto out;
}
((_binding->rx_union).allocate_call).bits = ((((msg.words)[0]) >> 16) & 0xff);
((_binding->rx_union).allocate_call).minbase = ((msg.words)[1]);
((_binding->rx_union).allocate_call).maxlimit = ((msg.words)[2]);
FL_DEBUG("lmp RX mem.allocate_call\n");
assert(((_binding->rx_vtbl).allocate_call) != NULL);
((_binding->rx_vtbl).allocate_call)(_binding, ((_binding->rx_union).allocate_call).bits, ((_binding->rx_union).allocate_call).minbase, ((_binding->rx_union).allocate_call).maxlimit);
_binding->rx_msgnum = 0;
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
goto out;
}
break;
case mem_allocate_response__msgnum:
switch (_binding->rx_msg_fragment) {
case 0:
// check length
if (((msg.buf).msglen) > 4) {
(_binding->error_handler)(_binding, FLOUNDER_ERR_RX_INVALID_LENGTH);
goto out;
}
((_binding->rx_union).allocate_response).ret = ((msg.words)[1]);
((_binding->rx_union).allocate_response).mem_cap = cap;
FL_DEBUG("lmp RX mem.allocate_response\n");
assert(((_binding->rx_vtbl).allocate_response) != NULL);
((_binding->rx_vtbl).allocate_response)(_binding, ((_binding->rx_union).allocate_response).ret, ((_binding->rx_union).allocate_response).mem_cap);
_binding->rx_msgnum = 0;
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
goto out;
}
break;
case mem_steal_call__msgnum:
switch (_binding->rx_msg_fragment) {
case 0:
// check length
if (((msg.buf).msglen) > 4) {
(_binding->error_handler)(_binding, FLOUNDER_ERR_RX_INVALID_LENGTH);
goto out;
}
((_binding->rx_union).steal_call).bits = ((((msg.words)[0]) >> 16) & 0xff);
((_binding->rx_union).steal_call).minbase = ((msg.words)[1]);
((_binding->rx_union).steal_call).maxlimit = ((msg.words)[2]);
FL_DEBUG("lmp RX mem.steal_call\n");
assert(((_binding->rx_vtbl).steal_call) != NULL);
((_binding->rx_vtbl).steal_call)(_binding, ((_binding->rx_union).steal_call).bits, ((_binding->rx_union).steal_call).minbase, ((_binding->rx_union).steal_call).maxlimit);
_binding->rx_msgnum = 0;
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
goto out;
}
break;
case mem_steal_response__msgnum:
switch (_binding->rx_msg_fragment) {
case 0:
// check length
if (((msg.buf).msglen) > 4) {
(_binding->error_handler)(_binding, FLOUNDER_ERR_RX_INVALID_LENGTH);
goto out;
}
((_binding->rx_union).steal_response).ret = ((msg.words)[1]);
((_binding->rx_union).steal_response).mem_cap = cap;
FL_DEBUG("lmp RX mem.steal_response\n");
assert(((_binding->rx_vtbl).steal_response) != NULL);
((_binding->rx_vtbl).steal_response)(_binding, ((_binding->rx_union).steal_response).ret, ((_binding->rx_union).steal_response).mem_cap);
_binding->rx_msgnum = 0;
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
goto out;
}
break;
case mem_available_call__msgnum:
switch (_binding->rx_msg_fragment) {
case 0:
// check length
if (((msg.buf).msglen) > 4) {
(_binding->error_handler)(_binding, FLOUNDER_ERR_RX_INVALID_LENGTH);
goto out;
}
FL_DEBUG("lmp RX mem.available_call\n");
assert(((_binding->rx_vtbl).available_call) != NULL);
((_binding->rx_vtbl).available_call)(_binding);
_binding->rx_msgnum = 0;
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
goto out;
}
break;
case mem_available_response__msgnum:
switch (_binding->rx_msg_fragment) {
case 0:
// check length
if (((msg.buf).msglen) > 4) {
(_binding->error_handler)(_binding, FLOUNDER_ERR_RX_INVALID_LENGTH);
goto out;
}
((_binding->rx_union).available_response).mem_avail = ((msg.words)[1]);
((_binding->rx_union).available_response).mem_total = ((msg.words)[2]);
FL_DEBUG("lmp RX mem.available_response\n");
assert(((_binding->rx_vtbl).available_response) != NULL);
((_binding->rx_vtbl).available_response)(_binding, ((_binding->rx_union).available_response).mem_avail, ((_binding->rx_union).available_response).mem_total);
_binding->rx_msgnum = 0;
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
goto out;
}
break;
case mem_free_monitor_call__msgnum:
switch (_binding->rx_msg_fragment) {
case 0:
// check length
if (((msg.buf).msglen) > 4) {
(_binding->error_handler)(_binding, FLOUNDER_ERR_RX_INVALID_LENGTH);
goto out;
}
((_binding->rx_union).free_monitor_call).bits = ((((msg.words)[0]) >> 16) & 0xff);
((_binding->rx_union).free_monitor_call).base = ((msg.words)[1]);
((_binding->rx_union).free_monitor_call).mem_cap = cap;
FL_DEBUG("lmp RX mem.free_monitor_call\n");
assert(((_binding->rx_vtbl).free_monitor_call) != NULL);
((_binding->rx_vtbl).free_monitor_call)(_binding, ((_binding->rx_union).free_monitor_call).mem_cap, ((_binding->rx_union).free_monitor_call).base, ((_binding->rx_union).free_monitor_call).bits);
_binding->rx_msgnum = 0;
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
goto out;
}
break;
case mem_free_monitor_response__msgnum:
switch (_binding->rx_msg_fragment) {
case 0:
// check length
if (((msg.buf).msglen) > 4) {
(_binding->error_handler)(_binding, FLOUNDER_ERR_RX_INVALID_LENGTH);
goto out;
}
((_binding->rx_union).free_monitor_response).err = ((msg.words)[1]);
FL_DEBUG("lmp RX mem.free_monitor_response\n");
assert(((_binding->rx_vtbl).free_monitor_response) != NULL);
((_binding->rx_vtbl).free_monitor_response)(_binding, ((_binding->rx_union).free_monitor_response).err);
_binding->rx_msgnum = 0;
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
goto out;
}
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_RX_INVALID_MSGNUM);
goto out;
}
} while (err_is_ok(err));
out:
// re-register for another receive notification
err = lmp_chan_register_recv(&(b->chan), _binding->waitset, recv_closure);
assert(err_is_ok(err));
}
/*
* Control functions
*/
static bool mem_lmp_can_send(struct mem_binding *b)
{
return((b->tx_msgnum) == 0);
}
static errval_t mem_lmp_register_send(struct mem_binding *b, struct waitset *ws, struct event_closure _continuation)
{
return(flounder_support_register(ws, &(b->register_chanstate), _continuation, mem_lmp_can_send(b)));
}
static void mem_lmp_default_error_handler(struct mem_binding *b, errval_t err)
{
DEBUG_ERR(err, "asynchronous error in Flounder-generated mem lmp binding (default handler)");
abort();
}
static errval_t mem_lmp_change_waitset(struct mem_binding *_binding, struct waitset *ws)
{
struct mem_lmp_binding *b = (void *)(_binding);
// Migrate register and TX continuation notifications
flounder_support_migrate_notify(&(_binding->register_chanstate), ws);
flounder_support_migrate_notify(&(_binding->tx_cont_chanstate), ws);
// change waitset on binding
_binding->waitset = ws;
// Migrate send and receive notifications
lmp_chan_migrate_recv(&(b->chan), ws);
lmp_chan_migrate_send(&(b->chan), ws);
return(SYS_ERR_OK);
}
static errval_t mem_lmp_control(struct mem_binding *_binding, idc_control_t control)
{
struct mem_lmp_binding *b = (void *)(_binding);
b->flags = idc_control_to_lmp_flags(control, b->flags);
return(SYS_ERR_OK);
}
/*
* Functions to initialise/destroy the binding state
*/
void mem_lmp_init(struct mem_lmp_binding *b, struct waitset *waitset)
{
(b->b).st = NULL;
(b->b).waitset = waitset;
event_mutex_init(&((b->b).mutex), waitset);
(b->b).can_send = mem_lmp_can_send;
(b->b).register_send = mem_lmp_register_send;
(b->b).error_handler = mem_lmp_default_error_handler;
(b->b).tx_vtbl = mem_lmp_tx_vtbl;
memset(&((b->b).rx_vtbl), 0, sizeof((b->b).rx_vtbl));
flounder_support_waitset_chanstate_init(&((b->b).register_chanstate));
flounder_support_waitset_chanstate_init(&((b->b).tx_cont_chanstate));
(b->b).tx_msgnum = 0;
(b->b).rx_msgnum = 0;
(b->b).tx_msg_fragment = 0;
(b->b).rx_msg_fragment = 0;
(b->b).tx_str_pos = 0;
(b->b).rx_str_pos = 0;
(b->b).tx_str_len = 0;
(b->b).rx_str_len = 0;
(b->b).bind_cont = NULL;
lmp_chan_init(&(b->chan));
(b->b).change_waitset = mem_lmp_change_waitset;
(b->b).control = mem_lmp_control;
b->flags = LMP_SEND_FLAGS_DEFAULT;
}
void mem_lmp_destroy(struct mem_lmp_binding *b)
{
flounder_support_waitset_chanstate_destroy(&((b->b).register_chanstate));
flounder_support_waitset_chanstate_destroy(&((b->b).tx_cont_chanstate));
lmp_chan_destroy(&(b->chan));
}
/*
* Bind function
*/
static void mem_lmp_bind_continuation(void *st, errval_t err, struct lmp_chan *chan)
{
struct mem_lmp_binding *b = st;
if (err_is_ok(err)) {
// allocate a cap receive slot
err = lmp_chan_alloc_recv_slot(chan);
if (err_is_fail(err)) {
err = err_push(err, LIB_ERR_LMP_ALLOC_RECV_SLOT);
goto fail;
}
// register for receive
err = lmp_chan_register_recv(chan, (b->b).waitset, (struct event_closure){ .handler = mem_lmp_rx_handler, .arg = b });
if (err_is_fail(err)) {
err = err_push(err, LIB_ERR_CHAN_REGISTER_RECV);
goto fail;
}
} else {
fail:
mem_lmp_destroy(b);
}
((b->b).bind_cont)((b->b).st, err, &(b->b));
}
errval_t mem_lmp_bind(struct mem_lmp_binding *b, iref_t iref, mem_bind_continuation_fn *_continuation, void *st, struct waitset *waitset, idc_bind_flags_t flags, size_t lmp_buflen)
{
errval_t err;
mem_lmp_init(b, waitset);
(b->b).st = st;
(b->b).bind_cont = _continuation;
err = lmp_chan_bind(&(b->chan), (struct lmp_bind_continuation){ .handler = mem_lmp_bind_continuation, .st = b }, &((b->b).event_qnode), iref, lmp_buflen);
if (err_is_fail(err)) {
mem_lmp_destroy(b);
}
return(err);
}
/*
* Connect callback for export
*/
errval_t mem_lmp_connect_handler(void *st, size_t buflen_words, struct capref endpoint, struct lmp_chan **retchan)
{
struct mem_export *e = st;
errval_t err;
// allocate storage for binding
struct mem_lmp_binding *b = malloc(sizeof(struct mem_lmp_binding ));
if (b == NULL) {
return(LIB_ERR_MALLOC_FAIL);
}
struct mem_binding *_binding = &(b->b);
mem_lmp_init(b, e->waitset);
// run user's connect handler
err = ((e->connect_cb)(e->st, _binding));
if (err_is_fail(err)) {
// connection refused
mem_lmp_destroy(b);
return(err);
}
// accept the connection and setup the channel
// FIXME: user policy needed to decide on the size of the message buffer?
err = lmp_chan_accept(&(b->chan), buflen_words, endpoint);
if (err_is_fail(err)) {
err = err_push(err, LIB_ERR_LMP_CHAN_ACCEPT);
(_binding->error_handler)(_binding, err);
return(err);
}
// allocate a cap receive slot
err = lmp_chan_alloc_recv_slot(&(b->chan));
if (err_is_fail(err)) {
err = err_push(err, LIB_ERR_LMP_ALLOC_RECV_SLOT);
(_binding->error_handler)(_binding, err);
return(err);
}
// register for receive
err = lmp_chan_register_recv(&(b->chan), _binding->waitset, (struct event_closure){ .handler = mem_lmp_rx_handler, .arg = b });
if (err_is_fail(err)) {
err = err_push(err, LIB_ERR_CHAN_REGISTER_RECV);
(_binding->error_handler)(_binding, err);
return(err);
}
*retchan = (&(b->chan));
return(SYS_ERR_OK);
}
/*
* Copyright (c) 2010, ETH Zurich.
* All rights reserved.
*
* INTERFACE NAME: mem
* INTEFACE FILE: ../if/mem.if
* INTERFACE DESCRIPTION: Memory allocation RPC interface
*
* This file is distributed under the terms in the attached LICENSE
* file. If you do not find this file, copies can be found by
* writing to:
* ETH Zurich D-INFK, Universitaetstr.6, CH-8092 Zurich.
* Attn: Systems Group.
*
* THIS FILE IS AUTOMATICALLY GENERATED BY FLOUNDER: DO NOT EDIT!
*/
#ifdef CONFIG_FLOUNDER_BACKEND_UMP
/*
* Generated Stub for UMP
*/
#include <barrelfish/barrelfish.h>
#include <barrelfish/monitor_client.h>
#include <flounder/flounder_support.h>
#include <flounder/flounder_support_ump.h>
#include <if/mem_defs.h>
/*
* Send handler function
*/
static void mem_ump_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_ump_binding *b = arg;
errval_t err;
err = SYS_ERR_OK;
volatile struct ump_message *msg;
struct ump_control ctrl;
bool tx_notify = false;
// do we need to (and can we) send a cap ack?
if ((((b->ump_state).capst).tx_cap_ack) && flounder_stub_ump_can_send(&(b->ump_state))) {
flounder_stub_ump_send_cap_ack(&(b->ump_state));
((b->ump_state).capst).tx_cap_ack = false;
tx_notify = true;
}
// Switch on current outgoing message number
switch (_binding->tx_msgnum) {
case 0:
break;
case mem_allocate_call__msgnum:
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
// check if we can send another message
if (!flounder_stub_ump_can_send(&(b->ump_state))) {
tx_notify = true;
break;
}
// send the next fragment
msg = ump_chan_get_next(&((b->ump_state).chan), &ctrl);
flounder_stub_ump_control_fill(&(b->ump_state), &ctrl, mem_allocate_call__msgnum);
(msg->data)[0] = (((_binding->tx_union).allocate_call).bits);
(msg->data)[1] = (((_binding->tx_union).allocate_call).minbase);
(msg->data)[2] = (((_binding->tx_union).allocate_call).maxlimit);
flounder_stub_ump_barrier();
(msg->header).control = ctrl;
(_binding->tx_msg_fragment)++;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
case 1:
// we've sent all the fragments, we must just be waiting for caps
assert((((b->ump_state).capst).tx_capnum) <= 0);
break;
default:
assert(!("invalid fragment"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
case mem_allocate_response__msgnum:
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
// check if we can send another message
if (!flounder_stub_ump_can_send(&(b->ump_state))) {
tx_notify = true;
break;
}
// send the next fragment
msg = ump_chan_get_next(&((b->ump_state).chan), &ctrl);
flounder_stub_ump_control_fill(&(b->ump_state), &ctrl, mem_allocate_response__msgnum);
(msg->data)[0] = (((_binding->tx_union).allocate_response).ret);
flounder_stub_ump_barrier();
(msg->header).control = ctrl;
(_binding->tx_msg_fragment)++;
if ((((b->ump_state).capst).tx_capnum) == 2) {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
return;
case 1:
// we've sent all the fragments, we must just be waiting for caps
assert((((b->ump_state).capst).tx_capnum) <= 1);
break;
default:
assert(!("invalid fragment"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
case mem_steal_call__msgnum:
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
// check if we can send another message
if (!flounder_stub_ump_can_send(&(b->ump_state))) {
tx_notify = true;
break;
}
// send the next fragment
msg = ump_chan_get_next(&((b->ump_state).chan), &ctrl);
flounder_stub_ump_control_fill(&(b->ump_state), &ctrl, mem_steal_call__msgnum);
(msg->data)[0] = (((_binding->tx_union).steal_call).bits);
(msg->data)[1] = (((_binding->tx_union).steal_call).minbase);
(msg->data)[2] = (((_binding->tx_union).steal_call).maxlimit);
flounder_stub_ump_barrier();
(msg->header).control = ctrl;
(_binding->tx_msg_fragment)++;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
case 1:
// we've sent all the fragments, we must just be waiting for caps
assert((((b->ump_state).capst).tx_capnum) <= 0);
break;
default:
assert(!("invalid fragment"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
case mem_steal_response__msgnum:
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
// check if we can send another message
if (!flounder_stub_ump_can_send(&(b->ump_state))) {
tx_notify = true;
break;
}
// send the next fragment
msg = ump_chan_get_next(&((b->ump_state).chan), &ctrl);
flounder_stub_ump_control_fill(&(b->ump_state), &ctrl, mem_steal_response__msgnum);
(msg->data)[0] = (((_binding->tx_union).steal_response).ret);
flounder_stub_ump_barrier();
(msg->header).control = ctrl;
(_binding->tx_msg_fragment)++;
if ((((b->ump_state).capst).tx_capnum) == 2) {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
return;
case 1:
// we've sent all the fragments, we must just be waiting for caps
assert((((b->ump_state).capst).tx_capnum) <= 1);
break;
default:
assert(!("invalid fragment"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
case mem_available_call__msgnum:
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
// check if we can send another message
if (!flounder_stub_ump_can_send(&(b->ump_state))) {
tx_notify = true;
break;
}
// send the next fragment
msg = ump_chan_get_next(&((b->ump_state).chan), &ctrl);
flounder_stub_ump_control_fill(&(b->ump_state), &ctrl, mem_available_call__msgnum);
flounder_stub_ump_barrier();
(msg->header).control = ctrl;
(_binding->tx_msg_fragment)++;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
case 1:
// we've sent all the fragments, we must just be waiting for caps
assert((((b->ump_state).capst).tx_capnum) <= 0);
break;
default:
assert(!("invalid fragment"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
case mem_available_response__msgnum:
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
// check if we can send another message
if (!flounder_stub_ump_can_send(&(b->ump_state))) {
tx_notify = true;
break;
}
// send the next fragment
msg = ump_chan_get_next(&((b->ump_state).chan), &ctrl);
flounder_stub_ump_control_fill(&(b->ump_state), &ctrl, mem_available_response__msgnum);
(msg->data)[0] = (((_binding->tx_union).available_response).mem_avail);
(msg->data)[1] = (((_binding->tx_union).available_response).mem_total);
flounder_stub_ump_barrier();
(msg->header).control = ctrl;
(_binding->tx_msg_fragment)++;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
case 1:
// we've sent all the fragments, we must just be waiting for caps
assert((((b->ump_state).capst).tx_capnum) <= 0);
break;
default:
assert(!("invalid fragment"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
case mem_free_monitor_call__msgnum:
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
// check if we can send another message
if (!flounder_stub_ump_can_send(&(b->ump_state))) {
tx_notify = true;
break;
}
// send the next fragment
msg = ump_chan_get_next(&((b->ump_state).chan), &ctrl);
flounder_stub_ump_control_fill(&(b->ump_state), &ctrl, mem_free_monitor_call__msgnum);
(msg->data)[0] = (((_binding->tx_union).free_monitor_call).bits);
(msg->data)[1] = (((_binding->tx_union).free_monitor_call).base);
flounder_stub_ump_barrier();
(msg->header).control = ctrl;
(_binding->tx_msg_fragment)++;
if ((((b->ump_state).capst).tx_capnum) == 2) {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
return;
case 1:
// we've sent all the fragments, we must just be waiting for caps
assert((((b->ump_state).capst).tx_capnum) <= 1);
break;
default:
assert(!("invalid fragment"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
case mem_free_monitor_response__msgnum:
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
// check if we can send another message
if (!flounder_stub_ump_can_send(&(b->ump_state))) {
tx_notify = true;
break;
}
// send the next fragment
msg = ump_chan_get_next(&((b->ump_state).chan), &ctrl);
flounder_stub_ump_control_fill(&(b->ump_state), &ctrl, mem_free_monitor_response__msgnum);
(msg->data)[0] = (((_binding->tx_union).free_monitor_response).err);
flounder_stub_ump_barrier();
(msg->header).control = ctrl;
(_binding->tx_msg_fragment)++;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
case 1:
// we've sent all the fragments, we must just be waiting for caps
assert((((b->ump_state).capst).tx_capnum) <= 0);
break;
default:
assert(!("invalid fragment"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
default:
assert(!("invalid msgnum"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
// Send a notification if necessary
if (tx_notify) {
}
}
/*
* Capability sender function
*/
static void mem_ump_cap_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_ump_binding *b = arg;
errval_t err;
err = SYS_ERR_OK;
assert(((b->ump_state).capst).rx_cap_ack);
assert(((b->ump_state).capst).monitor_mutex_held);
// Switch on current outgoing message
switch (_binding->tx_msgnum) {
case mem_allocate_response__msgnum:
// Switch on current outgoing cap
switch (((b->ump_state).capst).tx_capnum) {
case 0:
err = flounder_stub_send_cap(&((b->ump_state).capst), ((b->ump_state).chan).monitor_binding, ((b->ump_state).chan).monitor_id, ((_binding->tx_union).allocate_response).mem_cap, true, mem_ump_cap_send_handler);
if (err_is_fail(err)) {
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
break;
}
break;
case 1:
flounder_support_monitor_mutex_unlock(((b->ump_state).chan).monitor_binding);
if ((_binding->tx_msg_fragment) == 1) {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
break;
default:
assert(!("invalid cap number"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
case mem_steal_response__msgnum:
// Switch on current outgoing cap
switch (((b->ump_state).capst).tx_capnum) {
case 0:
err = flounder_stub_send_cap(&((b->ump_state).capst), ((b->ump_state).chan).monitor_binding, ((b->ump_state).chan).monitor_id, ((_binding->tx_union).steal_response).mem_cap, true, mem_ump_cap_send_handler);
if (err_is_fail(err)) {
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
break;
}
break;
case 1:
flounder_support_monitor_mutex_unlock(((b->ump_state).chan).monitor_binding);
if ((_binding->tx_msg_fragment) == 1) {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
break;
default:
assert(!("invalid cap number"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
case mem_free_monitor_call__msgnum:
// Switch on current outgoing cap
switch (((b->ump_state).capst).tx_capnum) {
case 0:
err = flounder_stub_send_cap(&((b->ump_state).capst), ((b->ump_state).chan).monitor_binding, ((b->ump_state).chan).monitor_id, ((_binding->tx_union).free_monitor_call).mem_cap, true, mem_ump_cap_send_handler);
if (err_is_fail(err)) {
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
break;
}
break;
case 1:
flounder_support_monitor_mutex_unlock(((b->ump_state).chan).monitor_binding);
if ((_binding->tx_msg_fragment) == 1) {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
break;
default:
assert(!("invalid cap number"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
default:
assert(!("invalid message number"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
}
/*
* Receive handler
*/
void mem_ump_rx_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_ump_binding *b = arg;
errval_t err;
err = SYS_ERR_OK;
volatile struct ump_message *msg;
int msgnum;
while (true) {
// try to retrieve a message from the channel
err = ump_chan_recv(&((b->ump_state).chan), &msg);
// check if we succeeded
if (err_is_fail(err)) {
if (err_no(err) == LIB_ERR_NO_UMP_MSG) {
// no message
break;
} else {
// real error
(_binding->error_handler)(_binding, err_push(err, LIB_ERR_UMP_CHAN_RECV));
return;
}
}
// process control word
msgnum = flounder_stub_ump_control_process(&(b->ump_state), (msg->header).control);
// is this a dummy message (ACK)?
if (msgnum == FL_UMP_ACK) {
goto loopnext;
}
// is this a cap ack for a pending tx message
if (msgnum == FL_UMP_CAP_ACK) {
assert(!(((b->ump_state).capst).rx_cap_ack));
((b->ump_state).capst).rx_cap_ack = true;
if (((b->ump_state).capst).monitor_mutex_held) {
mem_ump_cap_send_handler(b);
}
goto loopnext;
}
// is this the start of a new message?
if ((_binding->rx_msgnum) == 0) {
_binding->rx_msgnum = msgnum;
_binding->rx_msg_fragment = 0;
}
// switch on message number and fragment number
switch (_binding->rx_msgnum) {
case mem_allocate_call__msgnum:
switch (_binding->rx_msg_fragment) {
case 0:
((_binding->rx_union).allocate_call).bits = (((msg->data)[0]) & 0xff);
((_binding->rx_union).allocate_call).minbase = ((msg->data)[1]);
((_binding->rx_union).allocate_call).maxlimit = ((msg->data)[2]);
FL_DEBUG("ump RX mem.allocate_call\n");
assert(((_binding->rx_vtbl).allocate_call) != NULL);
((_binding->rx_vtbl).allocate_call)(_binding, ((_binding->rx_union).allocate_call).bits, ((_binding->rx_union).allocate_call).minbase, ((_binding->rx_union).allocate_call).maxlimit);
_binding->rx_msgnum = 0;
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
goto out;
}
break;
case mem_allocate_response__msgnum:
switch (_binding->rx_msg_fragment) {
case 0:
((b->ump_state).capst).tx_cap_ack = true;
((b->ump_state).capst).rx_capnum = 0;
((_binding->rx_union).allocate_response).ret = ((msg->data)[0]);
(_binding->rx_msg_fragment)++;
if ((((b->ump_state).capst).rx_capnum) == 1) {
FL_DEBUG("ump RX mem.allocate_response\n");
assert(((_binding->rx_vtbl).allocate_response) != NULL);
((_binding->rx_vtbl).allocate_response)(_binding, ((_binding->rx_union).allocate_response).ret, ((_binding->rx_union).allocate_response).mem_cap);
_binding->rx_msgnum = 0;
} else {
// don't process anything else until we're done
goto out_no_reregister;
}
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
goto out;
}
break;
case mem_steal_call__msgnum:
switch (_binding->rx_msg_fragment) {
case 0:
((_binding->rx_union).steal_call).bits = (((msg->data)[0]) & 0xff);
((_binding->rx_union).steal_call).minbase = ((msg->data)[1]);
((_binding->rx_union).steal_call).maxlimit = ((msg->data)[2]);
FL_DEBUG("ump RX mem.steal_call\n");
assert(((_binding->rx_vtbl).steal_call) != NULL);
((_binding->rx_vtbl).steal_call)(_binding, ((_binding->rx_union).steal_call).bits, ((_binding->rx_union).steal_call).minbase, ((_binding->rx_union).steal_call).maxlimit);
_binding->rx_msgnum = 0;
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
goto out;
}
break;
case mem_steal_response__msgnum:
switch (_binding->rx_msg_fragment) {
case 0:
((b->ump_state).capst).tx_cap_ack = true;
((b->ump_state).capst).rx_capnum = 0;
((_binding->rx_union).steal_response).ret = ((msg->data)[0]);
(_binding->rx_msg_fragment)++;
if ((((b->ump_state).capst).rx_capnum) == 1) {
FL_DEBUG("ump RX mem.steal_response\n");
assert(((_binding->rx_vtbl).steal_response) != NULL);
((_binding->rx_vtbl).steal_response)(_binding, ((_binding->rx_union).steal_response).ret, ((_binding->rx_union).steal_response).mem_cap);
_binding->rx_msgnum = 0;
} else {
// don't process anything else until we're done
goto out_no_reregister;
}
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
goto out;
}
break;
case mem_available_call__msgnum:
switch (_binding->rx_msg_fragment) {
case 0:
FL_DEBUG("ump RX mem.available_call\n");
assert(((_binding->rx_vtbl).available_call) != NULL);
((_binding->rx_vtbl).available_call)(_binding);
_binding->rx_msgnum = 0;
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
goto out;
}
break;
case mem_available_response__msgnum:
switch (_binding->rx_msg_fragment) {
case 0:
((_binding->rx_union).available_response).mem_avail = ((msg->data)[0]);
((_binding->rx_union).available_response).mem_total = ((msg->data)[1]);
FL_DEBUG("ump RX mem.available_response\n");
assert(((_binding->rx_vtbl).available_response) != NULL);
((_binding->rx_vtbl).available_response)(_binding, ((_binding->rx_union).available_response).mem_avail, ((_binding->rx_union).available_response).mem_total);
_binding->rx_msgnum = 0;
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
goto out;
}
break;
case mem_free_monitor_call__msgnum:
switch (_binding->rx_msg_fragment) {
case 0:
((b->ump_state).capst).tx_cap_ack = true;
((b->ump_state).capst).rx_capnum = 0;
((_binding->rx_union).free_monitor_call).bits = (((msg->data)[0]) & 0xff);
((_binding->rx_union).free_monitor_call).base = ((msg->data)[1]);
(_binding->rx_msg_fragment)++;
if ((((b->ump_state).capst).rx_capnum) == 1) {
FL_DEBUG("ump RX mem.free_monitor_call\n");
assert(((_binding->rx_vtbl).free_monitor_call) != NULL);
((_binding->rx_vtbl).free_monitor_call)(_binding, ((_binding->rx_union).free_monitor_call).mem_cap, ((_binding->rx_union).free_monitor_call).base, ((_binding->rx_union).free_monitor_call).bits);
_binding->rx_msgnum = 0;
} else {
// don't process anything else until we're done
goto out_no_reregister;
}
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
goto out;
}
break;
case mem_free_monitor_response__msgnum:
switch (_binding->rx_msg_fragment) {
case 0:
((_binding->rx_union).free_monitor_response).err = ((msg->data)[0]);
FL_DEBUG("ump RX mem.free_monitor_response\n");
assert(((_binding->rx_vtbl).free_monitor_response) != NULL);
((_binding->rx_vtbl).free_monitor_response)(_binding, ((_binding->rx_union).free_monitor_response).err);
_binding->rx_msgnum = 0;
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
goto out;
}
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_RX_INVALID_MSGNUM);
goto out;
}
loopnext:
// send an ack if the channel is now full
if (flounder_stub_ump_needs_ack(&(b->ump_state))) {
// run our send process if we need to
if ((((b->ump_state).capst).tx_cap_ack) || ((_binding->tx_msgnum) != 0)) {
mem_ump_send_handler(b);
} else {
flounder_stub_ump_send_ack(&(b->ump_state));
}
}
}
out:
// register for receive notification
err = ump_chan_register_recv(&((b->ump_state).chan), _binding->waitset, (struct event_closure){ .handler = mem_ump_rx_handler, .arg = _binding });
if (err_is_fail(err)) {
(_binding->error_handler)(_binding, err_push(err, LIB_ERR_CHAN_REGISTER_RECV));
}
out_no_reregister:
__attribute__((unused));
// run our send process, if we need to
if ((((b->ump_state).capst).tx_cap_ack) || ((_binding->tx_msgnum) != 0)) {
mem_ump_send_handler(b);
} else {
// otherwise send a forced ack if the channel is now full
if (flounder_stub_ump_needs_ack(&(b->ump_state))) {
flounder_stub_ump_send_ack(&(b->ump_state));
}
}
}
/*
* Cap send/receive handlers
*/
static void mem_ump_cap_rx_handler(void *arg, errval_t success, struct capref cap, uint32_t capid)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_ump_binding *b = arg;
errval_t err;
err = SYS_ERR_OK;
assert(capid == (((b->ump_state).capst).rx_capnum));
// Check if there's an associated error
// FIXME: how should we report this to the user? at present we just deliver a NULL capref
if (err_is_fail(success)) {
DEBUG_ERR(err, "error in cap transfer");
}
// Switch on current incoming message
switch (_binding->rx_msgnum) {
case mem_allocate_response__msgnum:
// Switch on current incoming cap
switch ((((b->ump_state).capst).rx_capnum)++) {
case 0:
((_binding->rx_union).allocate_response).mem_cap = cap;
if ((_binding->rx_msg_fragment) == 1) {
FL_DEBUG("ump RX mem.allocate_response\n");
assert(((_binding->rx_vtbl).allocate_response) != NULL);
((_binding->rx_vtbl).allocate_response)(_binding, ((_binding->rx_union).allocate_response).ret, ((_binding->rx_union).allocate_response).mem_cap);
_binding->rx_msgnum = 0;
// register for receive notification
err = ump_chan_register_recv(&((b->ump_state).chan), _binding->waitset, (struct event_closure){ .handler = mem_ump_rx_handler, .arg = _binding });
if (err_is_fail(err)) {
(_binding->error_handler)(_binding, err_push(err, LIB_ERR_CHAN_REGISTER_RECV));
}
}
break;
default:
assert(!("invalid cap number"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
case mem_steal_response__msgnum:
// Switch on current incoming cap
switch ((((b->ump_state).capst).rx_capnum)++) {
case 0:
((_binding->rx_union).steal_response).mem_cap = cap;
if ((_binding->rx_msg_fragment) == 1) {
FL_DEBUG("ump RX mem.steal_response\n");
assert(((_binding->rx_vtbl).steal_response) != NULL);
((_binding->rx_vtbl).steal_response)(_binding, ((_binding->rx_union).steal_response).ret, ((_binding->rx_union).steal_response).mem_cap);
_binding->rx_msgnum = 0;
// register for receive notification
err = ump_chan_register_recv(&((b->ump_state).chan), _binding->waitset, (struct event_closure){ .handler = mem_ump_rx_handler, .arg = _binding });
if (err_is_fail(err)) {
(_binding->error_handler)(_binding, err_push(err, LIB_ERR_CHAN_REGISTER_RECV));
}
}
break;
default:
assert(!("invalid cap number"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
case mem_free_monitor_call__msgnum:
// Switch on current incoming cap
switch ((((b->ump_state).capst).rx_capnum)++) {
case 0:
((_binding->rx_union).free_monitor_call).mem_cap = cap;
if ((_binding->rx_msg_fragment) == 1) {
FL_DEBUG("ump RX mem.free_monitor_call\n");
assert(((_binding->rx_vtbl).free_monitor_call) != NULL);
((_binding->rx_vtbl).free_monitor_call)(_binding, ((_binding->rx_union).free_monitor_call).mem_cap, ((_binding->rx_union).free_monitor_call).base, ((_binding->rx_union).free_monitor_call).bits);
_binding->rx_msgnum = 0;
// register for receive notification
err = ump_chan_register_recv(&((b->ump_state).chan), _binding->waitset, (struct event_closure){ .handler = mem_ump_rx_handler, .arg = _binding });
if (err_is_fail(err)) {
(_binding->error_handler)(_binding, err_push(err, LIB_ERR_CHAN_REGISTER_RECV));
}
}
break;
default:
assert(!("invalid cap number"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
default:
assert(!("invalid message number"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
}
/*
* Monitor mutex acquire continuation
*/
static void mem_ump_monitor_mutex_cont(void *arg)
{
struct mem_ump_binding *b = arg;
assert(!(((b->ump_state).capst).monitor_mutex_held));
((b->ump_state).capst).monitor_mutex_held = true;
if (((b->ump_state).capst).rx_cap_ack) {
mem_ump_cap_send_handler(b);
}
}
/*
* Message sender functions
*/
static errval_t mem_allocate_call__ump_send(struct mem_binding *_binding, struct event_closure _continuation, uint8_t bits, mem_genpaddr_t minbase, mem_genpaddr_t maxlimit)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and arguments
_binding->tx_msgnum = mem_allocate_call__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).allocate_call).bits = bits;
((_binding->tx_union).allocate_call).minbase = minbase;
((_binding->tx_union).allocate_call).maxlimit = maxlimit;
FL_DEBUG("ump TX mem.allocate_call\n");
// try to send!
mem_ump_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_allocate_response__ump_send(struct mem_binding *_binding, struct event_closure _continuation, mem_errval_t ret, struct capref mem_cap)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and arguments
_binding->tx_msgnum = mem_allocate_response__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).allocate_response).ret = ret;
((_binding->tx_union).allocate_response).mem_cap = mem_cap;
FL_DEBUG("ump TX mem.allocate_response\n");
// init cap send state
((((struct mem_ump_binding *)(_binding))->ump_state).capst).tx_capnum = 0;
((((struct mem_ump_binding *)(_binding))->ump_state).capst).rx_cap_ack = false;
((((struct mem_ump_binding *)(_binding))->ump_state).capst).monitor_mutex_held = false;
// wait to acquire the monitor binding mutex
flounder_support_monitor_mutex_enqueue(((((struct mem_ump_binding *)(_binding))->ump_state).chan).monitor_binding, &(_binding->event_qnode), (struct event_closure){ .handler = mem_ump_monitor_mutex_cont, .arg = _binding });
// try to send!
mem_ump_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_steal_call__ump_send(struct mem_binding *_binding, struct event_closure _continuation, uint8_t bits, mem_genpaddr_t minbase, mem_genpaddr_t maxlimit)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and arguments
_binding->tx_msgnum = mem_steal_call__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).steal_call).bits = bits;
((_binding->tx_union).steal_call).minbase = minbase;
((_binding->tx_union).steal_call).maxlimit = maxlimit;
FL_DEBUG("ump TX mem.steal_call\n");
// try to send!
mem_ump_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_steal_response__ump_send(struct mem_binding *_binding, struct event_closure _continuation, mem_errval_t ret, struct capref mem_cap)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and arguments
_binding->tx_msgnum = mem_steal_response__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).steal_response).ret = ret;
((_binding->tx_union).steal_response).mem_cap = mem_cap;
FL_DEBUG("ump TX mem.steal_response\n");
// init cap send state
((((struct mem_ump_binding *)(_binding))->ump_state).capst).tx_capnum = 0;
((((struct mem_ump_binding *)(_binding))->ump_state).capst).rx_cap_ack = false;
((((struct mem_ump_binding *)(_binding))->ump_state).capst).monitor_mutex_held = false;
// wait to acquire the monitor binding mutex
flounder_support_monitor_mutex_enqueue(((((struct mem_ump_binding *)(_binding))->ump_state).chan).monitor_binding, &(_binding->event_qnode), (struct event_closure){ .handler = mem_ump_monitor_mutex_cont, .arg = _binding });
// try to send!
mem_ump_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_available_call__ump_send(struct mem_binding *_binding, struct event_closure _continuation)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and arguments
_binding->tx_msgnum = mem_available_call__msgnum;
_binding->tx_msg_fragment = 0;
FL_DEBUG("ump TX mem.available_call\n");
// try to send!
mem_ump_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_available_response__ump_send(struct mem_binding *_binding, struct event_closure _continuation, mem_genpaddr_t mem_avail, mem_genpaddr_t mem_total)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and arguments
_binding->tx_msgnum = mem_available_response__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).available_response).mem_avail = mem_avail;
((_binding->tx_union).available_response).mem_total = mem_total;
FL_DEBUG("ump TX mem.available_response\n");
// try to send!
mem_ump_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_free_monitor_call__ump_send(struct mem_binding *_binding, struct event_closure _continuation, struct capref mem_cap, mem_genpaddr_t base, uint8_t bits)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and arguments
_binding->tx_msgnum = mem_free_monitor_call__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).free_monitor_call).mem_cap = mem_cap;
((_binding->tx_union).free_monitor_call).base = base;
((_binding->tx_union).free_monitor_call).bits = bits;
FL_DEBUG("ump TX mem.free_monitor_call\n");
// init cap send state
((((struct mem_ump_binding *)(_binding))->ump_state).capst).tx_capnum = 0;
((((struct mem_ump_binding *)(_binding))->ump_state).capst).rx_cap_ack = false;
((((struct mem_ump_binding *)(_binding))->ump_state).capst).monitor_mutex_held = false;
// wait to acquire the monitor binding mutex
flounder_support_monitor_mutex_enqueue(((((struct mem_ump_binding *)(_binding))->ump_state).chan).monitor_binding, &(_binding->event_qnode), (struct event_closure){ .handler = mem_ump_monitor_mutex_cont, .arg = _binding });
// try to send!
mem_ump_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_free_monitor_response__ump_send(struct mem_binding *_binding, struct event_closure _continuation, mem_errval_t err)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and arguments
_binding->tx_msgnum = mem_free_monitor_response__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).free_monitor_response).err = err;
FL_DEBUG("ump TX mem.free_monitor_response\n");
// try to send!
mem_ump_send_handler(_binding);
return(SYS_ERR_OK);
}
/*
* Send vtable
*/
static struct mem_tx_vtbl mem_ump_tx_vtbl = {
.allocate_call = mem_allocate_call__ump_send,
.allocate_response = mem_allocate_response__ump_send,
.steal_call = mem_steal_call__ump_send,
.steal_response = mem_steal_response__ump_send,
.available_call = mem_available_call__ump_send,
.available_response = mem_available_response__ump_send,
.free_monitor_call = mem_free_monitor_call__ump_send,
.free_monitor_response = mem_free_monitor_response__ump_send,
};
/*
* Control functions
*/
static bool mem_ump_can_send(struct mem_binding *b)
{
return((b->tx_msgnum) == 0);
}
static errval_t mem_ump_register_send(struct mem_binding *b, struct waitset *ws, struct event_closure _continuation)
{
return(flounder_support_register(ws, &(b->register_chanstate), _continuation, mem_ump_can_send(b)));
}
static void mem_ump_default_error_handler(struct mem_binding *b, errval_t err)
{
DEBUG_ERR(err, "asynchronous error in Flounder-generated mem ump binding (default handler)");
abort();
}
static errval_t mem_ump_change_waitset(struct mem_binding *_binding, struct waitset *ws)
{
struct mem_ump_binding *b = (void *)(_binding);
errval_t err;
// change waitset on private monitor binding if we have one
if ((((b->ump_state).chan).monitor_binding) != get_monitor_binding()) {
err = flounder_support_change_monitor_waitset(((b->ump_state).chan).monitor_binding, ws);
if (err_is_fail(err)) {
return(err_push(err, FLOUNDER_ERR_CHANGE_MONITOR_WAITSET));
}
}
// change waitset on binding
_binding->waitset = ws;
// re-register for receive (if previously registered)
err = ump_chan_deregister_recv(&((b->ump_state).chan));
if (err_is_fail(err) && (err_no(err) != LIB_ERR_CHAN_NOT_REGISTERED)) {
return(err_push(err, LIB_ERR_CHAN_DEREGISTER_RECV));
}
if (err_is_ok(err)) {
err = ump_chan_register_recv(&((b->ump_state).chan), _binding->waitset, (struct event_closure){ .handler = mem_ump_rx_handler, .arg = _binding });
if (err_is_fail(err)) {
return(err_push(err, LIB_ERR_CHAN_REGISTER_RECV));
}
}
return(SYS_ERR_OK);
}
static errval_t mem_ump_control(struct mem_binding *_binding, idc_control_t control)
{
// no control flags are supported
return(SYS_ERR_OK);
}
/*
* Function to destroy the binding state
*/
void mem_ump_destroy(struct mem_ump_binding *b)
{
flounder_support_waitset_chanstate_destroy(&((b->b).register_chanstate));
flounder_support_waitset_chanstate_destroy(&((b->b).tx_cont_chanstate));
ump_chan_destroy(&((b->ump_state).chan));
}
/*
* Bind function
*/
static void mem_ump_bind_continuation(void *st, errval_t err, struct ump_chan *chan, struct capref notify_cap)
{
struct mem_binding *_binding = st;
struct mem_ump_binding *b = st;
if (err_is_ok(err)) {
// notify cap ignored
// setup cap handlers
(((b->ump_state).chan).cap_handlers).st = b;
(((b->ump_state).chan).cap_handlers).cap_receive_handler = mem_ump_cap_rx_handler;
// register for receive notification
err = ump_chan_register_recv(&((b->ump_state).chan), _binding->waitset, (struct event_closure){ .handler = mem_ump_rx_handler, .arg = _binding });
if (err_is_fail(err)) {
(_binding->error_handler)(_binding, err_push(err, LIB_ERR_CHAN_REGISTER_RECV));
}
} else {
mem_ump_destroy(b);
}
(_binding->bind_cont)(_binding->st, err, _binding);
}
errval_t mem_ump_init(struct mem_ump_binding *b, struct waitset *waitset, volatile void *inbuf, size_t inbufsize, volatile void *outbuf, size_t outbufsize)
{
errval_t err;
struct mem_binding *_binding = &(b->b);
(b->b).st = NULL;
(b->b).waitset = waitset;
event_mutex_init(&((b->b).mutex), waitset);
(b->b).can_send = mem_ump_can_send;
(b->b).register_send = mem_ump_register_send;
(b->b).error_handler = mem_ump_default_error_handler;
(b->b).tx_vtbl = mem_ump_tx_vtbl;
memset(&((b->b).rx_vtbl), 0, sizeof((b->b).rx_vtbl));
flounder_support_waitset_chanstate_init(&((b->b).register_chanstate));
flounder_support_waitset_chanstate_init(&((b->b).tx_cont_chanstate));
(b->b).tx_msgnum = 0;
(b->b).rx_msgnum = 0;
(b->b).tx_msg_fragment = 0;
(b->b).rx_msg_fragment = 0;
(b->b).tx_str_pos = 0;
(b->b).rx_str_pos = 0;
(b->b).tx_str_len = 0;
(b->b).rx_str_len = 0;
(b->b).bind_cont = NULL;
flounder_stub_ump_state_init(&(b->ump_state), b);
err = ump_chan_init(&((b->ump_state).chan), inbuf, inbufsize, outbuf, outbufsize);
if (err_is_fail(err)) {
mem_ump_destroy(b);
return(err_push(err, LIB_ERR_UMP_CHAN_INIT));
}
(b->b).change_waitset = mem_ump_change_waitset;
(b->b).control = mem_ump_control;
// register for receive notification
err = ump_chan_register_recv(&((b->ump_state).chan), _binding->waitset, (struct event_closure){ .handler = mem_ump_rx_handler, .arg = _binding });
if (err_is_fail(err)) {
(_binding->error_handler)(_binding, err_push(err, LIB_ERR_CHAN_REGISTER_RECV));
}
return(err);
}
static void mem_ump_new_monitor_binding_continuation(void *st, errval_t err, struct monitor_binding *monitor_binding)
{
struct mem_binding *_binding = st;
struct mem_ump_binding *b = st;
if (err_is_fail(err)) {
err = err_push(err, LIB_ERR_MONITOR_CLIENT_BIND);
goto out;
}
((b->ump_state).chan).monitor_binding = monitor_binding;
// start the bind on the new monitor binding
err = ump_chan_bind(&((b->ump_state).chan), (struct ump_bind_continuation){ .handler = mem_ump_bind_continuation, .st = b }, &(_binding->event_qnode), b->iref, monitor_binding, b->inchanlen, b->outchanlen, NULL_CAP);
out:
if (err_is_fail(err)) {
(_binding->bind_cont)(_binding->st, err, _binding);
mem_ump_destroy(b);
}
}
errval_t mem_ump_bind(struct mem_ump_binding *b, iref_t iref, mem_bind_continuation_fn *_continuation, void *st, struct waitset *waitset, idc_bind_flags_t flags, size_t inchanlen, size_t outchanlen)
{
errval_t err;
(b->b).st = NULL;
(b->b).waitset = waitset;
event_mutex_init(&((b->b).mutex), waitset);
(b->b).can_send = mem_ump_can_send;
(b->b).register_send = mem_ump_register_send;
(b->b).error_handler = mem_ump_default_error_handler;
(b->b).tx_vtbl = mem_ump_tx_vtbl;
memset(&((b->b).rx_vtbl), 0, sizeof((b->b).rx_vtbl));
flounder_support_waitset_chanstate_init(&((b->b).register_chanstate));
flounder_support_waitset_chanstate_init(&((b->b).tx_cont_chanstate));
(b->b).tx_msgnum = 0;
(b->b).rx_msgnum = 0;
(b->b).tx_msg_fragment = 0;
(b->b).rx_msg_fragment = 0;
(b->b).tx_str_pos = 0;
(b->b).rx_str_pos = 0;
(b->b).tx_str_len = 0;
(b->b).rx_str_len = 0;
(b->b).bind_cont = NULL;
flounder_stub_ump_state_init(&(b->ump_state), b);
(b->b).change_waitset = mem_ump_change_waitset;
(b->b).control = mem_ump_control;
(b->b).st = st;
(b->b).bind_cont = _continuation;
b->iref = iref;
b->inchanlen = inchanlen;
b->outchanlen = outchanlen;
// do we need a new monitor binding?
if (flags & IDC_BIND_FLAG_RPC_CAP_TRANSFER) {
err = monitor_client_new_binding(mem_ump_new_monitor_binding_continuation, b, waitset, DEFAULT_LMP_BUF_WORDS);
} else {
err = ump_chan_bind(&((b->ump_state).chan), (struct ump_bind_continuation){ .handler = mem_ump_bind_continuation, .st = b }, &((b->b).event_qnode), iref, get_monitor_binding(), inchanlen, outchanlen, NULL_CAP);
}
if (err_is_fail(err)) {
mem_ump_destroy(b);
}
return(err);
}
/*
* Connect callback for export
*/
errval_t mem_ump_connect_handler(void *st, struct monitor_binding *mb, uintptr_t mon_id, struct capref frame, size_t inchanlen, size_t outchanlen, struct capref notify_cap)
{
struct mem_export *e = st;
errval_t err;
// allocate storage for binding
struct mem_ump_binding *b = malloc(sizeof(struct mem_ump_binding ));
if (b == NULL) {
return(LIB_ERR_MALLOC_FAIL);
}
struct mem_binding *_binding = &(b->b);
(b->b).st = NULL;
(b->b).waitset = (e->waitset);
event_mutex_init(&((b->b).mutex), e->waitset);
(b->b).can_send = mem_ump_can_send;
(b->b).register_send = mem_ump_register_send;
(b->b).error_handler = mem_ump_default_error_handler;
(b->b).tx_vtbl = mem_ump_tx_vtbl;
memset(&((b->b).rx_vtbl), 0, sizeof((b->b).rx_vtbl));
flounder_support_waitset_chanstate_init(&((b->b).register_chanstate));
flounder_support_waitset_chanstate_init(&((b->b).tx_cont_chanstate));
(b->b).tx_msgnum = 0;
(b->b).rx_msgnum = 0;
(b->b).tx_msg_fragment = 0;
(b->b).rx_msg_fragment = 0;
(b->b).tx_str_pos = 0;
(b->b).rx_str_pos = 0;
(b->b).tx_str_len = 0;
(b->b).rx_str_len = 0;
(b->b).bind_cont = NULL;
flounder_stub_ump_state_init(&(b->ump_state), b);
(b->b).change_waitset = mem_ump_change_waitset;
(b->b).control = mem_ump_control;
// run user's connect handler
err = ((e->connect_cb)(e->st, _binding));
if (err_is_fail(err)) {
// connection refused
mem_ump_destroy(b);
return(err);
}
// accept the connection and setup the channel
err = ump_chan_accept(&((b->ump_state).chan), mon_id, frame, inchanlen, outchanlen);
if (err_is_fail(err)) {
err = err_push(err, LIB_ERR_UMP_CHAN_ACCEPT);
(_binding->error_handler)(_binding, err);
return(err);
}
// notify cap ignored
// setup cap handlers
(((b->ump_state).chan).cap_handlers).st = b;
(((b->ump_state).chan).cap_handlers).cap_receive_handler = mem_ump_cap_rx_handler;
// register for receive notification
err = ump_chan_register_recv(&((b->ump_state).chan), _binding->waitset, (struct event_closure){ .handler = mem_ump_rx_handler, .arg = _binding });
if (err_is_fail(err)) {
(_binding->error_handler)(_binding, err_push(err, LIB_ERR_CHAN_REGISTER_RECV));
}
// send back bind reply
ump_chan_send_bind_reply(mb, &((b->ump_state).chan), SYS_ERR_OK, mon_id, NULL_CAP);
return(SYS_ERR_OK);
}
#endif // CONFIG_FLOUNDER_BACKEND_UMP
/*
* Copyright (c) 2010, ETH Zurich.
* All rights reserved.
*
* INTERFACE NAME: mem
* INTEFACE FILE: ../if/mem.if
* INTERFACE DESCRIPTION: Memory allocation RPC interface
*
* This file is distributed under the terms in the attached LICENSE
* file. If you do not find this file, copies can be found by
* writing to:
* ETH Zurich D-INFK, Universitaetstr.6, CH-8092 Zurich.
* Attn: Systems Group.
*
* THIS FILE IS AUTOMATICALLY GENERATED BY FLOUNDER: DO NOT EDIT!
*/
#ifdef CONFIG_FLOUNDER_BACKEND_MULTIHOP
/*
* Generated Stub for Multihop on x86_64
*/
#include <string.h>
#include <barrelfish/barrelfish.h>
#include <flounder/flounder_support.h>
#include <if/mem_defs.h>
/*
* Capability sender function
*/
static void mem_multihop_cap_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_multihop_binding *mb = arg;
errval_t err = SYS_ERR_OK;
// Switch on current outgoing message
switch (_binding->tx_msgnum) {
case mem_allocate_response__msgnum:
// Switch on current outgoing cap
switch ((mb->capst).tx_capnum) {
case 0:
err = multihop_send_capability(&(mb->chan), MKCONT(mem_multihop_cap_send_handler, _binding), &(mb->capst), ((_binding->tx_union).allocate_response).mem_cap);
if (err_no(err) == FLOUNDER_ERR_TX_BUSY) {
err = multihop_chan_register_send(&(mb->chan), _binding->waitset, MKCONT(mem_multihop_cap_send_handler, _binding));
assert(err_is_ok(err));
}
if (err_is_fail(err)) {
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
break;
}
break;
case 1:
if (multihop_chan_is_window_full(&(mb->chan))) {
mb->trigger_chan = true;
break;
} else {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
break;
}
default:
assert(!("invalid cap number"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
case mem_steal_response__msgnum:
// Switch on current outgoing cap
switch ((mb->capst).tx_capnum) {
case 0:
err = multihop_send_capability(&(mb->chan), MKCONT(mem_multihop_cap_send_handler, _binding), &(mb->capst), ((_binding->tx_union).steal_response).mem_cap);
if (err_no(err) == FLOUNDER_ERR_TX_BUSY) {
err = multihop_chan_register_send(&(mb->chan), _binding->waitset, MKCONT(mem_multihop_cap_send_handler, _binding));
assert(err_is_ok(err));
}
if (err_is_fail(err)) {
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
break;
}
break;
case 1:
if (multihop_chan_is_window_full(&(mb->chan))) {
mb->trigger_chan = true;
break;
} else {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
break;
}
default:
assert(!("invalid cap number"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
case mem_free_monitor_call__msgnum:
// Switch on current outgoing cap
switch ((mb->capst).tx_capnum) {
case 0:
err = multihop_send_capability(&(mb->chan), MKCONT(mem_multihop_cap_send_handler, _binding), &(mb->capst), ((_binding->tx_union).free_monitor_call).mem_cap);
if (err_no(err) == FLOUNDER_ERR_TX_BUSY) {
err = multihop_chan_register_send(&(mb->chan), _binding->waitset, MKCONT(mem_multihop_cap_send_handler, _binding));
assert(err_is_ok(err));
}
if (err_is_fail(err)) {
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
break;
}
break;
case 1:
if (multihop_chan_is_window_full(&(mb->chan))) {
mb->trigger_chan = true;
break;
} else {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
break;
}
default:
assert(!("invalid cap number"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
default:
assert(!("invalid message number"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
}
/*
* Send handler functions
*/
static void mem_allocate_call__multihop_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_multihop_binding *mb = arg;
errval_t err = SYS_ERR_OK;
uint64_t *msg;
uint64_t msg_size;
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
// Calculate size of message & allocate it
msg_size = 24;
assert(msg_size != 0);
msg = malloc(msg_size);
// copy words from fixed size fragments
// [[MsgCode,ArgFieldFragment uint8 [NamedField "bits"] 0],[ArgFieldFragment uint64 [NamedField "minbase"] 0],[ArgFieldFragment uint64 [NamedField "maxlimit"] 0]]
msg[0] = (mem_allocate_call__msgnum | (((uint64_t )(((_binding->tx_union).allocate_call).bits)) << 16));
msg[1] = (((_binding->tx_union).allocate_call).minbase);
msg[2] = (((_binding->tx_union).allocate_call).maxlimit);
// copy strings
// copy buffers
// try to send!
(_binding->tx_msg_fragment)++;
mb->message = msg;
err = multihop_send_message(&(mb->chan), MKCONT(mem_allocate_call__multihop_send_handler, _binding), msg, msg_size);
if (err_no(err) == FLOUNDER_ERR_TX_BUSY) {
(_binding->tx_msg_fragment)--;
err = multihop_chan_register_send(&(mb->chan), _binding->waitset, MKCONT(mem_allocate_call__multihop_send_handler, _binding));
assert(err_is_ok(err));
}
if (err_is_fail(err)) {
break;
} else {
return;
}
case 1:
// all fragments are sent
free(mb->message);
if (multihop_chan_is_window_full(&(mb->chan))) {
mb->trigger_chan = true;
return;
} else {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
}
default:
assert(!("invalid fragment"));
err = FLOUNDER_ERR_INVALID_STATE;
}
// Report error to user
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
}
static void mem_allocate_response__multihop_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_multihop_binding *mb = arg;
errval_t err = SYS_ERR_OK;
uint64_t *msg;
uint64_t msg_size;
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
// Calculate size of message & allocate it
msg_size = 16;
assert(msg_size != 0);
msg = malloc(msg_size);
// copy words from fixed size fragments
// [[MsgCode],[ArgFieldFragment uint64 [NamedField "ret"] 0]]
msg[0] = mem_allocate_response__msgnum;
msg[1] = (((_binding->tx_union).allocate_response).ret);
// copy strings
// copy buffers
// try to send!
(_binding->tx_msg_fragment)++;
mb->message = msg;
err = multihop_send_message(&(mb->chan), MKCONT(mem_allocate_response__multihop_send_handler, _binding), msg, msg_size);
if (err_no(err) == FLOUNDER_ERR_TX_BUSY) {
(_binding->tx_msg_fragment)--;
err = multihop_chan_register_send(&(mb->chan), _binding->waitset, MKCONT(mem_allocate_response__multihop_send_handler, _binding));
assert(err_is_ok(err));
}
if (err_is_fail(err)) {
break;
} else {
return;
}
case 1:
free(mb->message);
// send caps
mem_multihop_cap_send_handler(mb);
return;
default:
assert(!("invalid fragment"));
err = FLOUNDER_ERR_INVALID_STATE;
}
// Report error to user
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
}
static void mem_steal_call__multihop_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_multihop_binding *mb = arg;
errval_t err = SYS_ERR_OK;
uint64_t *msg;
uint64_t msg_size;
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
// Calculate size of message & allocate it
msg_size = 24;
assert(msg_size != 0);
msg = malloc(msg_size);
// copy words from fixed size fragments
// [[MsgCode,ArgFieldFragment uint8 [NamedField "bits"] 0],[ArgFieldFragment uint64 [NamedField "minbase"] 0],[ArgFieldFragment uint64 [NamedField "maxlimit"] 0]]
msg[0] = (mem_steal_call__msgnum | (((uint64_t )(((_binding->tx_union).steal_call).bits)) << 16));
msg[1] = (((_binding->tx_union).steal_call).minbase);
msg[2] = (((_binding->tx_union).steal_call).maxlimit);
// copy strings
// copy buffers
// try to send!
(_binding->tx_msg_fragment)++;
mb->message = msg;
err = multihop_send_message(&(mb->chan), MKCONT(mem_steal_call__multihop_send_handler, _binding), msg, msg_size);
if (err_no(err) == FLOUNDER_ERR_TX_BUSY) {
(_binding->tx_msg_fragment)--;
err = multihop_chan_register_send(&(mb->chan), _binding->waitset, MKCONT(mem_steal_call__multihop_send_handler, _binding));
assert(err_is_ok(err));
}
if (err_is_fail(err)) {
break;
} else {
return;
}
case 1:
// all fragments are sent
free(mb->message);
if (multihop_chan_is_window_full(&(mb->chan))) {
mb->trigger_chan = true;
return;
} else {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
}
default:
assert(!("invalid fragment"));
err = FLOUNDER_ERR_INVALID_STATE;
}
// Report error to user
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
}
static void mem_steal_response__multihop_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_multihop_binding *mb = arg;
errval_t err = SYS_ERR_OK;
uint64_t *msg;
uint64_t msg_size;
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
// Calculate size of message & allocate it
msg_size = 16;
assert(msg_size != 0);
msg = malloc(msg_size);
// copy words from fixed size fragments
// [[MsgCode],[ArgFieldFragment uint64 [NamedField "ret"] 0]]
msg[0] = mem_steal_response__msgnum;
msg[1] = (((_binding->tx_union).steal_response).ret);
// copy strings
// copy buffers
// try to send!
(_binding->tx_msg_fragment)++;
mb->message = msg;
err = multihop_send_message(&(mb->chan), MKCONT(mem_steal_response__multihop_send_handler, _binding), msg, msg_size);
if (err_no(err) == FLOUNDER_ERR_TX_BUSY) {
(_binding->tx_msg_fragment)--;
err = multihop_chan_register_send(&(mb->chan), _binding->waitset, MKCONT(mem_steal_response__multihop_send_handler, _binding));
assert(err_is_ok(err));
}
if (err_is_fail(err)) {
break;
} else {
return;
}
case 1:
free(mb->message);
// send caps
mem_multihop_cap_send_handler(mb);
return;
default:
assert(!("invalid fragment"));
err = FLOUNDER_ERR_INVALID_STATE;
}
// Report error to user
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
}
static void mem_available_call__multihop_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_multihop_binding *mb = arg;
errval_t err = SYS_ERR_OK;
uint64_t *msg;
uint64_t msg_size;
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
// Calculate size of message & allocate it
msg_size = 8;
assert(msg_size != 0);
msg = malloc(msg_size);
// copy words from fixed size fragments
// [[MsgCode]]
msg[0] = mem_available_call__msgnum;
// copy strings
// copy buffers
// try to send!
(_binding->tx_msg_fragment)++;
mb->message = msg;
err = multihop_send_message(&(mb->chan), MKCONT(mem_available_call__multihop_send_handler, _binding), msg, msg_size);
if (err_no(err) == FLOUNDER_ERR_TX_BUSY) {
(_binding->tx_msg_fragment)--;
err = multihop_chan_register_send(&(mb->chan), _binding->waitset, MKCONT(mem_available_call__multihop_send_handler, _binding));
assert(err_is_ok(err));
}
if (err_is_fail(err)) {
break;
} else {
return;
}
case 1:
// all fragments are sent
free(mb->message);
if (multihop_chan_is_window_full(&(mb->chan))) {
mb->trigger_chan = true;
return;
} else {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
}
default:
assert(!("invalid fragment"));
err = FLOUNDER_ERR_INVALID_STATE;
}
// Report error to user
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
}
static void mem_available_response__multihop_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_multihop_binding *mb = arg;
errval_t err = SYS_ERR_OK;
uint64_t *msg;
uint64_t msg_size;
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
// Calculate size of message & allocate it
msg_size = 24;
assert(msg_size != 0);
msg = malloc(msg_size);
// copy words from fixed size fragments
// [[MsgCode],[ArgFieldFragment uint64 [NamedField "mem_avail"] 0],[ArgFieldFragment uint64 [NamedField "mem_total"] 0]]
msg[0] = mem_available_response__msgnum;
msg[1] = (((_binding->tx_union).available_response).mem_avail);
msg[2] = (((_binding->tx_union).available_response).mem_total);
// copy strings
// copy buffers
// try to send!
(_binding->tx_msg_fragment)++;
mb->message = msg;
err = multihop_send_message(&(mb->chan), MKCONT(mem_available_response__multihop_send_handler, _binding), msg, msg_size);
if (err_no(err) == FLOUNDER_ERR_TX_BUSY) {
(_binding->tx_msg_fragment)--;
err = multihop_chan_register_send(&(mb->chan), _binding->waitset, MKCONT(mem_available_response__multihop_send_handler, _binding));
assert(err_is_ok(err));
}
if (err_is_fail(err)) {
break;
} else {
return;
}
case 1:
// all fragments are sent
free(mb->message);
if (multihop_chan_is_window_full(&(mb->chan))) {
mb->trigger_chan = true;
return;
} else {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
}
default:
assert(!("invalid fragment"));
err = FLOUNDER_ERR_INVALID_STATE;
}
// Report error to user
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
}
static void mem_free_monitor_call__multihop_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_multihop_binding *mb = arg;
errval_t err = SYS_ERR_OK;
uint64_t *msg;
uint64_t msg_size;
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
// Calculate size of message & allocate it
msg_size = 16;
assert(msg_size != 0);
msg = malloc(msg_size);
// copy words from fixed size fragments
// [[MsgCode,ArgFieldFragment uint8 [NamedField "bits"] 0],[ArgFieldFragment uint64 [NamedField "base"] 0]]
msg[0] = (mem_free_monitor_call__msgnum | (((uint64_t )(((_binding->tx_union).free_monitor_call).bits)) << 16));
msg[1] = (((_binding->tx_union).free_monitor_call).base);
// copy strings
// copy buffers
// try to send!
(_binding->tx_msg_fragment)++;
mb->message = msg;
err = multihop_send_message(&(mb->chan), MKCONT(mem_free_monitor_call__multihop_send_handler, _binding), msg, msg_size);
if (err_no(err) == FLOUNDER_ERR_TX_BUSY) {
(_binding->tx_msg_fragment)--;
err = multihop_chan_register_send(&(mb->chan), _binding->waitset, MKCONT(mem_free_monitor_call__multihop_send_handler, _binding));
assert(err_is_ok(err));
}
if (err_is_fail(err)) {
break;
} else {
return;
}
case 1:
free(mb->message);
// send caps
mem_multihop_cap_send_handler(mb);
return;
default:
assert(!("invalid fragment"));
err = FLOUNDER_ERR_INVALID_STATE;
}
// Report error to user
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
}
static void mem_free_monitor_response__multihop_send_handler(void *arg)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_multihop_binding *mb = arg;
errval_t err = SYS_ERR_OK;
uint64_t *msg;
uint64_t msg_size;
// Switch on current outgoing message fragment
switch (_binding->tx_msg_fragment) {
case 0:
// Calculate size of message & allocate it
msg_size = 16;
assert(msg_size != 0);
msg = malloc(msg_size);
// copy words from fixed size fragments
// [[MsgCode],[ArgFieldFragment uint64 [NamedField "err"] 0]]
msg[0] = mem_free_monitor_response__msgnum;
msg[1] = (((_binding->tx_union).free_monitor_response).err);
// copy strings
// copy buffers
// try to send!
(_binding->tx_msg_fragment)++;
mb->message = msg;
err = multihop_send_message(&(mb->chan), MKCONT(mem_free_monitor_response__multihop_send_handler, _binding), msg, msg_size);
if (err_no(err) == FLOUNDER_ERR_TX_BUSY) {
(_binding->tx_msg_fragment)--;
err = multihop_chan_register_send(&(mb->chan), _binding->waitset, MKCONT(mem_free_monitor_response__multihop_send_handler, _binding));
assert(err_is_ok(err));
}
if (err_is_fail(err)) {
break;
} else {
return;
}
case 1:
// all fragments are sent
free(mb->message);
if (multihop_chan_is_window_full(&(mb->chan))) {
mb->trigger_chan = true;
return;
} else {
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
return;
}
default:
assert(!("invalid fragment"));
err = FLOUNDER_ERR_INVALID_STATE;
}
// Report error to user
(_binding->error_handler)(_binding, err);
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->register_chanstate));
flounder_support_deregister_chan(&(_binding->tx_cont_chanstate));
}
/*
* Cap receive handlers
*/
void mem_multihop_caps_rx_handler(void *arg, errval_t success, struct capref cap, uint32_t capid)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_multihop_binding *mb = arg;
assert(capid == ((mb->capst).rx_capnum));
// Check if there's an associated error
// FIXME: how should we report this to the user? at present we just deliver a NULL capref
if (err_is_fail(success)) {
DEBUG_ERR(success, "could not send cap over multihop channel");
}
// Switch on current incoming message
switch (_binding->rx_msgnum) {
case mem_allocate_response__msgnum:
// Switch on current incoming cap
switch (((mb->capst).rx_capnum)++) {
case 0:
((_binding->rx_union).allocate_response).mem_cap = cap;
if (mb->trigger_chan) {
mb->trigger_chan = false;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
FL_DEBUG("multihop RX mem.allocate_response\n");
assert(((_binding->rx_vtbl).allocate_response) != NULL);
((_binding->rx_vtbl).allocate_response)(_binding, ((_binding->rx_union).allocate_response).ret, ((_binding->rx_union).allocate_response).mem_cap);
_binding->rx_msgnum = 0;
break;
default:
assert(!("invalid cap number"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
case mem_steal_response__msgnum:
// Switch on current incoming cap
switch (((mb->capst).rx_capnum)++) {
case 0:
((_binding->rx_union).steal_response).mem_cap = cap;
if (mb->trigger_chan) {
mb->trigger_chan = false;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
FL_DEBUG("multihop RX mem.steal_response\n");
assert(((_binding->rx_vtbl).steal_response) != NULL);
((_binding->rx_vtbl).steal_response)(_binding, ((_binding->rx_union).steal_response).ret, ((_binding->rx_union).steal_response).mem_cap);
_binding->rx_msgnum = 0;
break;
default:
assert(!("invalid cap number"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
case mem_free_monitor_call__msgnum:
// Switch on current incoming cap
switch (((mb->capst).rx_capnum)++) {
case 0:
((_binding->rx_union).free_monitor_call).mem_cap = cap;
if (mb->trigger_chan) {
mb->trigger_chan = false;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
FL_DEBUG("multihop RX mem.free_monitor_call\n");
assert(((_binding->rx_vtbl).free_monitor_call) != NULL);
((_binding->rx_vtbl).free_monitor_call)(_binding, ((_binding->rx_union).free_monitor_call).mem_cap, ((_binding->rx_union).free_monitor_call).base, ((_binding->rx_union).free_monitor_call).bits);
_binding->rx_msgnum = 0;
break;
default:
assert(!("invalid cap number"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
break;
default:
assert(!("invalid message number"));
(_binding->error_handler)(_binding, FLOUNDER_ERR_INVALID_STATE);
}
}
/*
* Message sender functions
*/
static errval_t mem_allocate_call__multihop_send(struct mem_binding *_binding, struct event_closure _continuation, uint8_t bits, mem_genpaddr_t minbase, mem_genpaddr_t maxlimit)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and the arguments
_binding->tx_msgnum = mem_allocate_call__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).allocate_call).bits = bits;
((_binding->tx_union).allocate_call).minbase = minbase;
((_binding->tx_union).allocate_call).maxlimit = maxlimit;
FL_DEBUG("multihop TX mem.allocate_call\n");
// try to send!
mem_allocate_call__multihop_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_allocate_response__multihop_send(struct mem_binding *_binding, struct event_closure _continuation, mem_errval_t ret, struct capref mem_cap)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and the arguments
_binding->tx_msgnum = mem_allocate_response__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).allocate_response).ret = ret;
((_binding->tx_union).allocate_response).mem_cap = mem_cap;
FL_DEBUG("multihop TX mem.allocate_response\n");
// try to send!
mem_allocate_response__multihop_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_steal_call__multihop_send(struct mem_binding *_binding, struct event_closure _continuation, uint8_t bits, mem_genpaddr_t minbase, mem_genpaddr_t maxlimit)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and the arguments
_binding->tx_msgnum = mem_steal_call__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).steal_call).bits = bits;
((_binding->tx_union).steal_call).minbase = minbase;
((_binding->tx_union).steal_call).maxlimit = maxlimit;
FL_DEBUG("multihop TX mem.steal_call\n");
// try to send!
mem_steal_call__multihop_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_steal_response__multihop_send(struct mem_binding *_binding, struct event_closure _continuation, mem_errval_t ret, struct capref mem_cap)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and the arguments
_binding->tx_msgnum = mem_steal_response__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).steal_response).ret = ret;
((_binding->tx_union).steal_response).mem_cap = mem_cap;
FL_DEBUG("multihop TX mem.steal_response\n");
// try to send!
mem_steal_response__multihop_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_available_call__multihop_send(struct mem_binding *_binding, struct event_closure _continuation)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and the arguments
_binding->tx_msgnum = mem_available_call__msgnum;
_binding->tx_msg_fragment = 0;
FL_DEBUG("multihop TX mem.available_call\n");
// try to send!
mem_available_call__multihop_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_available_response__multihop_send(struct mem_binding *_binding, struct event_closure _continuation, mem_genpaddr_t mem_avail, mem_genpaddr_t mem_total)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and the arguments
_binding->tx_msgnum = mem_available_response__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).available_response).mem_avail = mem_avail;
((_binding->tx_union).available_response).mem_total = mem_total;
FL_DEBUG("multihop TX mem.available_response\n");
// try to send!
mem_available_response__multihop_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_free_monitor_call__multihop_send(struct mem_binding *_binding, struct event_closure _continuation, struct capref mem_cap, mem_genpaddr_t base, uint8_t bits)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and the arguments
_binding->tx_msgnum = mem_free_monitor_call__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).free_monitor_call).mem_cap = mem_cap;
((_binding->tx_union).free_monitor_call).base = base;
((_binding->tx_union).free_monitor_call).bits = bits;
FL_DEBUG("multihop TX mem.free_monitor_call\n");
// try to send!
mem_free_monitor_call__multihop_send_handler(_binding);
return(SYS_ERR_OK);
}
static errval_t mem_free_monitor_response__multihop_send(struct mem_binding *_binding, struct event_closure _continuation, mem_errval_t err)
{
// check that we can accept an outgoing message
if ((_binding->tx_msgnum) != 0) {
return(FLOUNDER_ERR_TX_BUSY);
}
// register send continuation
if ((_continuation.handler) != NULL) {
errval_t _err;
_err = flounder_support_register(_binding->waitset, &(_binding->tx_cont_chanstate), _continuation, false);
// may fail if previous continuation hasn't fired yet
if (err_is_fail(_err)) {
if (err_no(_err) == LIB_ERR_CHAN_ALREADY_REGISTERED) {
return(FLOUNDER_ERR_TX_BUSY);
} else {
assert(!("shouldn't happen"));
return(_err);
}
}
}
// store message number and the arguments
_binding->tx_msgnum = mem_free_monitor_response__msgnum;
_binding->tx_msg_fragment = 0;
((_binding->tx_union).free_monitor_response).err = err;
FL_DEBUG("multihop TX mem.free_monitor_response\n");
// try to send!
mem_free_monitor_response__multihop_send_handler(_binding);
return(SYS_ERR_OK);
}
/*
* Send vtable
*/
static struct mem_tx_vtbl mem_multihop_tx_vtbl = {
.allocate_call = mem_allocate_call__multihop_send,
.allocate_response = mem_allocate_response__multihop_send,
.steal_call = mem_steal_call__multihop_send,
.steal_response = mem_steal_response__multihop_send,
.available_call = mem_available_call__multihop_send,
.available_response = mem_available_response__multihop_send,
.free_monitor_call = mem_free_monitor_call__multihop_send,
.free_monitor_response = mem_free_monitor_response__multihop_send,
};
/*
* Receive handler
*/
void mem_multihop_rx_handler(void *arg, uint8_t *message, size_t message_len)
{
// Get the binding state from our argument pointer
struct mem_binding *_binding = arg;
struct mem_multihop_binding *mb = arg;
uint8_t *msg;
// if this a dummy message?
if (message_len == 0) {
if (mb->trigger_chan) {
mb->trigger_chan = false;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
return;
}
// is this the start of a new message?
if ((_binding->rx_msgnum) == 0) {
// unmarshall message number from first word, set fragment to 0
_binding->rx_msgnum = ((message[0]) & 0xffff);
_binding->rx_msg_fragment = 0;
(mb->capst).rx_capnum = 0;
} else {
assert(!"should not happen");
}
// switch on message number
switch (_binding->rx_msgnum) {
case mem_allocate_call__msgnum:
// store fixed size fragments
((_binding->rx_union).allocate_call).bits = (((((uint64_t *)(message))[0]) >> 16) & 0xff);
((_binding->rx_union).allocate_call).minbase = (((uint64_t *)(message))[1]);
((_binding->rx_union).allocate_call).maxlimit = (((uint64_t *)(message))[2]);
msg = (message + 24);
// receive strings
// receive buffers
free(message);
if (mb->trigger_chan) {
mb->trigger_chan = false;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
FL_DEBUG("multihop RX mem.allocate_call\n");
assert(((_binding->rx_vtbl).allocate_call) != NULL);
((_binding->rx_vtbl).allocate_call)(_binding, ((_binding->rx_union).allocate_call).bits, ((_binding->rx_union).allocate_call).minbase, ((_binding->rx_union).allocate_call).maxlimit);
_binding->rx_msgnum = 0;
break;
case mem_allocate_response__msgnum:
// store fixed size fragments
((_binding->rx_union).allocate_response).ret = (((uint64_t *)(message))[1]);
msg = (message + 16);
// receive strings
// receive buffers
free(message);
if (mb->trigger_chan) {
mb->trigger_chan = false;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
(_binding->rx_msg_fragment)++;
break;
case mem_steal_call__msgnum:
// store fixed size fragments
((_binding->rx_union).steal_call).bits = (((((uint64_t *)(message))[0]) >> 16) & 0xff);
((_binding->rx_union).steal_call).minbase = (((uint64_t *)(message))[1]);
((_binding->rx_union).steal_call).maxlimit = (((uint64_t *)(message))[2]);
msg = (message + 24);
// receive strings
// receive buffers
free(message);
if (mb->trigger_chan) {
mb->trigger_chan = false;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
FL_DEBUG("multihop RX mem.steal_call\n");
assert(((_binding->rx_vtbl).steal_call) != NULL);
((_binding->rx_vtbl).steal_call)(_binding, ((_binding->rx_union).steal_call).bits, ((_binding->rx_union).steal_call).minbase, ((_binding->rx_union).steal_call).maxlimit);
_binding->rx_msgnum = 0;
break;
case mem_steal_response__msgnum:
// store fixed size fragments
((_binding->rx_union).steal_response).ret = (((uint64_t *)(message))[1]);
msg = (message + 16);
// receive strings
// receive buffers
free(message);
if (mb->trigger_chan) {
mb->trigger_chan = false;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
(_binding->rx_msg_fragment)++;
break;
case mem_available_call__msgnum:
// store fixed size fragments
msg = (message + 8);
// receive strings
// receive buffers
free(message);
if (mb->trigger_chan) {
mb->trigger_chan = false;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
FL_DEBUG("multihop RX mem.available_call\n");
assert(((_binding->rx_vtbl).available_call) != NULL);
((_binding->rx_vtbl).available_call)(_binding);
_binding->rx_msgnum = 0;
break;
case mem_available_response__msgnum:
// store fixed size fragments
((_binding->rx_union).available_response).mem_avail = (((uint64_t *)(message))[1]);
((_binding->rx_union).available_response).mem_total = (((uint64_t *)(message))[2]);
msg = (message + 24);
// receive strings
// receive buffers
free(message);
if (mb->trigger_chan) {
mb->trigger_chan = false;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
FL_DEBUG("multihop RX mem.available_response\n");
assert(((_binding->rx_vtbl).available_response) != NULL);
((_binding->rx_vtbl).available_response)(_binding, ((_binding->rx_union).available_response).mem_avail, ((_binding->rx_union).available_response).mem_total);
_binding->rx_msgnum = 0;
break;
case mem_free_monitor_call__msgnum:
// store fixed size fragments
((_binding->rx_union).free_monitor_call).bits = (((((uint64_t *)(message))[0]) >> 16) & 0xff);
((_binding->rx_union).free_monitor_call).base = (((uint64_t *)(message))[1]);
msg = (message + 16);
// receive strings
// receive buffers
free(message);
if (mb->trigger_chan) {
mb->trigger_chan = false;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
(_binding->rx_msg_fragment)++;
break;
case mem_free_monitor_response__msgnum:
// store fixed size fragments
((_binding->rx_union).free_monitor_response).err = (((uint64_t *)(message))[1]);
msg = (message + 16);
// receive strings
// receive buffers
free(message);
if (mb->trigger_chan) {
mb->trigger_chan = false;
_binding->tx_msgnum = 0;
flounder_support_trigger_chan(&(_binding->tx_cont_chanstate));
flounder_support_trigger_chan(&(_binding->register_chanstate));
}
FL_DEBUG("multihop RX mem.free_monitor_response\n");
assert(((_binding->rx_vtbl).free_monitor_response) != NULL);
((_binding->rx_vtbl).free_monitor_response)(_binding, ((_binding->rx_union).free_monitor_response).err);
_binding->rx_msgnum = 0;
break;
default:
(_binding->error_handler)(_binding, FLOUNDER_ERR_RX_INVALID_MSGNUM);
return;
}
}
/*
* Control functions
*/
static bool mem_multihop_can_send(struct mem_binding *b)
{
struct mem_multihop_binding *mb = (struct mem_multihop_binding *)(b);
return(((b->tx_msgnum) == 0) && (!multihop_chan_is_window_full(&(mb->chan))));
}
static errval_t mem_multihop_register_send(struct mem_binding *b, struct waitset *ws, struct event_closure _continuation)
{
return(flounder_support_register(ws, &(b->register_chanstate), _continuation, mem_multihop_can_send(b)));
}
static void mem_multihop_default_error_handler(struct mem_binding *b, errval_t err)
{
DEBUG_ERR(err, "asynchronous error in Flounder-generated mem multihop binding (default handler)");
abort();
}
static errval_t mem_multihop_change_waitset(struct mem_binding *_binding, struct waitset *ws)
{
struct mem_multihop_binding *mb = (void *)(_binding);
// change waitset on binding
_binding->waitset = ws;
// change waitset on multi-hop channel
return(multihop_chan_change_waitset(&(mb->chan), ws));
}
static errval_t mem_multihop_control(struct mem_binding *_binding, idc_control_t control)
{
// No control flags supported
return(SYS_ERR_OK);
}
/*
* Functions to initialise/destroy the binding state
*/
void mem_multihop_init(struct mem_multihop_binding *mb, struct waitset *waitset)
{
(mb->b).st = NULL;
(mb->b).waitset = waitset;
event_mutex_init(&((mb->b).mutex), waitset);
(mb->b).can_send = mem_multihop_can_send;
(mb->b).register_send = mem_multihop_register_send;
(mb->b).error_handler = mem_multihop_default_error_handler;
(mb->b).tx_vtbl = mem_multihop_tx_vtbl;
memset(&((mb->b).rx_vtbl), 0, sizeof((mb->b).rx_vtbl));
flounder_support_waitset_chanstate_init(&((mb->b).register_chanstate));
flounder_support_waitset_chanstate_init(&((mb->b).tx_cont_chanstate));
(mb->b).tx_msgnum = 0;
(mb->b).rx_msgnum = 0;
(mb->b).tx_msg_fragment = 0;
(mb->b).rx_msg_fragment = 0;
(mb->b).tx_str_pos = 0;
(mb->b).rx_str_pos = 0;
(mb->b).tx_str_len = 0;
(mb->b).rx_str_len = 0;
(mb->b).bind_cont = NULL;
(mb->b).change_waitset = mem_multihop_change_waitset;
(mb->b).control = mem_multihop_control;
mb->trigger_chan = false;
}
void mem_multihop_destroy(struct mem_multihop_binding *mb)
{
flounder_support_waitset_chanstate_destroy(&((mb->b).register_chanstate));
flounder_support_waitset_chanstate_destroy(&((mb->b).tx_cont_chanstate));
assert(! "NYI!");
}
/*
* Bind function
*/
static void mem_multihop_bind_continuation(void *st, errval_t err, struct multihop_chan *chan)
{
struct mem_multihop_binding *mb = st;
if (err_is_ok(err)) {
// set receive handlers
multihop_chan_set_receive_handler(&(mb->chan), (struct multihop_receive_handler){ .handler = mem_multihop_rx_handler, .arg = st });
multihop_chan_set_caps_receive_handlers(&(mb->chan), (struct monitor_cap_handlers){ .st = st, .cap_receive_handler = mem_multihop_caps_rx_handler });
} else {
mem_multihop_destroy(mb);
}
((mb->b).bind_cont)((mb->b).st, err, &(mb->b));
}
errval_t mem_multihop_bind(struct mem_multihop_binding *mb, iref_t iref, mem_bind_continuation_fn *_continuation, void *st, struct waitset *waitset, idc_bind_flags_t flags)
{
errval_t err;
mem_multihop_init(mb, waitset);
(mb->b).st = st;
(mb->b).bind_cont = _continuation;
err = multihop_chan_bind(&(mb->chan), (struct multihop_bind_continuation){ .handler = mem_multihop_bind_continuation, .st = mb }, iref, waitset);
if (err_is_fail(err)) {
mem_multihop_destroy(mb);
}
return(err);
}
/*
* Connect callback for export
*/
errval_t mem_multihop_connect_handler(void *st, multihop_vci_t vci)
{
struct mem_export *e = st;
errval_t err;
// allocate storage for binding
struct mem_multihop_binding *mb = malloc(sizeof(struct mem_multihop_binding ));
if (mb == NULL) {
return(LIB_ERR_MALLOC_FAIL);
}
// initialize binding
struct mem_binding *_binding = &(mb->b);
mem_multihop_init(mb, e->waitset);
(mb->chan).vci = vci;
// run user's connect handler
err = ((e->connect_cb)(e->st, _binding));
if (err_is_fail(err)) {
return(err);
}
// set receive handlers
multihop_chan_set_receive_handler(&(mb->chan), (struct multihop_receive_handler){ .handler = mem_multihop_rx_handler, .arg = mb });
multihop_chan_set_caps_receive_handlers(&(mb->chan), (struct monitor_cap_handlers){ .st = mb, .cap_receive_handler = mem_multihop_caps_rx_handler });
// send back bind reply
multihop_chan_send_bind_reply(&(mb->chan), SYS_ERR_OK, (mb->chan).vci, (mb->b).waitset);
return(err);
}
#endif // CONFIG_FLOUNDER_BACKEND_MULTIHOP
| daleooo/barrelfish | build/x86_64/lib/barrelfish/_for_lib_barrelfish/mem_flounder_bindings.c | C | mit | 156,625 |
/* from optimizations/bfs/topology-atomic.cu */
#define BFS_VARIANT "topology-atomic"
#define WORKPERTHREAD 1
#define VERTICALWORKPERTHREAD 12 // max value, see relax.
#define BLKSIZE 1024
#define BANKSIZE BLKSIZE
__global__
void initialize(foru *dist, unsigned int *nv) {
unsigned int ii = blockIdx.x * blockDim.x + threadIdx.x;
//printf("ii=%d, nv=%d.\n", ii, *nv);
if (ii < *nv) {
dist[ii] = MYINFINITY;
}
}
__global__
void dprocess(float *matrix, foru *dist, unsigned int *prev, bool *relaxed) {
__shared__ volatile unsigned int dNVERTICES;
unsigned int ii = blockIdx.x * blockDim.x + threadIdx.x;
unsigned int v;
unsigned int jj;
if (ii < dNVERTICES) {
unsigned int u = dNVERTICES;
foru mm = MYINFINITY;
//minimum <<< NVERTICES / BLKSIZE, BLKSIZE>>> (dist, relaxed, &u);
for (jj = 0; jj < dNVERTICES; ++jj) {
if (relaxed[jj] == false && dist[jj] < mm) {
mm = dist[jj];
u = jj;
}
}
if (u != dNVERTICES && dist[u] != MYINFINITY) {
relaxed[u] = true;
for (v = 0; v < dNVERTICES; ++v) {
if (matrix[u*dNVERTICES + v] > 0) {
foru alt = dist[u] + matrix[u*dNVERTICES + v];
if (alt < dist[v]) {
dist[v] = alt;
prev[v] = u;
}
}
}
}
}
}
__global__
void drelax(foru *dist, unsigned int *edgessrcdst, foru *edgessrcwt, unsigned int *psrc, unsigned int *noutgoing, unsigned int *nedges, unsigned int *nv, bool *changed, unsigned int *srcsrc, unsigned unroll) {
unsigned int workperthread = WORKPERTHREAD;
unsigned nn = workperthread * (blockIdx.x * blockDim.x + threadIdx.x);
unsigned int ii;
__shared__ int changedv[VERTICALWORKPERTHREAD * BLKSIZE];
int iichangedv = threadIdx.x;
int anotheriichangedv = iichangedv;
unsigned int nprocessed = 0;
// collect the work to be performed.
for (unsigned node = 0; node < workperthread; ++node, ++nn) {
changedv[iichangedv] = nn;
iichangedv += BANKSIZE;
}
// go over the worklist and keep updating it in a BFS manner.
while (anotheriichangedv < iichangedv) {
nn = changedv[anotheriichangedv];
anotheriichangedv += BANKSIZE;
if (nn < *nv) {
unsigned src = nn; // source node.
//if (src < *nv && psrc[srcsrc[src]]) {
unsigned int start = psrc[srcsrc[src]];
unsigned int end = start + noutgoing[src];
// go over all the target nodes for the source node.
for (ii = start; ii < end; ++ii) {
unsigned int u = src;
unsigned int v = edgessrcdst[ii]; // target node.
float wt = 1;
//if (wt > 0 && v < *nv) {
foru alt = dist[u] + wt;
if (alt < dist[v]) {
//dist[v] = alt;
atomicMin((unsigned *)&dist[v], (unsigned )alt);
if (++nprocessed < unroll) {
// add work to the worklist.
changedv[iichangedv] = v;
iichangedv += BANKSIZE;
}
}
//}
}
//}
}
}
if (nprocessed) {
*changed = true;
}
}
void bfs(Graph &graph, foru *dist)
{
cudaFuncSetCacheConfig(drelax, cudaFuncCachePreferShared);
foru zero = 0;
//unsigned int intzero = 0, intone = 1;
unsigned int NBLOCKS, FACTOR = 128;
unsigned int *nedges, hnedges;
unsigned int *nv;
bool *changed, hchanged;
int iteration = 0;
double starttime, endtime;
double runtime;
cudaEvent_t start, stop;
float time;
cudaDeviceProp deviceProp;
unsigned int NVERTICES;
cudaGetDeviceProperties(&deviceProp, 0);
NBLOCKS = deviceProp.multiProcessorCount;
NVERTICES = graph.nnodes;
hnedges = graph.nedges;
FACTOR = (NVERTICES + BLKSIZE * NBLOCKS - 1) / (BLKSIZE * NBLOCKS);
if (cudaMalloc((void **)&nv, sizeof(unsigned int)) != cudaSuccess) CudaTest("allocating nv failed");
cudaMemcpy(nv, &NVERTICES, sizeof(NVERTICES), cudaMemcpyHostToDevice);
if (cudaMalloc((void **)&nedges, sizeof(unsigned int)) != cudaSuccess) CudaTest("allocating nedges failed");
cudaMemcpy(nedges, &hnedges, sizeof(unsigned int), cudaMemcpyHostToDevice);
if (cudaMalloc((void **)&changed, sizeof(bool)) != cudaSuccess) CudaTest("allocating changed failed");
for (unsigned unroll=VERTICALWORKPERTHREAD; unroll <= VERTICALWORKPERTHREAD; ++unroll) {
//printf("initializing (nblocks=%d, blocksize=%d).\n", NBLOCKS*FACTOR, BLKSIZE);
//initialize <<<NBLOCKS*FACTOR, BLKSIZE>>> (dist, nv);
//__set_CUDAConfig(NBLOCKS*FACTOR, BLKSIZE);
printf("initialize kernel \n");
__set_CUDAConfig(1, 256);
initialize(dist, nv);
CudaTest("initializing failed");
cudaMemcpy(&dist[0], &zero, sizeof(zero), cudaMemcpyHostToDevice);
//printf("solving.\n");
starttime = rtclock();
cudaEventCreate(&start);
cudaEventCreate(&stop);
//cudaEventRecord(start, 0);
//do {
++iteration;
//printf("iteration %d.\n", iteration);
hchanged = false;
cudaMemcpy(changed, &hchanged, sizeof(bool), cudaMemcpyHostToDevice);
unsigned nblocks = NBLOCKS*FACTOR;
//sree: why are nedges and nv pointers?
//drelax <<<nblocks/WORKPERTHREAD, BLKSIZE>>> (dist, graph.edgessrcdst, graph.edgessrcwt, graph.psrc, graph.noutgoing, nedges, nv, changed, graph.srcsrc, unroll);
printf("drelax kernel \n");
__set_CUDAConfig(1, 256);
drelax(dist, graph.edgessrcdst, graph.edgessrcwt, graph.psrc, graph.noutgoing, nedges, nv, changed, graph.srcsrc, unroll);
CudaTest("solving failed");
cudaMemcpy(&hchanged, changed, sizeof(bool), cudaMemcpyDeviceToHost);
//} while (hchanged);
//cudaEventRecord(stop, 0); cudaEventSynchronize(stop); cudaEventElapsedTime(&time, start, stop);
endtime = rtclock();
runtime = 1000*(endtime - starttime);
//printf("%d ms.\n", runtime);
printf("\n");
printf("\truntime [%s] = %.3lf ms.\n",
BFS_VARIANT, 1000 * (endtime - starttime));
printf("%d\t%f\n", unroll, runtime);
}
printf("iterations = %d.\n", iteration);
}
| Geof23/SESABench_II | LoneStar/apps/bfs/BFS_ATOMIC/bfs_topo_atomic.h | C | mit | 5,764 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `benchmark` fn in crate `test`.">
<meta name="keywords" content="rust, rustlang, rust-lang, benchmark">
<title>test::bench::benchmark - Rust</title>
<link rel="stylesheet" type="text/css" href="../../main.css">
<link rel="shortcut icon" href="http://www.rust-lang.org/favicon.ico">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<section class="sidebar">
<a href='../../test/index.html'><img src='http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='' width='100'></a>
<p class='location'><a href='../index.html'>test</a>::<wbr><a href='index.html'>bench</a></p><script>window.sidebarCurrent = {name: 'benchmark', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</section>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press 'S' to search, '?' for more options..."
type="search">
</div>
</form>
</nav>
<section id='main' class="content fn">
<h1 class='fqn'><span class='in-band'>Function <a href='../index.html'>test</a>::<wbr><a href='index.html'>bench</a>::<wbr><a class='fn' href=''>benchmark</a><wbr><a class='stability Unstable' title=''>Unstable</a></span><span class='out-of-band'><span id='render-detail'>
<a id="collapse-all" href="#">[-]</a> <a id="expand-all" href="#">[+]</a>
</span><a id='src-8073' href='../../src/test/lib.rs.html#1129-1146'>[src]</a></span></h1>
<pre class='rust fn'>pub fn benchmark<F>(f: F) -> <a class='struct' href='../../test/struct.BenchSamples.html' title='test::BenchSamples'>BenchSamples</a> <span class='where'>where F: <a class='trait' href='../../core/ops/trait.FnMut.html' title='core::ops::FnMut'>FnMut</a>(&mut <a class='struct' href='../../test/struct.Bencher.html' title='test::Bencher'>Bencher</a>)</span></pre></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<div id="help" class="hidden">
<div class="shortcuts">
<h1>Keyboard shortcuts</h1>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>⇤</dt>
<dd>Move up in search results</dd>
<dt>⇥</dt>
<dd>Move down in search results</dd>
<dt>⏎</dt>
<dd>Go to active search result</dd>
</dl>
</div>
<div class="infos">
<h1>Search tricks</h1>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>typedef</code> (or
<code>tdef</code>).
</p>
</div>
</div>
<script>
window.rootPath = "../../";
window.currentCrate = "test";
window.playgroundUrl = "";
</script>
<script src="../../jquery.js"></script>
<script src="../../main.js"></script>
<script async src="../../search-index.js"></script>
</body>
</html> | ArcherSys/ArcherSys | Rust/share/doc/rust/html/test/bench/fn.benchmark.html | HTML | mit | 3,967 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_60) on Fri Dec 11 10:08:00 MST 2015 -->
<title>ca.ualberta.cs.xpertsapp.UITests.FriendTests</title>
<meta name="date" content="2015-12-11">
<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="ca.ualberta.cs.xpertsapp.UITests.FriendTests";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<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 class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-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><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../ca/ualberta/cs/xpertsapp/UITests/BrowseTests/package-summary.html">Prev Package</a></li>
<li><a href="../../../../../../ca/ualberta/cs/xpertsapp/UITests/InventoryTests/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?ca/ualberta/cs/xpertsapp/UITests/FriendTests/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Package" class="title">Package ca.ualberta.cs.xpertsapp.UITests.FriendTests</h1>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation">
<caption><span>Class Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../../ca/ualberta/cs/xpertsapp/UITests/FriendTests/ProfileControllerTest.html" title="class in ca.ualberta.cs.xpertsapp.UITests.FriendTests">ProfileControllerTest</a></td>
<td class="colLast">
<div class="block">Created by kmbaker on 11/3/15.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../../ca/ualberta/cs/xpertsapp/UITests/FriendTests/ViewFriendProfileTest.html" title="class in ca.ualberta.cs.xpertsapp.UITests.FriendTests">ViewFriendProfileTest</a></td>
<td class="colLast">
<div class="block">Created by kmbaker on 11/3/15.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<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 class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-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><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../ca/ualberta/cs/xpertsapp/UITests/BrowseTests/package-summary.html">Prev Package</a></li>
<li><a href="../../../../../../ca/ualberta/cs/xpertsapp/UITests/InventoryTests/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?ca/ualberta/cs/xpertsapp/UITests/FriendTests/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| CMPUT301F15T02/Xperts | docs/JavaDoc/ca/ualberta/cs/xpertsapp/UITests/FriendTests/package-summary.html | HTML | mit | 5,527 |
#include <stdio.h>
#include <stdint.h>
#include <ibcrypt/chacha.h>
#include <ibcrypt/rand.h>
#include <ibcrypt/sha256.h>
#include <ibcrypt/zfree.h>
#include <libibur/util.h>
#include <libibur/endian.h>
#include "datafile.h"
#include "../util/log.h"
int write_datafile(char *path, void *arg, void *data, struct format_desc *f) {
int ret = -1;
uint8_t *payload = NULL;
uint64_t payload_len = 0;
uint64_t payload_num = 0;
uint8_t *prefix = NULL;
uint64_t pref_len = 0;
uint8_t symm_key[0x20];
uint8_t hmac_key[0x20];
uint8_t enc_key[0x20];
FILE *ff = fopen(path, "wb");
if(ff == NULL) {
ERR("failed to open file for writing: %s", path);
goto err;
}
pref_len = 0x50 + f->pref_len;
prefix = malloc(pref_len);
if(prefix == NULL) {
ERR("failed to allocate memory");
goto err;
}
void *cur = data;
while(cur) {
payload_len += f->datalen(cur);
payload_num++;
cur = *((void **) ((char*)cur + f->next_off));
}
encbe64(payload_num, &prefix[0]);
encbe64(payload_len, &prefix[8]);
if(cs_rand(&prefix[0x10], 0x20) != 0) {
ERR("failed to generate random numbers");
goto err;
}
if(f->p_fill(arg, &prefix[0x30]) != 0) {
goto err;
}
if(f->s_key(arg, &prefix[0x30], symm_key) != 0) {
goto err;
}
if(f->h_key(arg, &prefix[0x30], hmac_key) != 0) {
goto err;
}
hmac_sha256(hmac_key, 0x20, prefix, pref_len - 0x20, &prefix[pref_len - 0x20]);
SHA256_CTX kctx;
sha256_init(&kctx);
sha256_update(&kctx, symm_key, 0x20);
sha256_update(&kctx, &prefix[0x10], 0x20);
sha256_final(&kctx, enc_key);
payload = malloc(payload_len);
if(payload == NULL) {
ERR("failed to allocate memory");
goto err;
}
cur = data;
uint8_t *ptr = payload;
while(cur) {
ptr = f->datawrite(cur, ptr);
if(ptr == NULL) {
goto err;
}
cur = *((void **) ((char*)cur + f->next_off));
}
if(ptr - payload != payload_len) {
ERR("written length does not match expected");
goto err;
}
chacha_enc(enc_key, 0x20, 0, payload, payload, payload_len);
HMAC_SHA256_CTX hctx;
hmac_sha256_init(&hctx, hmac_key, 0x20);
hmac_sha256_update(&hctx, prefix, pref_len);
hmac_sha256_update(&hctx, payload, payload_len);
uint8_t mac[0x20];
hmac_sha256_final(&hctx, mac);
if(fwrite(prefix, 1, pref_len, ff) != pref_len) {
goto writerr;
}
if(payload_len > 0) {
if(fwrite(payload, 1, payload_len, ff) != payload_len) {
goto writerr;
}
}
if(fwrite(mac, 1, 0x20, ff) != 0x20) {
goto writerr;
}
ret = 0;
err:
if(ff) fclose(ff);
if(payload) zfree(payload, payload_len);
memsets(enc_key, 0, sizeof(enc_key));
memsets(symm_key, 0, sizeof(symm_key));
memsets(hmac_key, 0, sizeof(hmac_key));
return ret;
writerr:
ERR("failed to write to file: %s", path);
goto err;
}
int read_datafile(char *path, void *arg, void **data, struct format_desc *f) {
int ret = -1;
uint8_t *payload = NULL;
uint64_t payload_len = 0;
uint64_t payload_num = 0;
uint8_t *prefix = NULL;
uint64_t pref_len = 0;
uint8_t symm_key[0x20];
uint8_t hmac_key[0x20];
uint8_t enc_key[0x20];
uint8_t mac1[0x20];
uint8_t mac2c[0x20];
uint8_t mac2f[0x20];
FILE *ff = fopen(path, "rb");
if(ff == NULL) {
ERR("failed to open file for reading: %s", path);
goto err;
}
pref_len = 0x50 + f->pref_len;
prefix = malloc(pref_len);
if(prefix == NULL) {
ERR("failed to allocate memory");
goto err;
}
if(fread(prefix, 1, pref_len, ff) != pref_len) {
goto readerr;
}
payload_num = decbe64(&prefix[0]);
payload_len = decbe64(&prefix[8]);
if(f->s_key(arg, &prefix[0x30], symm_key) != 0) {
goto err;
}
if(f->h_key(arg, &prefix[0x30], hmac_key) != 0) {
goto err;
}
hmac_sha256(hmac_key, 0x20, prefix, pref_len - 0x20, mac1);
if(memcmp_ct(mac1, &prefix[pref_len-0x20], 0x20) != 0) {
ERR("invalid file");
goto err;
}
SHA256_CTX kctx;
sha256_init(&kctx);
sha256_update(&kctx, symm_key, 0x20);
sha256_update(&kctx, &prefix[0x10], 0x20);
sha256_final(&kctx, enc_key);
payload = malloc(payload_len);
if(payload == NULL) {
ERR("failed to allocate memory");
goto err;
}
if(fread(payload, 1, payload_len, ff) != payload_len) {
goto readerr;
}
if(fread(mac2f, 1, 0x20, ff) != 0x20) {
goto readerr;
}
HMAC_SHA256_CTX hctx;
hmac_sha256_init(&hctx, hmac_key, 0x20);
hmac_sha256_update(&hctx, prefix, pref_len);
hmac_sha256_update(&hctx, payload, payload_len);
hmac_sha256_final(&hctx, mac2c);
if(memcmp_ct(mac2c, mac2f, 0x20) != 0) {
ERR("invalid file");
goto err;
}
chacha_dec(enc_key, 0x20, 0, payload, payload, payload_len);
void **cur = data;
uint8_t *ptr = payload;
uint64_t i;
for(i = 0; (ptr - payload) < payload_len && i < payload_num; i++) {
ptr = f->dataread(cur, arg, ptr);
if(ptr == NULL) {
goto err;
}
cur = (void **) ((char*)(*cur) + f->next_off);
}
*cur = NULL;
if(i != payload_num) {
ERR("read num does not match expected");
goto err;
}
if(ptr - payload != payload_len) {
ERR("read length does not match expected");
goto err;
}
ret = 0;
err:
if(ff) fclose(ff);
if(payload) zfree(payload, payload_len);
memsets(enc_key, 0, sizeof(enc_key));
memsets(symm_key, 0, sizeof(symm_key));
memsets(hmac_key, 0, sizeof(hmac_key));
return ret;
readerr:
ERR("failed to read from file: %s", path);
goto err;
}
| iburinoc/ibchat | client/datafile.c | C | mit | 5,238 |
# Acknowledgements
This application makes use of the following third party libraries:
## GreenAR
Copyright (c) 2017 Daniel Grenier <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Generated by CocoaPods - https://cocoapods.org
| Seanalair/GreenAR | Example/Pods/Target Support Files/Pods-GreenAR_Example/Pods-GreenAR_Example-acknowledgements.markdown | Markdown | mit | 1,227 |
import CommuniqueApp from './communique-app';
CommuniqueApp.open();
| kramerc/communique | lib/browser/main.js | JavaScript | mit | 68 |
using System.Collections.Generic;
using System.IO;
using Reinforced.Typings.Fluent;
using Xunit;
namespace Reinforced.Typings.Tests.SpecificCases
{
public partial class SpecificTestCases
{
[Fact]
public void ReferencesPart6ByDanielWest()
{
/**
* Specific test case with equal folder names by Daniel West
*/
const string file1 = @"
export namespace Reinforced.Typings.Tests.SpecificCases {
export enum SomeEnum {
One = 0,
Two = 1
}
}";
const string file2 = @"
import * as Enum from '../../APIv2/Models/TimeAndAttendance/Enum';
export namespace Reinforced.Typings.Tests.SpecificCases {
export class SomeViewModel
{
public Enum: Enum.Reinforced.Typings.Tests.SpecificCases.SomeEnum;
}
}";
AssertConfiguration(s =>
{
s.Global(a => a.DontWriteWarningComment().UseModules(discardNamespaces: false));
s.ExportAsEnum<SomeEnum>().ExportTo("Areas/APIv2/Models/TimeAndAttendance/Enum.ts");
s.ExportAsClass<SomeViewModel>().WithPublicProperties().ExportTo("Areas/Reporting/Models/Model.ts");
}, new Dictionary<string, string>
{
{ Path.Combine(TargetDir, "Areas/APIv2/Models/TimeAndAttendance/Enum.ts"), file1 },
{ Path.Combine(TargetDir, "Areas/Reporting/Models/Model.ts"), file2 }
}, compareComments: true);
}
}
} | reinforced/Reinforced.Typings | Reinforced.Typings.Tests/SpecificCases/SpecificTestCases.ReferencesPart6ByDanielWest.cs | C# | mit | 1,466 |
package com.avsystem.scex.util.function;
import org.apache.commons.codec.digest.HmacAlgorithms;
import org.apache.commons.codec.digest.HmacUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.Collection;
public class StringUtilImpl implements StringUtil {
public static final StringUtilImpl INSTANCE = new StringUtilImpl();
private StringUtilImpl() {
}
@Override
public String concat(String... parts) {
return StringFunctions.concat(parts);
}
@Override
public boolean contains(String list, String item) {
return StringFunctions.contains(list, item);
}
@Override
public double extract(String string) {
return StringFunctions.extract(string);
}
@Override
public String regexFind(String value, String pattern) {
return StringFunctions.regexFind(value, pattern);
}
@Override
public String regexFindGroup(String value, String pattern) {
return StringFunctions.regexFindGroup(value, pattern);
}
@Override
public boolean regexMatches(String value, String pattern) {
return StringFunctions.regexMatches(value, pattern);
}
@Override
public String regexReplace(String value, String pattern, String replacement) {
return StringFunctions.regexReplace(value, pattern, replacement);
}
@Override
public String regexReplaceAll(String value, String pattern, String replacement) {
return StringFunctions.regexReplaceAll(value, pattern, replacement);
}
@Override
public String slice(String item, int from) {
return StringFunctions.slice(item, from);
}
@Override
public String slice(String item, int from, int to, boolean dot) {
return StringFunctions.slice(item, from, to, dot);
}
@Override
public String stripToAlphanumeric(String source, String replacement) {
return StringFunctions.stripToAlphanumeric(source, replacement);
}
/**
* Remove end for string if exist
*
* @param source source string
* @param end string to remove from the end of source
* @return string with removed end
*/
@Override
public String removeEnd(String source, String end) {
if (source != null && end != null) {
return source.endsWith(end) ? source.substring(0, source.length() - end.length()) : source;
}
return null;
}
/**
* Remove start from string if exist
*
* @param source source string
* @param start string to remove from the start of source
* @return string with removed end
*/
@Override
public String removeStart(String source, String start) {
if (source != null && start != null) {
return source.startsWith(start) ? source.substring(start.length(), source.length()) : source;
}
return null;
}
@Override
public String removeTRRoot(String source) {
if (source != null) {
if (source.startsWith("InternetGatewayDevice.")) {
source = source.replaceFirst("InternetGatewayDevice.", "");
} else if (source.startsWith("Device.")) {
source = source.replaceFirst("Device.", "");
}
}
return source;
}
@Override
public String random(int length) {
return RandomStringUtils.randomAlphanumeric(length);
}
/**
* Left pad a String with a specified String.
*
* @param str the String to pad out, may be null
* @param size the size to pad to
* @param padStr the String to pad with, null or empty treated as single space
* @return right padded String
*/
@Override
public String leftPad(String str, int size, String padStr) {
return StringFunctions.leftPad(str, size, padStr);
}
/**
* Right pad a String with a specified String.
*
* @param str the String to pad out, may be null
* @param size the size to pad to
* @param padStr the String to pad with, null or empty treated as single space
* @return left padded String
*/
@Override
public String rightPad(String str, int size, String padStr) {
return StringFunctions.rightPad(str, size, padStr);
}
@Override
public String subString(String str, int from, int to) {
return StringUtils.substring(str, from, to);
}
@Override
public String[] split(String str, String separator) {
return StringUtils.split(str, separator);
}
@Override
public String trimToEmpty(String str) {
return StringUtils.trimToEmpty(str);
}
@Override
public String replace(String str, String find, String replacement) {
return StringUtils.replace(str, find, replacement);
}
@Override
public String join(Collection<String> list, String separator) {
return StringUtils.join(list, separator);
}
@Override
public boolean stringContains(String source, String item) {
return StringUtils.contains(source, item);
}
@Override
public String hmacMD5(String str, String key) {
return new HmacUtils(HmacAlgorithms.HMAC_MD5, key).hmacHex(str);
}
}
| AVSystem/scex | scex-util/src/main/scala/com/avsystem/scex/util/function/StringUtilImpl.java | Java | mit | 5,283 |
require 'minitest_helper'
require 'mocha/setup'
module Sidekiq
module Statistic
describe 'Middleware' do
def to_number(i)
i.match('\.').nil? ? Integer(i) : Float(i) rescue i.to_s
end
before { Sidekiq.redis(&:flushdb) }
let(:date){ Time.now.utc.to_date }
let(:actual) do
Sidekiq.redis do |conn|
redis_hash = {}
conn
.hgetall(REDIS_HASH)
.each do |keys, value|
*keys, last = keys.split(":")
keys.inject(redis_hash){ |hash, key| hash[key] || hash[key] = {} }[last.to_sym] = to_number(value)
end
redis_hash.values.last
end
end
it 'records statistic for passed worker' do
middlewared {}
assert_equal 1, actual['HistoryWorker'][:passed]
assert_equal nil, actual['HistoryWorker'][:failed]
end
it 'records statistic for failed worker' do
begin
middlewared do
raise StandardError.new('failed')
end
rescue
end
assert_equal nil, actual['HistoryWorker'][:passed]
assert_equal 1, actual['HistoryWorker'][:failed]
end
it 'records statistic for any workers' do
middlewared { sleep 0.001 }
begin
middlewared do
sleep 0.1
raise StandardError.new('failed')
end
rescue
end
middlewared { sleep 0.001 }
assert_equal 2, actual['HistoryWorker'][:passed]
assert_equal 1, actual['HistoryWorker'][:failed]
end
it 'support multithreaded calculations' do
workers = []
20.times do
workers << Thread.new do
25.times { middlewared {} }
end
end
workers.each(&:join)
assert_equal 500, actual['HistoryWorker'][:passed]
end
it 'removes 1/4 the timelist entries after crossing max_timelist_length' do
workers = []
Sidekiq::Statistic.configuration.max_timelist_length = 10
11.times do
middlewared {}
end
assert_equal 8, Sidekiq.redis { |conn| conn.llen("#{Time.now.strftime "%Y-%m-%d"}:HistoryWorker:timeslist") }
end
it 'supports ActiveJob workers' do
message = {
'class' => 'ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper',
'wrapped' => 'RealWorkerClassName'
}
middlewared(ActiveJobWrapper, message) {}
assert_equal actual.keys, ['RealWorkerClassName']
assert_equal 1, actual['RealWorkerClassName'][:passed]
assert_equal nil, actual['RealWorkerClassName'][:failed]
end
it 'supports mailers called from AJ' do
message = {
'class' => 'ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper',
'wrapped' => 'ActionMailer::DeliveryJob',
'args' => [{
'job_class' => 'ActionMailer::DeliveryJob',
'job_id'=>'cdcc67fb-8fdc-490c-9226-9c7f46a2dbaf',
'queue_name'=>'mailers',
'arguments' => ['WrappedMailer', 'welcome_email', 'deliver_now']
}]
}
middlewared(ActiveJobWrapper, message) {}
assert_equal actual.keys, ['WrappedMailer']
assert_equal 1, actual['WrappedMailer'][:passed]
assert_equal nil, actual['WrappedMailer'][:failed]
end
it 'records statistic for more than one worker' do
middlewared{}
middlewared(OtherHistoryWorker){}
assert_equal 1, actual['HistoryWorker'][:passed]
assert_equal nil, actual['HistoryWorker'][:failed]
assert_equal 1, actual['OtherHistoryWorker'][:passed]
assert_equal nil, actual['OtherHistoryWorker'][:failed]
end
it 'records queue statistic for each worker' do
message = { 'queue' => 'default' }
middlewared(HistoryWorker, message){}
message = { 'queue' => 'test' }
middlewared(HistoryWorkerWithQueue, message){}
assert_equal 'default', actual['HistoryWorker'][:queue]
assert_equal 'test', actual['HistoryWorkerWithQueue'][:queue]
end
end
end
end
| business-of-fashion/sidekiq-statistic | test/test_sidekiq/middleware_test.rb | Ruby | mit | 4,165 |
PHP with classes and PhpUnit | i-e-b/Skeletons | Php_Phpunit/README.md | Markdown | mit | 28 |
#include <QtGlobal>
// Automatically generated by extract_strings.py
#ifdef __GNUC__
#define UNUSED __attribute__((unused))
#else
#define UNUSED
#endif
static const char UNUSED *bitcoin_strings[] = {
QT_TRANSLATE_NOOP("bitcoin-core", ""
"%s, you must set a rpcpassword in the configuration file:\n"
"%s\n"
"It is recommended you use the following random password:\n"
"rpcuser=amkoinrpc\n"
"rpcpassword=%s\n"
"(you do not need to remember this password)\n"
"The username and password MUST NOT be the same.\n"
"If the file does not exist, create it with owner-readable-only file "
"permissions.\n"
"It is also recommended to set alertnotify so you are notified of problems;\n"
"for example: alertnotify=echo %%s | mail -s \"AmKoin Alert\" [email protected]\n"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:"
"@STRENGTH)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"An error occurred while setting up the RPC port %u for listening on IPv4: %s"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"An error occurred while setting up the RPC port %u for listening on IPv6, "
"falling back to IPv4: %s"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Bind to given address and always listen on it. Use [host]:port notation for "
"IPv6"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Cannot obtain a lock on data directory %s. AmKoin is probably already "
"running."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Enter regression test mode, which uses a special chain in which blocks can "
"be solved instantly. This is intended for regression testing tools and app "
"development."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Error: The transaction was rejected! This might happen if some of the coins "
"in your wallet were already spent, such as if you used a copy of wallet.dat "
"and coins were spent in the copy but not marked as spent here."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Error: This transaction requires a transaction fee of at least %s because of "
"its amount, complexity, or use of recently received funds!"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Execute command when a relevant alert is received (%s in cmd is replaced by "
"message)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Execute command when a wallet transaction changes (%s in cmd is replaced by "
"TxID)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Execute command when the best block changes (%s in cmd is replaced by block "
"hash)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Listen for JSON-RPC connections on <port> (default: 8332 or testnet: 18332)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Number of seconds to keep misbehaving peers from reconnecting (default: "
"86400)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Set maximum size of high-priority/low-fee transactions in bytes (default: "
"27000)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Set the number of script verification threads (up to 16, 0 = auto, <0 = "
"leave that many cores free, default: 0)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"This is a pre-release test build - use at your own risk - do not use for "
"mining or merchant applications"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Unable to bind to %s on this computer. AmKoin is probably already running."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: -paytxfee is set very high! This is the transaction fee you will "
"pay if you send a transaction."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: Displayed transactions may not be correct! You may need to upgrade, "
"or other nodes may need to upgrade."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: Please check that your computer's date and time are correct! If "
"your clock is wrong AmKoin will not work properly."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: error reading wallet.dat! All keys read correctly, but transaction "
"data or address book entries might be missing or incorrect."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as "
"wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect "
"you should restore from a backup."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"You must set rpcpassword=<password> in the configuration file:\n"
"%s\n"
"If the file does not exist, create it with owner-readable-only file "
"permissions."),
QT_TRANSLATE_NOOP("bitcoin-core", "Accept command line and JSON-RPC commands"),
QT_TRANSLATE_NOOP("bitcoin-core", "Accept connections from outside (default: 1 if no -proxy or -connect)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Add a node to connect to and attempt to keep the connection open"),
QT_TRANSLATE_NOOP("bitcoin-core", "Allow DNS lookups for -addnode, -seednode and -connect"),
QT_TRANSLATE_NOOP("bitcoin-core", "Allow JSON-RPC connections from specified IP address"),
QT_TRANSLATE_NOOP("bitcoin-core", "Attempt to recover private keys from a corrupt wallet.dat"),
QT_TRANSLATE_NOOP("bitcoin-core", "AmKoin version"),
QT_TRANSLATE_NOOP("bitcoin-core", "Block creation options:"),
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot downgrade wallet"),
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -bind address: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -externalip address: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot write default address"),
QT_TRANSLATE_NOOP("bitcoin-core", "Connect only to the specified node(s)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Connect through socks proxy"),
QT_TRANSLATE_NOOP("bitcoin-core", "Connect to a node to retrieve peer addresses, and disconnect"),
QT_TRANSLATE_NOOP("bitcoin-core", "Corrupted block database detected"),
QT_TRANSLATE_NOOP("bitcoin-core", "Discover own IP address (default: 1 when listening and no -externalip)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Do you want to rebuild the block database now?"),
QT_TRANSLATE_NOOP("bitcoin-core", "Done loading"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing block database"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing wallet database environment %s!"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading block database"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet corrupted"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet requires newer version of AmKoin"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error opening block database"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Disk space is low!"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Wallet locked, unable to create transaction!"),
QT_TRANSLATE_NOOP("bitcoin-core", "Error: system error: "),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to listen on any port. Use -listen=0 if you want this."),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to read block info"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to read block"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to sync block index"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write block index"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write block info"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write block"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write file info"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write to coin database"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write transaction index"),
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write undo data"),
QT_TRANSLATE_NOOP("bitcoin-core", "Fee per KB to add to transactions you send"),
QT_TRANSLATE_NOOP("bitcoin-core", "Find peers using DNS lookup (default: 1 unless -connect)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Generate coins (default: 0)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Get help for a command"),
QT_TRANSLATE_NOOP("bitcoin-core", "How many blocks to check at startup (default: 288, 0 = all)"),
QT_TRANSLATE_NOOP("bitcoin-core", "How thorough the block verification is (0-4, default: 3)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Imports blocks from external blk000??.dat file"),
QT_TRANSLATE_NOOP("bitcoin-core", "Incorrect or no genesis block found. Wrong datadir for network?"),
QT_TRANSLATE_NOOP("bitcoin-core", "Information"),
QT_TRANSLATE_NOOP("bitcoin-core", "Insufficient funds"),
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -proxy address: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -tor address: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -minrelaytxfee=<amount>: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -mintxfee=<amount>: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -paytxfee=<amount>: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount"),
QT_TRANSLATE_NOOP("bitcoin-core", "List commands"),
QT_TRANSLATE_NOOP("bitcoin-core", "Listen for connections on <port> (default: 8333 or testnet: 18333)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Loading addresses..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Loading block index..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Loading wallet..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Maintain a full transaction index (default: 0)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Maintain at most <n> connections to peers (default: 125)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Not enough file descriptors available."),
QT_TRANSLATE_NOOP("bitcoin-core", "Only accept block chain matching built-in checkpoints (default: 1)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Only connect to nodes in network <net> (IPv4, IPv6 or Tor)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Options:"),
QT_TRANSLATE_NOOP("bitcoin-core", "Output extra debugging information. Implies all other -debug* options"),
QT_TRANSLATE_NOOP("bitcoin-core", "Output extra network debugging information"),
QT_TRANSLATE_NOOP("bitcoin-core", "Password for JSON-RPC connections"),
QT_TRANSLATE_NOOP("bitcoin-core", "Prepend debug output with timestamp"),
QT_TRANSLATE_NOOP("bitcoin-core", "Rebuild block chain index from current blk000??.dat files"),
QT_TRANSLATE_NOOP("bitcoin-core", "Rescan the block chain for missing wallet transactions"),
QT_TRANSLATE_NOOP("bitcoin-core", "Rescanning..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Run in the background as a daemon and accept commands"),
QT_TRANSLATE_NOOP("bitcoin-core", "SSL options: (see the Bitcoin Wiki for SSL setup instructions)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Select the version of socks proxy to use (4-5, default: 5)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send command to -server or amkoind"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send commands to node running on <ip> (default: 127.0.0.1)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to console instead of debug.log file"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to debugger"),
QT_TRANSLATE_NOOP("bitcoin-core", "Server certificate file (default: server.cert)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Server private key (default: server.pem)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Set database cache size in megabytes (default: 25)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Set key pool size to <n> (default: 100)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Set maximum block size in bytes (default: 250000)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Set minimum block size in bytes (default: 0)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Set the number of threads to service RPC calls (default: 4)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Signing transaction failed"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify configuration file (default: amkoin.conf)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify connection timeout in milliseconds (default: 5000)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify data directory"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify pid file (default: amkoind.pid)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify your own public address"),
QT_TRANSLATE_NOOP("bitcoin-core", "System error: "),
QT_TRANSLATE_NOOP("bitcoin-core", "This help message"),
QT_TRANSLATE_NOOP("bitcoin-core", "Threshold for disconnecting misbehaving peers (default: 100)"),
QT_TRANSLATE_NOOP("bitcoin-core", "To use the %s option"),
QT_TRANSLATE_NOOP("bitcoin-core", "Transaction amount too small"),
QT_TRANSLATE_NOOP("bitcoin-core", "Transaction amounts must be positive"),
QT_TRANSLATE_NOOP("bitcoin-core", "Transaction too large"),
QT_TRANSLATE_NOOP("bitcoin-core", "Unable to bind to %s on this computer (bind returned error %d, %s)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Unknown -socks proxy version requested: %i"),
QT_TRANSLATE_NOOP("bitcoin-core", "Unknown network specified in -onlynet: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Upgrade wallet to latest format"),
QT_TRANSLATE_NOOP("bitcoin-core", "Usage:"),
QT_TRANSLATE_NOOP("bitcoin-core", "Use OpenSSL (https) for JSON-RPC connections"),
QT_TRANSLATE_NOOP("bitcoin-core", "Use UPnP to map the listening port (default: 0)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Use UPnP to map the listening port (default: 1 when listening)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Use proxy to reach tor hidden services (default: same as -proxy)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Use the test network"),
QT_TRANSLATE_NOOP("bitcoin-core", "Username for JSON-RPC connections"),
QT_TRANSLATE_NOOP("bitcoin-core", "Verifying blocks..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Verifying wallet..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Wallet needed to be rewritten: restart AmKoin to complete"),
QT_TRANSLATE_NOOP("bitcoin-core", "Warning"),
QT_TRANSLATE_NOOP("bitcoin-core", "Warning: This version is obsolete, upgrade required!"),
QT_TRANSLATE_NOOP("bitcoin-core", "You need to rebuild the database using -reindex to change -txindex"),
QT_TRANSLATE_NOOP("bitcoin-core", "wallet.dat corrupt, salvage failed"),
}; | bryceweiner/amkoin | src/qt/bitcoinstrings.cpp | C++ | mit | 13,902 |
<!doctype html>
<!--[if IE 9 ]><html class="ie9" lang="en"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html lang="en"><!--<![endif]-->
<head>
<title>Flatastic - Checkout</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!--meta info-->
<meta name="author" content="">
<meta name="keywords" content="">
<meta name="description" content="">
<link rel="icon" type="image/ico" href="images/fav.ico">
<!--stylesheet include-->
<link rel="stylesheet" type="text/css" media="all" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" media="all" href="css/owl.carousel.css">
<link rel="stylesheet" type="text/css" media="all" href="css/owl.transitions.css">
<link rel="stylesheet" type="text/css" media="all" href="css/style.css">
<!--font include-->
<link href="css/font-awesome.min.css" rel="stylesheet">
</head>
<body>
<!--wide layout-->
<div class="wide_layout relative">
<!--[if (lt IE 9) | IE 9]>
<div style="background:#fff;padding:8px 0 10px;">
<div class="container" style="width:1170px;"><div class="row wrapper"><div class="clearfix" style="padding:9px 0 0;float:left;width:83%;"><i class="fa fa-exclamation-triangle scheme_color f_left m_right_10" style="font-size:25px;color:#e74c3c;"></i><b style="color:#e74c3c;">Attention! This page may not display correctly.</b> <b>You are using an outdated version of Internet Explorer. For a faster, safer browsing experience.</b></div><div class="t_align_r" style="float:left;width:16%;"><a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode" class="button_type_4 r_corners bg_scheme_color color_light d_inline_b t_align_c" target="_blank" style="margin-bottom:2px;">Update Now!</a></div></div></div></div>
<![endif]-->
<!--markup header-->
<header role="banner">
<!--header top part-->
<section class="h_top_part">
<div class="container">
<div class="row clearfix">
<div class="col-lg-4 col-md-4 col-sm-5 t_xs_align_c">
<p class="f_size_small">Welcome visitor can you <a href="#" data-popup="#login_popup">Log In</a> or <a href="#">Create an Account</a> </p>
</div>
<div class="col-lg-4 col-md-4 col-sm-2 t_align_c t_xs_align_c">
<p class="f_size_small">Call us toll free: <b class="color_dark">(123) 456-7890</b></p>
</div>
<nav class="col-lg-4 col-md-4 col-sm-5 t_align_r t_xs_align_c">
<ul class="d_inline_b horizontal_list clearfix f_size_small users_nav">
<li><a href="#" class="default_t_color">My Account</a></li>
<li><a href="#" class="default_t_color">Orders List</a></li>
<li><a href="#" class="default_t_color">Wishlist</a></li>
<li><a href="#" class="default_t_color">Checkout</a></li>
</ul>
</nav>
</div>
</div>
</section>
<!--header bottom part-->
<section class="h_bot_part container">
<div class="clearfix row">
<div class="col-lg-6 col-md-6 col-sm-4 t_xs_align_c">
<a href="index.html" class="logo m_xs_bottom_15 d_xs_inline_b">
<img src="images/logo.png" alt="">
</a>
</div>
<div class="col-lg-6 col-md-6 col-sm-8 t_align_r t_xs_align_c">
<ul class="d_inline_b horizontal_list clearfix t_align_l site_settings">
<!--like-->
<li>
<a role="button" href="#" class="button_type_1 color_dark d_block bg_light_color_1 r_corners tr_delay_hover box_s_none"><i class="fa fa-heart-o f_size_ex_large"></i><span class="count circle t_align_c">12</span></a>
</li>
<li class="m_left_5">
<a role="button" href="#" class="button_type_1 color_dark d_block bg_light_color_1 r_corners tr_delay_hover box_s_none"><i class="fa fa-files-o f_size_ex_large"></i><span class="count circle t_align_c">3</span></a>
</li>
<!--language settings-->
<li class="m_left_5 relative container3d">
<a role="button" href="#" class="button_type_2 color_dark d_block bg_light_color_1 r_corners tr_delay_hover box_s_none" id="lang_button"><img class="d_inline_middle m_right_10 m_mxs_right_0" src="images/flag_en.jpg" alt=""><span class="d_mxs_none">English</span></a>
<ul class="dropdown_list top_arrow color_light">
<li><a href="#" class="tr_delay_hover color_light"><img class="d_inline_middle" src="images/flag_en.jpg" alt="">English</a></li>
<li><a href="#" class="tr_delay_hover color_light"><img class="d_inline_middle" src="images/flag_fr.jpg" alt="">French</a></li>
<li><a href="#" class="tr_delay_hover color_light"><img class="d_inline_middle" src="images/flag_g.jpg" alt="">German</a></li>
<li><a href="#" class="tr_delay_hover color_light"><img class="d_inline_middle" src="images/flag_i.jpg" alt="">Italian</a></li>
<li><a href="#" class="tr_delay_hover color_light"><img class="d_inline_middle" src="images/flag_s.jpg" alt="">Spanish</a></li>
</ul>
</li>
<!--currency settings-->
<li class="m_left_5 relative container3d">
<a role="button" href="#" class="button_type_2 color_dark d_block bg_light_color_1 r_corners tr_delay_hover box_s_none" id="currency_button"><span class="scheme_color">$</span> <span class="d_mxs_none">US Dollar</span></a>
<ul class="dropdown_list top_arrow color_light">
<li><a href="#" class="tr_delay_hover color_light"><span class="scheme_color">$</span> US Dollar</a></li>
<li><a href="#" class="tr_delay_hover color_light"><span class="scheme_color">€</span> Euro</a></li>
<li><a href="#" class="tr_delay_hover color_light"><span class="scheme_color">£</span> Pound</a></li>
</ul>
</li>
<!--shopping cart-->
<li class="m_left_5 relative container3d" id="shopping_button">
<a role="button" href="#" class="button_type_3 color_light bg_scheme_color d_block r_corners tr_delay_hover box_s_none">
<span class="d_inline_middle shop_icon m_mxs_right_0">
<i class="fa fa-shopping-cart"></i>
<span class="count tr_delay_hover type_2 circle t_align_c">3</span>
</span>
<b class="d_mxs_none">$355</b>
</a>
<div class="shopping_cart top_arrow tr_all_hover r_corners">
<div class="f_size_medium sc_header">Recently added item(s)</div>
<ul class="products_list">
<li>
<div class="clearfix">
<!--product image-->
<img class="f_left m_right_10" src="images/shopping_c_img_1.jpg" alt="">
<!--product description-->
<div class="f_left product_description">
<a href="#" class="color_dark m_bottom_5 d_block">Cursus eleifend elit aenean auctor wisi et urna</a>
<span class="f_size_medium">Product Code PS34</span>
</div>
<!--product price-->
<div class="f_left f_size_medium">
<div class="clearfix">
1 x <b class="color_dark">$99.00</b>
</div>
<button class="close_product color_dark tr_hover"><i class="fa fa-times"></i></button>
</div>
</div>
</li>
<li>
<div class="clearfix">
<!--product image-->
<img class="f_left m_right_10" src="images/shopping_c_img_2.jpg" alt="">
<!--product description-->
<div class="f_left product_description">
<a href="#" class="color_dark m_bottom_5 d_block">Cursus eleifend elit aenean auctor wisi et urna</a>
<span class="f_size_medium">Product Code PS34</span>
</div>
<!--product price-->
<div class="f_left f_size_medium">
<div class="clearfix">
1 x <b class="color_dark">$99.00</b>
</div>
<button class="close_product color_dark tr_hover"><i class="fa fa-times"></i></button>
</div>
</div>
</li>
<li>
<div class="clearfix">
<!--product image-->
<img class="f_left m_right_10" src="images/shopping_c_img_3.jpg" alt="">
<!--product description-->
<div class="f_left product_description">
<a href="#" class="color_dark m_bottom_5 d_block">Cursus eleifend elit aenean auctor wisi et urna</a>
<span class="f_size_medium">Product Code PS34</span>
</div>
<!--product price-->
<div class="f_left f_size_medium">
<div class="clearfix">
1 x <b class="color_dark">$99.00</b>
</div>
<button class="close_product color_dark tr_hover"><i class="fa fa-times"></i></button>
</div>
</div>
</li>
</ul>
<!--total price-->
<ul class="total_price bg_light_color_1 t_align_r color_dark">
<li class="m_bottom_10">Tax: <span class="f_size_large sc_price t_align_l d_inline_b m_left_15">$0.00</span></li>
<li class="m_bottom_10">Discount: <span class="f_size_large sc_price t_align_l d_inline_b m_left_15">$37.00</span></li>
<li>Total: <b class="f_size_large bold scheme_color sc_price t_align_l d_inline_b m_left_15">$999.00</b></li>
</ul>
<div class="sc_footer t_align_c">
<a href="#" role="button" class="button_type_4 d_inline_middle bg_light_color_2 r_corners color_dark t_align_c tr_all_hover m_mxs_bottom_5">View Cart</a>
<a href="#" role="button" class="button_type_4 bg_scheme_color d_inline_middle r_corners tr_all_hover color_light">Checkout</a>
</div>
</div>
</li>
</ul>
</div>
</div>
</section>
<!--main menu container-->
<section class="menu_wrap relative">
<div class="container clearfix">
<!--button for responsive menu-->
<button id="menu_button" class="r_corners centered_db d_none tr_all_hover d_xs_block m_bottom_10">
<span class="centered_db r_corners"></span>
<span class="centered_db r_corners"></span>
<span class="centered_db r_corners"></span>
</button>
<!--main menu-->
<nav role="navigation" class="f_left f_xs_none d_xs_none">
<ul class="horizontal_list main_menu clearfix">
<li class="relative f_xs_none m_xs_bottom_5"><a href="index.html" class="tr_delay_hover color_light tt_uppercase"><b>Home</b></a>
<!--sub menu-->
<div class="sub_menu_wrap top_arrow d_xs_none type_2 tr_all_hover clearfix r_corners">
<ul class="sub_menu">
<li><a class="color_dark tr_delay_hover" href="index.html">Home Variant 1</a></li>
<li><a class="color_dark tr_delay_hover" href="index_layout_2.html">Home Variant 2</a></li>
<li><a class="color_dark tr_delay_hover" href="index_layout_wide.html">Home Variant 3</a></li>
<li><a class="color_dark tr_delay_hover" href="index_corporate.html">Home Variant 4</a></li>
</ul>
</div>
</li>
<li class="relative f_xs_none m_xs_bottom_5"><a href="index_layout_wide.html" class="tr_delay_hover color_light tt_uppercase"><b>Sliders</b></a>
<!--sub menu-->
<div class="sub_menu_wrap top_arrow d_xs_none type_2 tr_all_hover clearfix r_corners">
<ul class="sub_menu">
<li><a class="color_dark tr_delay_hover" href="index_layout_wide.html">Revolution Slider</a></li>
<li><a class="color_dark tr_delay_hover" href="index.html">Camera Slider</a></li>
<li><a class="color_dark tr_delay_hover" href="index_layout_2.html">Flex Slider</a></li>
</ul>
</div>
</li>
<li class="relative f_xs_none m_xs_bottom_5"><a href="category_grid.html" class="tr_delay_hover color_light tt_uppercase"><b>Shop</b></a>
<!--sub menu-->
<div class="sub_menu_wrap top_arrow d_xs_none tr_all_hover clearfix r_corners w_xs_auto">
<div class="f_left f_xs_none">
<b class="color_dark m_left_20 m_bottom_5 m_top_5 d_inline_b">Dresses</b>
<ul class="sub_menu first">
<li><a class="color_dark tr_delay_hover" href="#">Evening Dresses</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Casual Dresses</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Party Dresses</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Maxi Dresses</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Midi Dresses</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Strapless Dresses</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Day Dresses</a></li>
</ul>
</div>
<div class="f_left m_left_10 m_xs_left_0 f_xs_none">
<b class="color_dark m_left_20 m_bottom_5 m_top_5 d_inline_b">Accessories</b>
<ul class="sub_menu">
<li><a class="color_dark tr_delay_hover" href="#">Bags and Purces</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Belts</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Scarves</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Gloves</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Jewellery</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Sunglasses</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Hair Accessories</a></li>
</ul>
</div>
<div class="f_left m_left_10 m_xs_left_0 f_xs_none">
<b class="color_dark m_left_20 m_bottom_5 m_top_5 d_inline_b">Tops</b>
<ul class="sub_menu">
<li><a class="color_dark tr_delay_hover" href="#">Evening Tops</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Long Sleeved</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Short Sleeved</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Sleeveless</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Tanks</a></li>
<li><a class="color_dark tr_delay_hover" href="#">Tunics</a></li>
</ul>
</div>
<img src="images/woman_image_1.jpg" class="d_sm_none f_right m_bottom_10" alt="">
</div>
</li>
<li class="relative f_xs_none m_xs_bottom_5"><a href="#" class="tr_delay_hover color_light tt_uppercase"><b>Portfolio</b></a>
<!--sub menu-->
<div class="sub_menu_wrap top_arrow d_xs_none type_2 tr_all_hover clearfix r_corners">
<ul class="sub_menu">
<li><a class="color_dark tr_delay_hover" href="portfolio_two_columns.html">Portfolio 2 Columns</a></li>
<li><a class="color_dark tr_delay_hover" href="portfolio_three_columns.html">Portfolio 3 Columns</a></li>
<li><a class="color_dark tr_delay_hover" href="portfolio_four_columns.html">Portfolio 4 Columns</a></li>
<li><a class="color_dark tr_delay_hover" href="portfolio_masonry.html">Masonry Portfolio</a></li>
<li><a class="color_dark tr_delay_hover" href="portfolio_single_1.html">Single Portfolio Post v1</a></li>
<li><a class="color_dark tr_delay_hover" href="portfolio_single_2.html">Single Portfolio Post v2</a></li>
</ul>
</div>
</li>
<li class="relative current f_xs_none m_xs_bottom_5"><a href="category_grid.html" class="tr_delay_hover color_light tt_uppercase"><b>Pages</b></a>
<!--sub menu-->
<div class="sub_menu_wrap top_arrow d_xs_none type_2 tr_all_hover clearfix r_corners">
<ul class="sub_menu">
<li><a class="color_dark tr_delay_hover" href="category_grid.html">Grid View Category Page</a></li>
<li><a class="color_dark tr_delay_hover" href="category_list.html">List View Category Page</a></li>
<li><a class="color_dark tr_delay_hover" href="category_no_products.html">Category Page Without Products</a></li>
<li><a class="color_dark tr_delay_hover" href="product_page_sidebar.html">Product Page With Sidebar</a></li>
<li><a class="color_dark tr_delay_hover" href="full_width_product_page.html">Full Width Product Page</a></li>
<li><a class="color_dark tr_delay_hover" href="wishlist.html">Wishlist</a></li>
<li><a class="color_dark tr_delay_hover" href="compare_products.html">Compare Products</a></li>
<li><a class="color_dark tr_delay_hover" href="checkout.html">Checkout</a></li>
<li><a class="color_dark tr_delay_hover" href="manufacturers.html">Manufacturers</a></li>
<li><a class="color_dark tr_delay_hover" href="manufacturer_details.html">Manufacturer Page</a></li>
<li><a class="color_dark tr_delay_hover" href="orders_list.html">Orders List</a></li>
<li><a class="color_dark tr_delay_hover" href="order_details.html">Order Details</a></li>
</ul>
</div>
</li>
<li class="relative f_xs_none m_xs_bottom_5"><a href="blog.html" class="tr_delay_hover color_light tt_uppercase"><b>Blog</b></a>
<!--sub menu-->
<div class="sub_menu_wrap top_arrow d_xs_none type_2 tr_all_hover clearfix r_corners">
<ul class="sub_menu">
<li><a class="color_dark tr_delay_hover" href="blog.html">Blog page</a></li>
<li><a class="color_dark tr_delay_hover" href="blog_post.html">Single Blog Post page</a></li>
</ul>
</div>
</li>
<li class="relative f_xs_none m_xs_bottom_5"><a href="features_shortcodes.html" class="tr_delay_hover color_light tt_uppercase"><b>Features</b></a>
<!--sub menu-->
<div class="sub_menu_wrap top_arrow d_xs_none type_2 tr_all_hover clearfix r_corners">
<ul class="sub_menu">
<li><a class="color_dark tr_delay_hover" href="features_shortcodes.html">Shortcodes</a></li>
<li><a class="color_dark tr_delay_hover" href="features_typography.html">Typography</a></li>
</ul>
</div>
</li>
<li class="relative f_xs_none m_xs_bottom_5"><a href="contact.html" class="tr_delay_hover color_light tt_uppercase"><b>Contact</b></a></li>
</ul>
</nav>
<button class="f_right search_button tr_all_hover f_xs_none d_xs_none">
<i class="fa fa-search"></i>
</button>
</div>
<!--search form-->
<div class="searchform_wrap tf_xs_none tr_all_hover">
<div class="container vc_child h_inherit relative">
<form role="search" class="d_inline_middle full_width">
<input type="text" name="search" placeholder="Type text and hit enter" class="f_size_large">
</form>
<button class="close_search_form tr_all_hover d_xs_none color_dark">
<i class="fa fa-times"></i>
</button>
</div>
</div>
</section>
</header>
<!--breadcrumbs-->
<section class="breadcrumbs">
<div class="container">
<ul class="horizontal_list clearfix bc_list f_size_medium">
<li class="m_right_10 current"><a href="#" class="default_t_color">Home<i class="fa fa-angle-right d_inline_middle m_left_10"></i></a></li>
<li class="m_right_10 current"><a href="#" class="default_t_color">Checkout<i class="fa fa-angle-right d_inline_middle m_left_10"></i></a></li>
<li><a href="#" class="default_t_color">Shopping Cart</a></li>
</ul>
</div>
</section>
<!--content-->
<div class="page_content_offset">
<div class="container">
<div class="row clearfix">
<!--left content column-->
<section class="col-lg-9 col-md-9 col-sm-9 m_xs_bottom_30">
<h2 class="tt_uppercase color_dark m_bottom_25">Cart</h2>
<!--cart table-->
<table class="table_type_4 responsive_table full_width r_corners wraper shadow t_align_l t_xs_align_c m_bottom_30">
<thead>
<tr class="f_size_large">
<!--titles for td-->
<th>Product Image & Name</th>
<th>SKU</th>
<th>Price</th>
<th>Quantity</th>
<th>Subtotal</th>
</tr>
</thead>
<tbody>
<tr>
<!--Product name and image-->
<td data-title="Product Image & name" class="t_md_align_c">
<img src="images/quick_view_img_10.jpg" alt="" class="m_md_bottom_5 d_xs_block d_xs_centered">
<a href="#" class="d_inline_b m_left_5 color_dark">Eget elementum vel</a>
</td>
<!--product key-->
<td data-title="SKU">PS01</td>
<!--product price-->
<td data-title="Price">
<s>$102.00</s>
<p class="f_size_large color_dark">$102.00</p>
</td>
<!--quanity-->
<td data-title="Quantity">
<div class="clearfix quantity r_corners d_inline_middle f_size_medium color_dark m_bottom_10">
<button class="bg_tr d_block f_left" data-direction="down">-</button>
<input type="text" name="" readonly value="1" class="f_left">
<button class="bg_tr d_block f_left" data-direction="up">+</button>
</div>
<div>
<a href="#" class="color_dark"><i class="fa fa-check f_size_medium m_right_5"></i>Update</a><br>
<a href="#" class="color_dark"><i class="fa fa-times f_size_medium m_right_5"></i>Remove</a><br>
</div>
</td>
<!--subtotal-->
<td data-title="Subtotal">
<p class="f_size_large fw_medium scheme_color">$102.00</p>
</td>
</tr>
<tr>
<!--Product name and image-->
<td data-title="Product Image & name" class="t_md_align_c">
<img src="images/wishlist_img_1.jpg" alt="" class="m_md_bottom_5 d_xs_block d_xs_centered">
<a href="#" class="d_inline_b m_left_5 color_dark">Aenean nec eros</a>
</td>
<!--product key-->
<td data-title="SKU">PS02</td>
<!--product price-->
<td data-title="Price">
<p class="f_size_large color_dark">$52.00</p>
</td>
<!--quanity-->
<td data-title="Quantity">
<div class="clearfix quantity r_corners d_inline_middle f_size_medium color_dark m_bottom_10">
<button class="bg_tr d_block f_left" data-direction="down">-</button>
<input type="text" name="" readonly value="1" class="f_left">
<button class="bg_tr d_block f_left" data-direction="up">+</button>
</div>
<div>
<a href="#" class="color_dark"><i class="fa fa-check f_size_medium m_right_5"></i>Update</a><br>
<a href="#" class="color_dark"><i class="fa fa-times f_size_medium m_right_5"></i>Remove</a><br>
</div>
</td>
<!--subtotal-->
<td data-title="Subtotal">
<p class="f_size_large fw_medium scheme_color">$52.00</p>
</td>
</tr>
<tr>
<!--Product name and image-->
<td data-title="Product Image & name" class="t_md_align_c">
<img src="images/wishlist_img_2.jpg" alt="" class="m_md_bottom_5 d_xs_block d_xs_centered">
<a href="#" class="d_inline_b m_left_5 color_dark">Ut tellus dolor dapibus</a>
</td>
<!--product key-->
<td data-title="SKU">PS03</td>
<!--product price-->
<td data-title="Price">
<p class="f_size_large color_dark">$360.00</p>
</td>
<!--quanity-->
<td data-title="Quantity">
<div class="clearfix quantity r_corners d_inline_middle f_size_medium color_dark m_bottom_10">
<button class="bg_tr d_block f_left" data-direction="down">-</button>
<input type="text" name="" readonly value="1" class="f_left">
<button class="bg_tr d_block f_left" data-direction="up">+</button>
</div>
<div>
<a href="#" class="color_dark"><i class="fa fa-check f_size_medium m_right_5"></i>Update</a><br>
<a href="#" class="color_dark"><i class="fa fa-times f_size_medium m_right_5"></i>Remove</a><br>
</div>
</td>
<!--subtotal-->
<td data-title="Subtotal">
<p class="f_size_large fw_medium scheme_color">$360.00</p>
</td>
</tr>
<!--prices-->
<tr>
<td colspan="4">
<p class="fw_medium f_size_large t_align_r t_xs_align_c">Coupon Discount:</p>
</td>
<td colspan="1">
<p class="fw_medium f_size_large color_dark">$-74.96</p>
</td>
</tr>
<tr>
<td colspan="4">
<p class="fw_medium f_size_large t_align_r t_xs_align_c">Subtotal:</p>
</td>
<td colspan="1">
<p class="fw_medium f_size_large color_dark">$95.00</p>
</td>
</tr>
<tr>
<td colspan="4">
<p class="fw_medium f_size_large t_align_r t_xs_align_c">Payment Fee:</p>
</td>
<td colspan="1">
<p class="fw_medium f_size_large color_dark">$6.05</p>
</td>
</tr>
<tr>
<td colspan="4">
<p class="fw_medium f_size_large t_align_r t_xs_align_c">Shipment Fee:</p>
</td>
<td colspan="1">
<p class="fw_medium f_size_large color_dark">$0.00</p>
</td>
</tr>
<tr>
<td colspan="4">
<p class="fw_medium f_size_large t_align_r t_xs_align_c">Tax Total:</p>
</td>
<td colspan="1">
<p class="fw_medium f_size_large color_dark">$17.54</p>
</td>
</tr>
<!--total-->
<tr>
<td colspan="4" class="v_align_m d_ib_offset_large t_xs_align_l">
<!--coupon-->
<form class="d_ib_offset_0 d_inline_middle half_column d_xs_block w_xs_full m_xs_bottom_5">
<input type="text" placeholder="Enter your coupon code" name="" class="r_corners f_size_medium">
<button class="button_type_4 r_corners bg_light_color_2 m_left_5 mw_0 tr_all_hover color_dark">Save</button>
</form>
<p class="fw_medium f_size_large t_align_r scheme_color p_xs_hr_0 d_inline_middle half_column d_ib_offset_normal d_xs_block w_xs_full t_xs_align_c">Total:</p>
</td>
<td colspan="1" class="v_align_m">
<p class="fw_medium f_size_large scheme_color m_xs_bottom_10">$101.05</p>
</td>
</tr>
</tbody>
</table>
<!--tabs-->
<div class="tabs m_bottom_45">
<!--tabs navigation-->
<nav>
<ul class="tabs_nav horizontal_list clearfix">
<li><a href="#tab-1" class="bg_light_color_1 color_dark tr_delay_hover r_corners d_block">Login</a></li>
<li><a href="#tab-2" class="bg_light_color_1 color_dark tr_delay_hover r_corners d_block">Register</a></li>
</ul>
</nav>
<section class="tabs_content shadow r_corners">
<div id="tab-1">
<!--login form-->
<h5 class="fw_medium m_bottom_15">I am Already Registered</h5>
<form>
<ul>
<li class="clearfix m_bottom_15">
<div class="half_column type_2 f_left">
<label for="username" class="m_bottom_5 d_inline_b">Username</label>
<input type="text" id="username" name="" class="r_corners full_width m_bottom_5">
<a href="#" class="color_dark f_size_medium">Forgot your username?</a>
</div>
<div class="half_column type_2 f_left">
<label for="pass" class="m_bottom_5 d_inline_b">Password</label>
<input type="password" id="pass" name="" class="r_corners full_width m_bottom_5">
<a href="#" class="color_dark f_size_medium">Forgot your password?</a>
</div>
</li>
<li class="m_bottom_15">
<input type="checkbox" class="d_none" name="checkbox_4" id="checkbox_4"><label for="checkbox_4">Remember me</label>
</li>
<li><button class="button_type_4 r_corners bg_scheme_color color_light tr_all_hover">Log In</button></li>
</ul>
</form>
</div>
<div id="tab-2">
<form>
<ul>
<li class="m_bottom_25">
<label for="d_name" class="d_inline_b m_bottom_5 required">Displayed Name</label>
<input type="text" id="d_name" name="" class="r_corners full_width">
</li>
<li class="m_bottom_5">
<input type="checkbox" class="d_none" name="checkbox_5" id="checkbox_5"><label for="checkbox_5">Create an account</label>
</li>
<li class="m_bottom_15">
<label for="u_name" class="d_inline_b m_bottom_5 required">Username</label>
<input type="text" id="u_name" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="u_email" class="d_inline_b m_bottom_5 required">Email</label>
<input type="email" id="u_email" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="u_pass" class="d_inline_b m_bottom_5 required">Password</label>
<input type="password" id="u_pass" name="" class="r_corners full_width">
</li>
<li>
<label for="u_repeat_pass" class="d_inline_b m_bottom_5 required">Confirm Password</label>
<input type="password" id="u_repeat_pass" name="" class="r_corners full_width">
</li>
</ul>
</form>
</div>
</section>
</div>
<h2 class="color_dark tt_uppercase m_bottom_25">Bill To & Shipment Information</h2>
<div class="bs_inner_offsets bg_light_color_3 shadow r_corners m_bottom_45">
<div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 m_xs_bottom_30">
<h5 class="fw_medium m_bottom_15">Bill To</h5>
<form>
<ul>
<li class="m_bottom_15">
<label for="c_name_1" class="d_inline_b m_bottom_5">Company Name</label>
<input type="text" id="c_name_1" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label class="d_inline_b m_bottom_5">Title</label>
<!--product name select-->
<div class="custom_select relative">
<div class="select_title type_2 r_corners relative color_dark mw_0">Mr</div>
<ul class="select_list d_none"></ul>
<select name="product_name">
<option value="Mr 1">Mr 1</option>
<option value="Ms">Ms</option>
</select>
</div>
</li>
<li class="m_bottom_15">
<label for="f_name_1" class="d_inline_b m_bottom_5 required">First Name</label>
<input type="text" id="f_name_1" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="m_name_1" class="d_inline_b m_bottom_5 required">Middle Name</label>
<input type="text" id="m_name_1" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="l_name_1" class="d_inline_b m_bottom_5 required">Last Name</label>
<input type="text" id="l_name_1" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="address_1" class="d_inline_b m_bottom_5 required">Address 1</label>
<input type="text" id="address_1" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="address_1_1" class="d_inline_b m_bottom_5 required">Address 2</label>
<input type="text" id="address_1_1" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="code_1" class="d_inline_b m_bottom_5 required">Zip / Postal Code</label>
<input type="text" id="code_1" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="city_1" class="d_inline_b m_bottom_5 required">City</label>
<input type="text" id="city_1" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label class="d_inline_b m_bottom_5 required">Country</label>
<!--product name select-->
<div class="custom_select relative">
<div class="select_title type_2 r_corners relative color_dark mw_0">Please select</div>
<ul class="select_list d_none"></ul>
<select name="product_name">
<option value="England">England</option>
<option value="Australia">Australia</option>
<option value="Austria">Austria</option>
</select>
</div>
</li>
<li class="m_bottom_15">
<label class="d_inline_b m_bottom_5 required">State / Province / Region</label>
<!--product name select-->
<div class="custom_select relative">
<div class="select_title type_2 r_corners relative color_dark mw_0">Please select</div>
<ul class="select_list d_none"></ul>
<select name="product_name">
<option value="1">1</option>
<option value="2">2</option>
</select>
</div>
</li>
<li class="m_bottom_15">
<label for="phone_1" class="d_inline_b m_bottom_5">Phone</label>
<input type="text" id="phone_1" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="m_phone_1" class="d_inline_b m_bottom_5">Mobile Phone</label>
<input type="text" id="m_phone_1" name="" class="r_corners full_width">
</li>
<li>
<label for="fax_1" class="d_inline_b m_bottom_5">Fax</label>
<input type="text" id="fax_1" name="" class="r_corners full_width">
</li>
</ul>
</form>
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<h5 class="fw_medium m_bottom_15">Ship To</h5>
<form>
<ul>
<li class="m_bottom_5">
<input type="checkbox" checked class="d_none" name="checkbox_6" id="checkbox_6"><label for="checkbox_6">Add/Edit shipment address</label>
</li>
<li class="m_bottom_15">
<label for="a_name_1" class="d_inline_b m_bottom_5">Address Nickname</label>
<input type="text" id="a_name_1" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="c_name_2" class="d_inline_b m_bottom_5">Company Name</label>
<input type="text" id="c_name_2" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="f_name_2" class="d_inline_b m_bottom_5">First Name</label>
<input type="text" id="f_name_2" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="m_name_2" class="d_inline_b m_bottom_5">Middle Name</label>
<input type="text" id="m_name_2" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="l_name_2" class="d_inline_b m_bottom_5">Last Name</label>
<input type="text" id="l_name_2" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="address_2" class="d_inline_b m_bottom_5">Address 1</label>
<input type="text" id="address_2" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="address_1_2" class="d_inline_b m_bottom_5">Address 2</label>
<input type="text" id="address_1_2" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="code_2" class="d_inline_b m_bottom_5">Zip / Postal Code</label>
<input type="text" id="code_2" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="city_2" class="d_inline_b m_bottom_5">City</label>
<input type="text" id="city_2" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label class="d_inline_b m_bottom_5">Country</label>
<!--product name select-->
<div class="custom_select relative">
<div class="select_title type_2 r_corners relative color_dark mw_0">Please select</div>
<ul class="select_list d_none"></ul>
<select name="product_name">
<option value="England">England</option>
<option value="Australia">Australia</option>
<option value="Austria">Austria</option>
</select>
</div>
</li>
<li class="m_bottom_15">
<label class="d_inline_b m_bottom_5">State / Province / Region</label>
<!--product name select-->
<div class="custom_select relative">
<div class="select_title type_2 r_corners relative color_dark mw_0">Please select</div>
<ul class="select_list d_none"></ul>
<select name="product_name">
<option value="1">1</option>
<option value="2">2</option>
</select>
</div>
</li>
<li class="m_bottom_15">
<label for="phone_2" class="d_inline_b m_bottom_5">Phone</label>
<input type="text" id="phone_2" name="" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<label for="m_phone_2" class="d_inline_b m_bottom_5">Mobile Phone</label>
<input type="text" id="m_phone_2" name="" class="r_corners full_width">
</li>
<li>
<label for="fax_2" class="d_inline_b m_bottom_5">Fax</label>
<input type="text" id="fax_2" name="" class="r_corners full_width">
</li>
</ul>
</form>
</div>
</div>
</div>
<h2 class="tt_uppercase color_dark m_bottom_30">Shipment Information</h2>
<div class="bs_inner_offsets bg_light_color_3 shadow r_corners m_bottom_45">
<figure class="block_select clearfix relative m_bottom_15">
<input type="radio" checked name="radio_1" class="d_none">
<img src="images/shipment_logo.jpg" alt="" class="f_left m_right_20 f_mxs_none m_mxs_bottom_10">
<figcaption>
<h5 class="color_dark fw_medium m_bottom_15 m_sm_bottom_5">Shipment Method 1</h5>
<p>Ut tellus dolor, dapibus eget, elementum vel, cursus eleifend, elit. Aenean auctor wisi et urna. Aliquam erat volutpat. Duis ac turpis. Donec sit amet eros. Lorem ipsum dolor sit amet, consecvtetuer. </p>
</figcaption>
</figure>
<hr class="m_bottom_20">
<figure class="block_select clearfix relative">
<input type="radio" name="radio_1" class="d_none">
<img src="images/shipment_logo.jpg" alt="" class="f_left m_right_20 f_mxs_none m_mxs_bottom_10">
<figcaption>
<h5 class="color_dark fw_medium m_bottom_15 m_sm_bottom_5">Shipment Method 2</h5>
<p>Ut tellus dolor, dapibus eget, elementum vel, cursus eleifend, elit. Aenean auctor wisi et urna. Aliquam erat volutpat. Duis ac turpis. Donec sit amet eros.</p>
</figcaption>
</figure>
</div>
<h2 class="tt_uppercase color_dark m_bottom_30">Payment</h2>
<div class="bs_inner_offsets bg_light_color_3 shadow r_corners m_bottom_45">
<figure class="block_select clearfix relative m_bottom_15">
<input type="radio" checked name="radio_2" class="d_none">
<img src="images/payment_logo.jpg" alt="" class="f_left m_right_20 f_mxs_none m_mxs_bottom_10">
<figcaption class="d_table d_sm_block">
<div class="d_table_cell d_sm_block p_sm_right_0 p_right_45 m_mxs_bottom_5">
<h5 class="color_dark fw_medium m_bottom_15 m_sm_bottom_5">Payment Method 1</h5>
<p>Ut tellus dolor, dapibus eget, elementum vel, cursus eleifend, elit. Aenean auctor wisi et urna. Aliquam erat volutpat. Duis ac turp. Donec sit amet eros. </p>
</div>
<div class="d_table_cell d_sm_block discount">
<h5 class="color_dark fw_medium m_bottom_15 m_sm_bottom_0">Discount/Fee</h5>
<p class="color_dark">$8.48</p>
</div>
</figcaption>
</figure>
<hr class="m_bottom_20">
<figure class="block_select clearfix relative">
<input type="radio" name="radio_2" class="d_none">
<img src="images/payment_logo.jpg" alt="" class="f_left m_right_20 f_mxs_none m_mxs_bottom_10">
<figcaption>
<h5 class="color_dark fw_medium m_bottom_15 m_sm_bottom_5">Payment Method 2</h5>
<p>Lorem ipsum dolor sit amet, consecvtetuer adipiscing elit. Mauris fermentum dictum magna.
Sed laoreet aliquam leo. Ut tellus dolor, dapibus eget, elementum vel, cursus eleifend, elit.</p>
</figcaption>
</figure>
</div>
<h2 class="tt_uppercase color_dark m_bottom_30">Terms of service</h2>
<div class="bs_inner_offsets bg_light_color_3 shadow r_corners m_bottom_45">
<p class="m_bottom_10">Ut tellus dolor, dapibus eget, elementum vel, cursus eleifend, elit. Aenean auctor wisi et urna. Aliquam erat volutpat. Duis ac turpis. Donec sit amet eros. Lorem ipsum dolor sit amet, consecvtetuer adipiscing elit. Mauris fermentum dictum magna. Sed laoreet aliquam leo. Ut tellus dolor, dapibus eget, elementum vel, cursus eleifend, elit. Aenean auctor wisi et urna. Aliquam erat volutpat. Duis ac turpis. Integer rutrum ante eu lacus.Vestibulum libero nisl, porta vel, scelerisque eget, malesuada at, neque. </p>
<p>Vivamus eget nibh. Etiam cursus leo vel metus. Nulla facilisi. Aenean nec eros. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse sollicitudin velit sed leo. Ut pharetra augue nec augue. Nam elit agna,endrerit sit amet, tincidunt ac, viverra sed, nulla. Donec porta diam eu massa. Quisque diam lorem, interdum vitae,dapibus ac, scelerisque vitae, pede. Donec eget tellus non erat lacinia fermentum. Donec in velit vel ipsum auctor pulvinar. </p>
</div>
<h2 class="tt_uppercase color_dark m_bottom_30">Notes and special requests</h2>
<!--requests table-->
<table class="table_type_5 full_width r_corners wraper shadow t_align_l">
<tr>
<td colspan="2">
<label for="notes" class="d_inline_b m_bottom_5">Notes and special requests:</label>
<textarea id="notes" class="r_corners notes full_width"></textarea>
</td>
</tr>
<tr>
<td class="t_align_r">
<p class="f_size_large fw_medium">Coupon Discount:</p>
</td>
<td>
<p class="f_size_large fw_medium color_dark">$-74.96</p>
</td>
</tr>
<tr>
<td class="t_align_r">
<p class="f_size_large fw_medium">Subtotal:</p>
</td>
<td>
<p class="f_size_large fw_medium color_dark">$95.00</p>
</td>
</tr>
<tr>
<td class="t_align_r">
<p class="f_size_large fw_medium">Payment Fee:</p>
</td>
<td>
<p class="f_size_large fw_medium color_dark">$6.05</p>
</td>
</tr>
<tr>
<td class="t_align_r">
<p class="f_size_large fw_medium">Shipment Fee:</p>
</td>
<td>
<p class="f_size_large fw_medium color_dark">$0.00</p>
</td>
</tr>
<tr>
<td class="t_align_r">
<p class="f_size_large fw_medium">Tax Total:</p>
</td>
<td>
<p class="f_size_large fw_medium color_dark">$17.54</p>
</td>
</tr>
<tr>
<td class="t_align_r">
<p class="f_size_large fw_medium scheme_color">Total:</p>
</td>
<td>
<p class="f_size_large fw_medium scheme_color">$101.05</p>
</td>
</tr>
<tr>
<td colspan="2">
<input type="checkbox" name="checkbox_8" id="checkbox_8" class="d_none"><label for="checkbox_8">I agree to the Terms of Service (Terms of service)</label>
</td>
</tr>
<tr>
<td colspan="2">
<button class="button_type_6 bg_scheme_color f_size_large r_corners tr_all_hover color_light m_bottom_20">Confirm Purchase</button>
</td>
</tr>
</table>
</section>
<!--right column-->
<aside class="col-lg-3 col-md-3 col-sm-3">
<!--widgets-->
<figure class="widget shadow r_corners wrapper m_bottom_30">
<figcaption>
<h3 class="color_light">Categories</h3>
</figcaption>
<div class="widget_content">
<!--Categories list-->
<ul class="categories_list">
<li class="active">
<a href="#" class="f_size_large scheme_color d_block relative">
<b>Women</b>
<span class="bg_light_color_1 r_corners f_right color_dark talign_c"></span>
</a>
<!--second level-->
<ul>
<li class="active">
<a href="#" class="d_block f_size_large color_dark relative">
Dresses<span class="bg_light_color_1 r_corners f_right color_dark talign_c"></span>
</a>
<!--third level-->
<ul>
<li><a href="#" class="color_dark d_block">Evening Dresses</a></li>
<li><a href="#" class="color_dark d_block">Casual Dresses</a></li>
<li><a href="#" class="color_dark d_block">Party Dresses</a></li>
</ul>
</li>
<li>
<a href="#" class="d_block f_size_large color_dark relative">
Accessories<span class="bg_light_color_1 r_corners f_right color_dark talign_c"></span>
</a>
</li>
<li>
<a href="#" class="d_block f_size_large color_dark relative">
Tops<span class="bg_light_color_1 r_corners f_right color_dark talign_c"></span>
</a>
</li>
</ul>
</li>
<li>
<a href="#" class="f_size_large color_dark d_block relative">
<b>Men</b>
<span class="bg_light_color_1 r_corners f_right color_dark talign_c"></span>
</a>
<!--second level-->
<ul class="d_none">
<li>
<a href="#" class="d_block f_size_large color_dark relative">
Shorts<span class="bg_light_color_1 r_corners f_right color_dark talign_c"></span>
</a>
<!--third level-->
<ul class="d_none">
<li><a href="#" class="color_dark d_block">Evening</a></li>
<li><a href="#" class="color_dark d_block">Casual</a></li>
<li><a href="#" class="color_dark d_block">Party</a></li>
</ul>
</li>
</ul>
</li>
<li>
<a href="#" class="f_size_large color_dark d_block relative">
<b>Kids</b>
<span class="bg_light_color_1 r_corners f_right color_dark talign_c"></span>
</a>
</li>
</ul>
</div>
</figure>
<!--compare products-->
<figure class="widget shadow r_corners wrapper m_bottom_30">
<figcaption>
<h3 class="color_light">Compare Products</h3>
</figcaption>
<div class="widget_content">
<div class="clearfix m_bottom_15 relative cw_product">
<img src="images/bestsellers_img_1.jpg" alt="" class="f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0">
<a href="#" class="color_dark d_block bt_link">Ut tellus dolor dapibus</a>
<button type="button" class="f_size_medium f_right color_dark bg_tr tr_all_hover close_fieldset"><i class="fa fa-times lh_inherit"></i></button>
</div>
<hr class="m_bottom_15">
<div class="clearfix m_bottom_25 relative cw_product">
<img src="images/bestsellers_img_2.jpg" alt="" class="f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0">
<a href="#" class="color_dark d_block bt_link">Elemenum vel</a>
<button type="button" class="f_size_medium f_right color_dark bg_tr tr_all_hover close_fieldset"><i class="fa fa-times lh_inherit"></i></button>
</div>
<a href="#" class="color_dark"><i class="fa fa-files-o m_right_10"></i>Go to Compare</a>
</div>
</figure>
<!--wishlist-->
<figure class="widget shadow r_corners wrapper m_bottom_30">
<figcaption>
<h3 class="color_light">Wishlist</h3>
</figcaption>
<div class="widget_content">
<div class="clearfix m_bottom_15 relative cw_product">
<img src="images/bestsellers_img_1.jpg" alt="" class="f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0">
<a href="#" class="color_dark d_block bt_link">Ut tellus dolor dapibus</a>
<button type="button" class="f_size_medium f_right color_dark bg_tr tr_all_hover close_fieldset"><i class="fa fa-times lh_inherit"></i></button>
</div>
<hr class="m_bottom_15">
<div class="clearfix m_bottom_25 relative cw_product">
<img src="images/bestsellers_img_2.jpg" alt="" class="f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0">
<a href="#" class="color_dark d_block bt_link">Elemenum vel</a>
<button type="button" class="f_size_medium f_right color_dark bg_tr tr_all_hover close_fieldset"><i class="fa fa-times lh_inherit"></i></button>
</div>
<a href="#" class="color_dark"><i class="fa fa-heart-o m_right_10"></i>Go to Wishlist</a>
</div>
</figure>
<!--banner-->
<a href="#" class="d_block r_corners m_bottom_30">
<img src="images/banner_img_6.jpg" alt="">
</a>
<!--Bestsellers-->
<figure class="widget shadow r_corners wrapper m_bottom_30">
<figcaption>
<h3 class="color_light">Bestsellers</h3>
</figcaption>
<div class="widget_content">
<div class="clearfix m_bottom_15">
<img src="images/bestsellers_img_1.jpg" alt="" class="f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0">
<a href="#" class="color_dark d_block bt_link">Ut dolor dapibus</a>
<!--rating-->
<ul class="horizontal_list clearfix d_inline_b rating_list type_2 tr_all_hover m_bottom_10">
<li class="active">
<i class="fa fa-star-o empty tr_all_hover"></i>
<i class="fa fa-star active tr_all_hover"></i>
</li>
<li class="active">
<i class="fa fa-star-o empty tr_all_hover"></i>
<i class="fa fa-star active tr_all_hover"></i>
</li>
<li class="active">
<i class="fa fa-star-o empty tr_all_hover"></i>
<i class="fa fa-star active tr_all_hover"></i>
</li>
<li class="active">
<i class="fa fa-star-o empty tr_all_hover"></i>
<i class="fa fa-star active tr_all_hover"></i>
</li>
<li>
<i class="fa fa-star-o empty tr_all_hover"></i>
<i class="fa fa-star active tr_all_hover"></i>
</li>
</ul>
<p class="scheme_color">$61.00</p>
</div>
<hr class="m_bottom_15">
<div class="clearfix m_bottom_15">
<img src="images/bestsellers_img_2.jpg" alt="" class="f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0">
<a href="#" class="color_dark d_block bt_link">Elementum vel</a>
<!--rating-->
<ul class="horizontal_list clearfix d_inline_b rating_list type_2 tr_all_hover m_bottom_10">
<li class="active">
<i class="fa fa-star-o empty tr_all_hover"></i>
<i class="fa fa-star active tr_all_hover"></i>
</li>
<li class="active">
<i class="fa fa-star-o empty tr_all_hover"></i>
<i class="fa fa-star active tr_all_hover"></i>
</li>
<li class="active">
<i class="fa fa-star-o empty tr_all_hover"></i>
<i class="fa fa-star active tr_all_hover"></i>
</li>
<li class="active">
<i class="fa fa-star-o empty tr_all_hover"></i>
<i class="fa fa-star active tr_all_hover"></i>
</li>
<li>
<i class="fa fa-star-o empty tr_all_hover"></i>
<i class="fa fa-star active tr_all_hover"></i>
</li>
</ul>
<p class="scheme_color">$57.00</p>
</div>
<hr class="m_bottom_15">
<div class="clearfix m_bottom_5">
<img src="images/bestsellers_img_3.jpg" alt="" class="f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0">
<a href="#" class="color_dark d_block bt_link">Crsus eleifend elit</a>
<!--rating-->
<ul class="horizontal_list clearfix d_inline_b rating_list type_2 tr_all_hover m_bottom_10">
<li class="active">
<i class="fa fa-star-o empty tr_all_hover"></i>
<i class="fa fa-star active tr_all_hover"></i>
</li>
<li class="active">
<i class="fa fa-star-o empty tr_all_hover"></i>
<i class="fa fa-star active tr_all_hover"></i>
</li>
<li class="active">
<i class="fa fa-star-o empty tr_all_hover"></i>
<i class="fa fa-star active tr_all_hover"></i>
</li>
<li class="active">
<i class="fa fa-star-o empty tr_all_hover"></i>
<i class="fa fa-star active tr_all_hover"></i>
</li>
<li>
<i class="fa fa-star-o empty tr_all_hover"></i>
<i class="fa fa-star active tr_all_hover"></i>
</li>
</ul>
<p class="scheme_color">$24.00</p>
</div>
</div>
</figure>
<!--tags-->
<figure class="widget shadow r_corners wrapper m_bottom_30">
<figcaption>
<h3 class="color_light">Tags</h3>
</figcaption>
<div class="widget_content">
<div class="tags_list">
<a href="#" class="color_dark d_inline_b v_align_b">accessories,</a>
<a href="#" class="color_dark d_inline_b f_size_ex_large v_align_b">bestseller,</a>
<a href="#" class="color_dark d_inline_b v_align_b">clothes,</a>
<a href="#" class="color_dark d_inline_b f_size_big v_align_b">dresses,</a>
<a href="#" class="color_dark d_inline_b v_align_b">fashion,</a>
<a href="#" class="color_dark d_inline_b f_size_large v_align_b">men,</a>
<a href="#" class="color_dark d_inline_b v_align_b">pants,</a>
<a href="#" class="color_dark d_inline_b v_align_b">sale,</a>
<a href="#" class="color_dark d_inline_b v_align_b">short,</a>
<a href="#" class="color_dark d_inline_b f_size_ex_large v_align_b">skirt,</a>
<a href="#" class="color_dark d_inline_b v_align_b">top,</a>
<a href="#" class="color_dark d_inline_b f_size_big v_align_b">women</a>
</div>
</div>
</figure>
<!--New products-->
<figure class="widget shadow r_corners wrapper m_bottom_30">
<figcaption>
<h3 class="color_light">New Products</h3>
</figcaption>
<div class="widget_content">
<div class="clearfix m_bottom_15">
<img src="images/new_products_img_1.jpg" alt="" class="f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0">
<a href="#" class="color_dark d_block m_bottom_5 bt_link">Ut tellus dolor dapibus</a>
<p class="scheme_color">$61.00</p>
</div>
<hr class="m_bottom_15">
<div class="clearfix m_bottom_15">
<img src="images/new_products_img_2.jpg" alt="" class="f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0">
<a href="#" class="color_dark d_block m_bottom_5 bt_link">Elementum vel</a>
<p class="scheme_color">$57.00</p>
</div>
<hr class="m_bottom_15">
<div class="clearfix m_bottom_5">
<img src="images/new_products_img_3.jpg" alt="" class="f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0">
<a href="#" class="color_dark d_block m_bottom_5 bt_link">Crsus eleifend elit</a>
<p class="scheme_color">$24.00</p>
</div>
</div>
</figure>
<!--Specials-->
<figure class="widget shadow r_corners wrapper m_bottom_30">
<figcaption class="clearfix relative">
<h3 class="color_light f_left f_sm_none m_sm_bottom_10 m_xs_bottom_0">Specials</h3>
<div class="f_right nav_buttons_wrap_type_2 tf_sm_none f_sm_none clearfix">
<button class="button_type_7 bg_cs_hover box_s_none f_size_ex_large color_light t_align_c bg_tr f_left tr_delay_hover r_corners sc_prev"><i class="fa fa-angle-left"></i></button>
<button class="button_type_7 bg_cs_hover box_s_none f_size_ex_large color_light t_align_c bg_tr f_left m_left_5 tr_delay_hover r_corners sc_next"><i class="fa fa-angle-right"></i></button>
</div>
</figcaption>
<div class="widget_content">
<div class="specials_carousel">
<!--carousel item-->
<div class="specials_item">
<a href="#" class="d_block d_xs_inline_b wrapper m_bottom_20">
<img class="tr_all_long_hover" src="images/product_img_6.jpg" alt="">
</a>
<h5 class="m_bottom_10"><a href="#" class="color_dark">Aliquam erat volutpat</a></h5>
<p class="f_size_large m_bottom_15"><s>$79.00</s> <span class="scheme_color">$36.00</span></p>
<button class="button_type_4 mw_sm_0 r_corners color_light bg_scheme_color tr_all_hover m_bottom_5">Add to Cart</button>
</div>
<!--carousel item-->
<div class="specials_item">
<a href="#" class="d_block d_xs_inline_b wrapper m_bottom_20">
<img class="tr_all_long_hover" src="images/product_img_7.jpg" alt="">
</a>
<h5 class="m_bottom_10"><a href="#" class="color_dark">Integer rutrum ante </a></h5>
<p class="f_size_large m_bottom_15"><s>$79.00</s> <span class="scheme_color">$36.00</span></p>
<button class="button_type_4 mw_sm_0 r_corners color_light bg_scheme_color tr_all_hover m_bottom_5">Add to Cart</button>
</div>
<!--carousel item-->
<div class="specials_item">
<a href="#" class="d_block d_xs_inline_b wrapper m_bottom_20">
<img class="tr_all_long_hover" src="images/product_img_5.jpg" alt="">
</a>
<h5 class="m_bottom_10"><a href="#" class="color_dark">Aliquam erat volutpat</a></h5>
<p class="f_size_large m_bottom_15"><s>$79.00</s> <span class="scheme_color">$36.00</span></p>
<button class="button_type_4 mw_sm_0 r_corners color_light bg_scheme_color tr_all_hover m_bottom_5">Add to Cart</button>
</div>
</div>
</div>
</figure>
<!--Popular articles-->
<figure class="widget shadow r_corners wrapper m_bottom_30">
<figcaption>
<h3 class="color_light">Popular Articles</h3>
</figcaption>
<div class="widget_content">
<article class="clearfix m_bottom_15">
<img src="images/article_img_1.jpg" alt="" class="f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0">
<a href="#" class="color_dark d_block bt_link p_vr_0">Aliquam erat volutpat.</a>
<p class="f_size_medium">50 comments</p>
</article>
<hr class="m_bottom_15">
<article class="clearfix m_bottom_15">
<img src="images/article_img_2.jpg" alt="" class="f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0">
<a href="#" class="color_dark d_block p_vr_0 bt_link">Integer rutrum ante </a>
<p class="f_size_medium">34 comments</p>
</article>
<hr class="m_bottom_15">
<article class="clearfix m_bottom_5">
<img src="images/article_img_3.jpg" alt="" class="f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0">
<a href="#" class="color_dark d_block p_vr_0 bt_link">Vestibulum libero nisl, porta vel</a>
<p class="f_size_medium">21 comments</p>
</article>
</div>
</figure>
<!--Latest articles-->
<figure class="widget shadow r_corners wrapper m_bottom_30">
<figcaption>
<h3 class="color_light">Latest Articles</h3>
</figcaption>
<div class="widget_content">
<article class="clearfix m_bottom_15">
<img src="images/article_img_4.jpg" alt="" class="f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0">
<a href="#" class="color_dark d_block bt_link p_vr_0">Aliquam erat volutpat.</a>
<p class="f_size_medium">25 January, 2013</p>
</article>
<hr class="m_bottom_15">
<article class="clearfix m_bottom_15">
<img src="images/article_img_5.jpg" alt="" class="f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0">
<a href="#" class="color_dark d_block p_vr_0 bt_link">Integer rutrum ante </a>
<p class="f_size_medium">21 January, 2013</p>
</article>
<hr class="m_bottom_15">
<article class="clearfix m_bottom_5">
<img src="images/article_img_6.jpg" alt="" class="f_left m_right_15 m_sm_bottom_10 f_sm_none f_xs_left m_xs_bottom_0">
<a href="#" class="color_dark d_block p_vr_0 bt_link">Vestibulum libero nisl, porta vel</a>
<p class="f_size_medium">18 January, 2013</p>
</article>
</div>
</figure>
</aside>
</div>
</div>
</div>
<!--markup footer-->
<footer id="footer">
<div class="footer_top_part">
<div class="container">
<div class="row clearfix">
<div class="col-lg-3 col-md-3 col-sm-3 m_xs_bottom_30">
<h3 class="color_light_2 m_bottom_20">About</h3>
<p class="m_bottom_25">Ut pharetra augue nec augue. Nam elit agna, endrerit sit amet, tincidunt ac, viverra sed, nulla. Donec porta diam eu massa. Quisque diam lorem, interdum vitae, dapibus ac, scelerisque.</p>
<!--social icons-->
<ul class="clearfix horizontal_list social_icons">
<li class="facebook m_bottom_5 relative">
<span class="tooltip tr_all_hover r_corners color_dark f_size_small">Facebook</span>
<a href="#" class="r_corners t_align_c tr_delay_hover f_size_ex_large">
<i class="fa fa-facebook"></i>
</a>
</li>
<li class="twitter m_left_5 m_bottom_5 relative">
<span class="tooltip tr_all_hover r_corners color_dark f_size_small">Twitter</span>
<a href="#" class="r_corners f_size_ex_large t_align_c tr_delay_hover">
<i class="fa fa-twitter"></i>
</a>
</li>
<li class="google_plus m_left_5 m_bottom_5 relative">
<span class="tooltip tr_all_hover r_corners color_dark f_size_small">Google Plus</span>
<a href="#" class="r_corners f_size_ex_large t_align_c tr_delay_hover">
<i class="fa fa-google-plus"></i>
</a>
</li>
<li class="rss m_left_5 m_bottom_5 relative">
<span class="tooltip tr_all_hover r_corners color_dark f_size_small">Rss</span>
<a href="#" class="r_corners f_size_ex_large t_align_c tr_delay_hover">
<i class="fa fa-rss"></i>
</a>
</li>
<li class="pinterest m_left_5 m_bottom_5 relative">
<span class="tooltip tr_all_hover r_corners color_dark f_size_small">Pinterest</span>
<a href="#" class="r_corners f_size_ex_large t_align_c tr_delay_hover">
<i class="fa fa-pinterest"></i>
</a>
</li>
<li class="instagram m_left_5 m_bottom_5 relative">
<span class="tooltip tr_all_hover r_corners color_dark f_size_small">Instagram</span>
<a href="#" class="r_corners f_size_ex_large t_align_c tr_delay_hover">
<i class="fa fa-instagram"></i>
</a>
</li>
<li class="linkedin m_bottom_5 m_sm_left_5 relative">
<span class="tooltip tr_all_hover r_corners color_dark f_size_small">LinkedIn</span>
<a href="#" class="r_corners f_size_ex_large t_align_c tr_delay_hover">
<i class="fa fa-linkedin"></i>
</a>
</li>
<li class="vimeo m_left_5 m_bottom_5 relative">
<span class="tooltip tr_all_hover r_corners color_dark f_size_small">Vimeo</span>
<a href="#" class="r_corners f_size_ex_large t_align_c tr_delay_hover">
<i class="fa fa-vimeo-square"></i>
</a>
</li>
<li class="youtube m_left_5 m_bottom_5 relative">
<span class="tooltip tr_all_hover r_corners color_dark f_size_small">Youtube</span>
<a href="#" class="r_corners f_size_ex_large t_align_c tr_delay_hover">
<i class="fa fa-youtube-play"></i>
</a>
</li>
<li class="flickr m_left_5 m_bottom_5 relative">
<span class="tooltip tr_all_hover r_corners color_dark f_size_small">Flickr</span>
<a href="#" class="r_corners f_size_ex_large t_align_c tr_delay_hover">
<i class="fa fa-flickr"></i>
</a>
</li>
<li class="envelope m_left_5 m_bottom_5 relative">
<span class="tooltip tr_all_hover r_corners color_dark f_size_small">Contact Us</span>
<a href="#" class="r_corners f_size_ex_large t_align_c tr_delay_hover">
<i class="fa fa-envelope-o"></i>
</a>
</li>
</ul>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 m_xs_bottom_30">
<h3 class="color_light_2 m_bottom_20">The Service</h3>
<ul class="vertical_list">
<li><a class="color_light tr_delay_hover" href="#">My account<i class="fa fa-angle-right"></i></a></li>
<li><a class="color_light tr_delay_hover" href="#">Order history<i class="fa fa-angle-right"></i></a></li>
<li><a class="color_light tr_delay_hover" href="#">Wishlist<i class="fa fa-angle-right"></i></a></li>
<li><a class="color_light tr_delay_hover" href="#">Vendor contact<i class="fa fa-angle-right"></i></a></li>
<li><a class="color_light tr_delay_hover" href="#">Front page<i class="fa fa-angle-right"></i></a></li>
<li><a class="color_light tr_delay_hover" href="#">Virtuemart categories<i class="fa fa-angle-right"></i></a></li>
</ul>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 m_xs_bottom_30">
<h3 class="color_light_2 m_bottom_20">Information</h3>
<ul class="vertical_list">
<li><a class="color_light tr_delay_hover" href="#">About us<i class="fa fa-angle-right"></i></a></li>
<li><a class="color_light tr_delay_hover" href="#">New collection<i class="fa fa-angle-right"></i></a></li>
<li><a class="color_light tr_delay_hover" href="#">Best sellers<i class="fa fa-angle-right"></i></a></li>
<li><a class="color_light tr_delay_hover" href="#">Manufacturers<i class="fa fa-angle-right"></i></a></li>
<li><a class="color_light tr_delay_hover" href="#">Privacy policy<i class="fa fa-angle-right"></i></a></li>
<li><a class="color_light tr_delay_hover" href="#">Terms & condition<i class="fa fa-angle-right"></i></a></li>
</ul>
</div>
<div class="col-lg-3 col-md-3 col-sm-3">
<h3 class="color_light_2 m_bottom_20">Newsletter</h3>
<p class="f_size_medium m_bottom_15">Sign up to our newsletter and get exclusive deals you wont find anywhere else straight to your inbox!</p>
<form id="newsletter">
<input type="email" placeholder="Your email address" class="m_bottom_20 r_corners f_size_medium full_width" name="newsletter-email">
<button type="submit" class="button_type_8 r_corners bg_scheme_color color_light tr_all_hover">Subscribe</button>
</form>
</div>
</div>
</div>
</div>
<!--copyright part-->
<div class="footer_bottom_part">
<div class="container clearfix t_mxs_align_c">
<p class="f_left f_mxs_none m_mxs_bottom_10">© 2014 <span class="color_light">Flatastic</span>. All Rights Reserved.</p>
<ul class="f_right horizontal_list clearfix f_mxs_none d_mxs_inline_b">
<li><img src="images/payment_img_1.png" alt=""></li>
<li class="m_left_5"><img src="images/payment_img_2.png" alt=""></li>
<li class="m_left_5"><img src="images/payment_img_3.png" alt=""></li>
<li class="m_left_5"><img src="images/payment_img_4.png" alt=""></li>
<li class="m_left_5"><img src="images/payment_img_5.png" alt=""></li>
</ul>
</div>
</div>
</footer>
</div>
<!--social widgets-->
<ul class="social_widgets d_xs_none">
<!--facebook-->
<li class="relative">
<button class="sw_button t_align_c facebook"><i class="fa fa-facebook"></i></button>
<div class="sw_content">
<h3 class="color_dark m_bottom_20">Join Us on Facebook</h3>
<iframe src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fenvato&width=235&height=258&colorscheme=light&show_faces=true&header=false&stream=false&show_border=false&appId=438889712801266" style="border:none; overflow:hidden; width:235px; height:258px;"></iframe>
</div>
</li>
<!--twitter feed-->
<li class="relative">
<button class="sw_button t_align_c twitter"><i class="fa fa-twitter"></i></button>
<div class="sw_content">
<h3 class="color_dark m_bottom_20">Latest Tweets</h3>
<div class="twitterfeed m_bottom_25"></div>
<a role="button" class="button_type_4 d_inline_b r_corners tr_all_hover color_light tw_color" href="https://twitter.com/fanfbmltemplate">Follow on Twitter</a>
</div>
</li>
<!--contact form-->
<li class="relative">
<button class="sw_button t_align_c contact"><i class="fa fa-envelope-o"></i></button>
<div class="sw_content">
<h3 class="color_dark m_bottom_20">Contact Us</h3>
<p class="f_size_medium m_bottom_15">Lorem ipsum dolor sit amet, consectetuer adipis mauris</p>
<form id="contactform" class="mini">
<input class="f_size_medium m_bottom_10 r_corners full_width" type="text" name="cf_name" placeholder="Your name">
<input class="f_size_medium m_bottom_10 r_corners full_width" type="email" name="cf_email" placeholder="Email">
<textarea class="f_size_medium r_corners full_width m_bottom_20" placeholder="Message" name="cf_message"></textarea>
<button type="submit" class="button_type_4 r_corners mw_0 tr_all_hover color_dark bg_light_color_2">Send</button>
</form>
</div>
</li>
<!--contact info-->
<li class="relative">
<button class="sw_button t_align_c googlemap"><i class="fa fa-map-marker"></i></button>
<div class="sw_content">
<h3 class="color_dark m_bottom_20">Store Location</h3>
<ul class="c_info_list">
<li class="m_bottom_10">
<div class="clearfix m_bottom_15">
<i class="fa fa-map-marker f_left color_dark"></i>
<p class="contact_e">8901 Marmora Road,<br> Glasgow, D04 89GR.</p>
</div>
<iframe class="r_corners full_width" id="gmap_mini" src="https://maps.google.com/maps?f=q&source=s_q&hl=ru&geocode=&q=Manhattan,+New+York,+NY,+United+States&aq=0&oq=monheten&sll=37.0625,-95.677068&sspn=65.430355,129.814453&t=m&ie=UTF8&hq=&hnear=%D0%9C%D0%B0%D0%BD%D1%85%D1%8D%D1%82%D1%82%D0%B5%D0%BD,+%D0%9D%D1%8C%D1%8E-%D0%99%D0%BE%D1%80%D0%BA,+%D0%9D%D1%8C%D1%8E+%D0%99%D0%BE%D1%80%D0%BA,+%D0%9D%D1%8C%D1%8E-%D0%99%D0%BE%D1%80%D0%BA&ll=40.790278,-73.959722&spn=0.015612,0.031693&z=13&output=embed"></iframe>
</li>
<li class="m_bottom_10">
<div class="clearfix m_bottom_10">
<i class="fa fa-phone f_left color_dark"></i>
<p class="contact_e">800-559-65-80</p>
</div>
</li>
<li class="m_bottom_10">
<div class="clearfix m_bottom_10">
<i class="fa fa-envelope f_left color_dark"></i>
<a class="contact_e default_t_color" href="mailto:#">[email protected]</a>
</div>
</li>
<li>
<div class="clearfix">
<i class="fa fa-clock-o f_left color_dark"></i>
<p class="contact_e">Monday - Friday: 08.00-20.00 <br>Saturday: 09.00-15.00<br> Sunday: closed</p>
</div>
</li>
</ul>
</div>
</li>
</ul>
<!--login popup-->
<div class="popup_wrap d_none" id="login_popup">
<section class="popup r_corners shadow">
<button class="bg_tr color_dark tr_all_hover text_cs_hover close f_size_large"><i class="fa fa-times"></i></button>
<h3 class="m_bottom_20 color_dark">Log In</h3>
<form>
<ul>
<li class="m_bottom_15">
<label for="username" class="m_bottom_5 d_inline_b">Username</label><br>
<input type="text" name="" id="username" class="r_corners full_width">
</li>
<li class="m_bottom_25">
<label for="password" class="m_bottom_5 d_inline_b">Password</label><br>
<input type="password" name="" id="password" class="r_corners full_width">
</li>
<li class="m_bottom_15">
<input type="checkbox" class="d_none" id="checkbox_10"><label for="checkbox_10">Remember me</label>
</li>
<li class="clearfix m_bottom_30">
<button class="button_type_4 tr_all_hover r_corners f_left bg_scheme_color color_light f_mxs_none m_mxs_bottom_15">Log In</button>
<div class="f_right f_size_medium f_mxs_none">
<a href="#" class="color_dark">Forgot your password?</a><br>
<a href="#" class="color_dark">Forgot your username?</a>
</div>
</li>
</ul>
</form>
<footer class="bg_light_color_1 t_mxs_align_c">
<h3 class="color_dark d_inline_middle d_mxs_block m_mxs_bottom_15">New Customer?</h3>
<a href="#" role="button" class="tr_all_hover r_corners button_type_4 bg_dark_color bg_cs_hover color_light d_inline_middle m_mxs_left_0">Create an Account</a>
</footer>
</section>
</div>
<button class="t_align_c r_corners tr_all_hover type_2 animate_ftl" id="go_to_top"><i class="fa fa-angle-up"></i></button>
<!--scripts include-->
<script src="js/jquery-2.1.0.min.js"></script>
<script src="js/jquery-ui.min.js"></script>
<script src="js/retina.js"></script>
<script src="js/owl.carousel.min.js"></script>
<script src="js/waypoints.min.js"></script>
<script src="js/jquery.tweet.min.js"></script>
<script src="js/scripts.js"></script>
</body>
</html> | TroyerPro/proyectoFinal | project/flatastic_html/Main_v2.3/html/checkout.html | HTML | mit | 76,232 |
package work.notech.poker.room;
import work.notech.poker.logic.Cards;
import java.util.List;
public class GameRoom {
private Integer roomIds;
private List<Integer> clientIds;
private Cards cards;
public Integer getRoomIds() {
return roomIds;
}
public void setRoomIds(Integer roomIds) {
this.roomIds = roomIds;
}
public List<Integer> getClientIds() {
return clientIds;
}
public void setClientIds(List<Integer> clientIds) {
this.clientIds = clientIds;
}
public Cards getCards() {
return cards;
}
public void setCards(Cards cards) {
this.cards = cards;
}
}
| wangzhaoming/Poker | code/poker-server/src/main/java/work/notech/poker/room/GameRoom.java | Java | mit | 671 |
---
title: 22 Points to Go
author: rami
layout: lifestream
categories: [Lifestream]
tags: [jeddah, saudi-arabia, juve, path]
image: 22-points-to-go.jpg
---
10 games & 22 points to go. With games against the 20th place ,19,15,14,13,11. #Juve CC:@juventiknows.
{% include image.html url="/assets/images/content/lifestream/22-points-to-go.jpg" description="22 Points to Go" %}
| rtaibah/jekyll-blog | _posts/lifestream/2013-03-11-22-points-to-go.md | Markdown | mit | 380 |
// Take well-formed json from a sensu check result a context rich html document to be mail to
// one or more addresses.
//
// LICENSE:
// Copyright 2016 Yieldbot. <[email protected]>
// Released under the MIT License; see LICENSE
// for details.
package main
import (
"bytes"
"fmt"
"github.com/codegangsta/cli"
// "github.com/yieldbot/sensumailer/lib"
"github.com/yieldbot/sensuplugin/sensuhandler"
"github.com/yieldbot/sensuplugin/sensuutil"
// "log"
"net/smtp"
"os"
// "time"
)
func main() {
var emailAddress string
var smtpHost string
var smtpPort string
var emailSender string
var debug bool
app := cli.NewApp()
app.Name = "handler-mailer"
app.Usage = "Send context rich html alert notifications via email"
app.Action = func(c *cli.Context) {
if debug {
fmt.Printf("This is the sending address: %v \n", emailSender)
fmt.Printf("This is the recieving address: %v\n", emailAddress)
fmt.Printf("This is the smtp address: %v:%v\n", smtpHost, smtpPort)
sensuutil.Exit("debug")
}
// Get the sensu event data
sensuEvent := new(sensuhandler.SensuEvent)
sensuEvent = sensuEvent.AcquireSensuEvent()
// Connect to the remote SMTP server.
s, err := smtp.Dial(smtpHost + ":" + smtpPort)
if err != nil {
sensuutil.EHndlr(err)
}
defer s.Close()
// Set the sender and recipient.
s.Mail(emailSender)
s.Rcpt(emailAddress)
// Send the email body.
ws, err := s.Data()
if err != nil {
sensuutil.EHndlr(err)
}
defer ws.Close()
buf := bytes.NewBufferString("This is the email body.")
if _, err = buf.WriteTo(ws); err != nil {
sensuutil.EHndlr(err)
}
fmt.Printf("Email sent to %s\n", emailAddress)
}
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "address",
Value: "[email protected]",
Usage: "email address to send to",
EnvVar: "SENSU_HANDLER_EMAIL_ADDRESS",
Destination: &emailAddress,
},
cli.StringFlag{
Name: "host",
Value: "localhost",
Usage: "smtp server",
EnvVar: "SENSU_HANDLER_EMAIL_HOST",
Destination: &smtpHost,
},
cli.StringFlag{
Name: "port",
Value: "25",
Usage: "smtp port",
EnvVar: "SENSU_HANDLER_EMAIL_PORT",
Destination: &smtpPort,
},
cli.StringFlag{
Name: "sender",
Value: "[email protected]",
Usage: "email sender",
EnvVar: "SENSU_HANDLER_EMAIL_SENDER",
Destination: &emailSender,
},
cli.BoolFlag{
Name: "debug",
Usage: "Print debugging info, no alerts will be sent",
Destination: &debug,
},
}
app.Run(os.Args)
}
| yieldbot/sensumailer | cmd/handler-mailer/main.go | GO | mit | 2,623 |
module.exports = [
'babel-polyfill',
'react',
'react-redux',
'react-router',
'react-dom',
'redux',
'redux-thunk',
'seamless-immutable',
'react-router-redux',
'history',
'lodash',
'styled-components',
'prop-types',
];
| CheerfulYeti/React-Redux-Starter-Kit | webpack.vendor.js | JavaScript | mit | 243 |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\DataCollector;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\HeaderBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* RequestDataCollector.
*
* @author Fabien Potencier <[email protected]>
*/
class RequestDataCollector extends DataCollector implements EventSubscriberInterface
{
protected $controllers;
public function __construct()
{
$this->controllers = new \SplObjectStorage();
}
/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
$responseHeaders = $response->headers->all();
$cookies = array();
foreach ($response->headers->getCookies() as $cookie) {
$cookies[] = $this->getCookieHeader($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
}
if (count($cookies) > 0) {
$responseHeaders['Set-Cookie'] = $cookies;
}
$attributes = array();
foreach ($request->attributes->all() as $key => $value) {
$attributes[$key] = $this->varToString($value);
}
$content = null;
try {
$content = $request->getContent();
} catch (\LogicException $e) {
// the user already got the request content as a resource
$content = false;
}
$sessionMetadata = array();
$sessionAttributes = array();
$flashes = array();
if ($request->hasSession()) {
$session = $request->getSession();
if ($session->isStarted()) {
$sessionMetadata['Created'] = date(DATE_RFC822, $session->getMetadataBag()->getCreated());
$sessionMetadata['Last used'] = date(DATE_RFC822, $session->getMetadataBag()->getLastUsed());
$sessionMetadata['Lifetime'] = $session->getMetadataBag()->getLifetime();
$sessionAttributes = $session->all();
$flashes = $session->getFlashBag()->peekAll();
}
}
$this->data = array(
'format' => $request->getRequestFormat(),
'content' => $content,
'content_type' => $response->headers->get('Content-Type') ? $response->headers->get('Content-Type') : 'text/html',
'status_code' => $response->getStatusCode(),
'request_query' => $request->query->all(),
'request_request' => $request->request->all(),
'request_headers' => $request->headers->all(),
'request_server' => $request->server->all(),
'request_cookies' => $request->cookies->all(),
'request_attributes' => $attributes,
'response_headers' => $responseHeaders,
'session_metadata' => $sessionMetadata,
'session_attributes' => $sessionAttributes,
'flashes' => $flashes,
'path_info' => $request->getPathInfo(),
'controller' => 'n/a',
'locale' => $request->getLocale(),
);
if (isset($this->controllers[$request])) {
$controller = $this->controllers[$request];
if (is_array($controller)) {
$r = new \ReflectionMethod($controller[0], $controller[1]);
$this->data['controller'] = array(
'class' => get_class($controller[0]),
'method' => $controller[1],
'file' => $r->getFilename(),
'line' => $r->getStartLine(),
);
} elseif ($controller instanceof \Closure) {
$this->data['controller'] = 'Closure';
} else {
$this->data['controller'] = (string) $controller ?: 'n/a';
}
unset($this->controllers[$request]);
}
}
public function getPathInfo()
{
return $this->data['path_info'];
}
public function getRequestRequest()
{
return new ParameterBag($this->data['request_request']);
}
public function getRequestQuery()
{
return new ParameterBag($this->data['request_query']);
}
public function getRequestHeaders()
{
return new HeaderBag($this->data['request_headers']);
}
public function getRequestServer()
{
return new ParameterBag($this->data['request_server']);
}
public function getRequestCookies()
{
return new ParameterBag($this->data['request_cookies']);
}
public function getRequestAttributes()
{
return new ParameterBag($this->data['request_attributes']);
}
public function getResponseHeaders()
{
return new ResponseHeaderBag($this->data['response_headers']);
}
public function getSessionMetadata()
{
return $this->data['session_metadata'];
}
public function getSessionAttributes()
{
return $this->data['session_attributes'];
}
public function getFlashes()
{
return $this->data['flashes'];
}
public function getContent()
{
return $this->data['content'];
}
public function getContentType()
{
return $this->data['content_type'];
}
public function getStatusCode()
{
return $this->data['status_code'];
}
public function getFormat()
{
return $this->data['format'];
}
public function getLocale()
{
return $this->data['locale'];
}
/**
* Gets the route name.
*
* The _route request attributes is automatically set by the Router Matcher.
*
* @return string The route
*/
public function getRoute()
{
return isset($this->data['request_attributes']['_route']) ? $this->data['request_attributes']['_route'] : '';
}
/**
* Gets the route parameters.
*
* The _route_params request attributes is automatically set by the RouterListener.
*
* @return array The parameters
*/
public function getRouteParams()
{
return isset($this->data['request_attributes']['_route_params']) ? $this->data['request_attributes']['_route_params'] : array();
}
/**
* Gets the controller.
*
* @return string The controller as a string
*/
public function getController()
{
return $this->data['controller'];
}
public function onKernelController(FilterControllerEvent $event)
{
$this->controllers[$event->getRequest()] = $event->getController();
}
public static function getSubscribedEvents()
{
return array(KernelEvents::CONTROLLER => 'onKernelController');
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'request';
}
private function getCookieHeader($name, $value, $expires, $path, $domain, $secure, $httponly)
{
$cookie = sprintf('%s=%s', $name, urlencode($value));
if (0 !== $expires) {
if (is_numeric($expires)) {
$expires = (int) $expires;
} elseif ($expires instanceof \DateTime) {
$expires = $expires->getTimestamp();
} else {
$expires = strtotime($expires);
if (false === $expires || -1 == $expires) {
throw new \InvalidArgumentException(sprintf('The "expires" cookie parameter is not valid.', $expires));
}
}
$cookie .= '; expires='.substr(\DateTime::createFromFormat('U', $expires, new \DateTimeZone('UTC'))->format('D, d-M-Y H:i:s T'), 0, -5);
}
if ($domain) {
$cookie .= '; domain='.$domain;
}
$cookie .= '; path='.$path;
if ($secure) {
$cookie .= '; secure';
}
if ($httponly) {
$cookie .= '; httponly';
}
return $cookie;
}
}
| ondrejmirtes/symfony | src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php | PHP | mit | 8,681 |
package com.sunilson.pro4.activities;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.sunilson.pro4.R;
import com.sunilson.pro4.baseClasses.Liveticker;
import com.sunilson.pro4.exceptions.LivetickerSetException;
import com.sunilson.pro4.utilities.Constants;
import com.sunilson.pro4.views.SubmitButtonBig;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class AddLivetickerActivity extends BaseActivity implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
private ValueEventListener resultListener;
private DatabaseReference mReference, currentResultReference;
private boolean finished, startNow;
private String privacy = "public";
private String livetickerID;
private Calendar calendar;
private ArrayList<DatabaseReference> references = new ArrayList<>();
private CompoundButton.OnCheckedChangeListener switchListener;
@BindView(R.id.add_liveticker_date)
TextView dateTextView;
@BindView(R.id.add_liveticker_time)
TextView timeTextView;
@BindView(R.id.add_liveticker_title_edittext)
EditText titleEditText;
@BindView(R.id.add_liveticker_description_edittext)
EditText descriptionEditText;
@BindView(R.id.add_liveticker_status_edittext)
EditText statusEditText;
@BindView(R.id.add_liveticker_start_switch)
Switch dateSwitch;
@BindView(R.id.add_liveticker_privacy_switch)
Switch privacySwitch;
@BindView(R.id.add_liveticker_date_layout)
LinearLayout dateLayout;
@BindView(R.id.add_liveticker_privacy_title)
TextView privacyTitle;
@BindView(R.id.submit_button_view)
SubmitButtonBig submitButtonBig;
@OnClick(R.id.submit_button)
public void submit(View view) {
final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user == null || user.isAnonymous()) {
Toast.makeText(this, R.string.add_liveticker_user_failure, Toast.LENGTH_SHORT).show();
return;
}
final Liveticker liveticker = new Liveticker();
try {
liveticker.setTitle(titleEditText.getText().toString());
liveticker.setDescription(descriptionEditText.getText().toString());
liveticker.setAuthorID(user.getUid());
liveticker.setStateTimestamp(calendar.getTimeInMillis());
liveticker.setPrivacy(privacy);
liveticker.setStatus(statusEditText.getText().toString());
} catch (LivetickerSetException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
return;
}
loading(true);
final DatabaseReference ref = FirebaseDatabase.getInstance().getReference("/request/" + user.getUid() + "/addLiveticker/").push();
ref.setValue(liveticker).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
//Remove Event Listener from Queue, if it has been started
if (currentResultReference != null && resultListener != null) {
currentResultReference.removeEventListener(resultListener);
}
//Listen for results from Queue
DatabaseReference taskRef = FirebaseDatabase.getInstance().getReference("/result/" + user.getUid() + "/addLiveticker/" + ref.getKey());
//Add Listener to Reference and store Reference so we can later detach Listener
taskRef.addValueEventListener(resultListener);
currentResultReference = taskRef;
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_liveticker);
ButterKnife.bind(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mReference = FirebaseDatabase.getInstance().getReference();
initializeQueueListener();
calendar = Calendar.getInstance();
updateDateTime();
dateTextView.setOnClickListener(this);
timeTextView.setOnClickListener(this);
dateSwitch.setOnCheckedChangeListener(this);
privacySwitch.setOnCheckedChangeListener(this);
submitButtonBig.setText(getString(R.string.channel_edit_save), getString(R.string.loading));
}
@Override
protected void onStop() {
super.onStop();
//Remove Event Listener from Queue, if it has been started
if (currentResultReference != null && resultListener != null) {
currentResultReference.removeEventListener(resultListener);
}
}
@Override
protected void authChanged(FirebaseUser user) {
if (user.isAnonymous()) {
Intent i = new Intent(AddLivetickerActivity.this, MainActivity.class);
startActivity(i);
Toast.makeText(this, R.string.no_access_permission, Toast.LENGTH_SHORT).show();
}
}
/**
* Initialize Listener for "Add Liveticker Queue"
*/
private void initializeQueueListener() {
resultListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (!finished) {
//Check what state the Queue event has
if (dataSnapshot.child("state").getValue() != null) {
//Liveticker was added successfully
if (dataSnapshot.child("state").getValue().toString().equals("success")) {
finished = true;
Intent i = new Intent();
i.putExtra("livetickerID", dataSnapshot.child("successDetails").getValue().toString());
setResult(Constants.ADD_LIVETICKER_RESULT_CODE, i);
finish();
} else if (dataSnapshot.child("state").getValue().toString().equals("error")) {
loading(false);
Toast.makeText(AddLivetickerActivity.this, dataSnapshot.child("errorDetails").getValue().toString(), Toast.LENGTH_LONG).show();
}
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
}
/**
* Change visual loading state
*
* @param loading
*/
private void loading(boolean loading) {
if (loading) {
submitButtonBig.loading(true);
} else {
submitButtonBig.loading(false);
}
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.add_liveticker_date:
showDateDialog();
break;
case R.id.add_liveticker_time:
showTimeDialog();
break;
}
}
/**
* A dialog to pick a date and set the calendar to that date
*/
private void showDateDialog() {
DatePickerDialog.OnDateSetListener onDateSetListener = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int dayOfMonth) {
calendar.set(Calendar.MONTH, month);
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
updateDateTime();
}
};
DatePickerDialog datePickerDialog = new DatePickerDialog(this, onDateSetListener, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis() - 1000);
datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis() + 432000000);
datePickerDialog.show();
}
/**
* A dialog to pick a time and set the calendar to that time
*/
private void showTimeDialog() {
TimePickerDialog.OnTimeSetListener onTimeSetListener = new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker timePicker, int hour, int minute) {
calendar.set(Calendar.HOUR_OF_DAY, hour);
calendar.set(Calendar.MINUTE, minute);
updateDateTime();
}
};
TimePickerDialog timePickerDialog = new TimePickerDialog(this, onTimeSetListener, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), true);
timePickerDialog.show();
}
/**
* Update the Textviews with the current date from the calendar
*/
private void updateDateTime() {
Date date = calendar.getTime();
SimpleDateFormat formatDate = new SimpleDateFormat("dd.MM.yyyy", Locale.getDefault());
SimpleDateFormat formatTime = new SimpleDateFormat("HH:mm", Locale.getDefault());
dateTextView.setText(formatDate.format(date));
timeTextView.setText(formatTime.format(date));
}
/**
* When a switch gets toggled
*
* @param compoundButton Switch that was toggled
* @param b Value of switch
*/
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
switch (compoundButton.getId()) {
case R.id.add_liveticker_start_switch:
startNow = !startNow;
if (b) {
dateLayout.setVisibility(View.GONE);
} else {
dateLayout.setVisibility(View.VISIBLE);
}
break;
case R.id.add_liveticker_privacy_switch:
if (b) {
privacy = "public";
privacyTitle.setText(getString(R.string.add_liveticker_public_title));
} else {
privacy = "private";
privacyTitle.setText(getString(R.string.add_liveticker_public_title_private));
}
break;
}
}
}
| sunilson/My-Ticker-Android | Android App/app/src/main/java/com/sunilson/pro4/activities/AddLivetickerActivity.java | Java | mit | 11,353 |
{% load staticfiles %}
<!DOCTYPE html>
<html>
<head>
<title>
{% block title %}Default Title{% endblock %}
</title>
{% block stylesheets %}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="{% static 'css/style.css' %}" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600,300' rel='stylesheet' type='text/css'>
{% endblock %}
{% block javascript %}
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="{% static 'js/script.js' %}"></script>
{% endblock %}
{% block meta_tags %}
<meta name="viewport" content="width=device-width, initial-scale=1">
{% endblock %}
{% block extra_head %}{% endblock %}
</head>
<body>
<div id="wrap">
<main role="main">
<header>
{% include "maininclude/header.html" %}
</header>
<div class="container-fluid">
{% block main %}{% endblock %}
</div>
</main>
</div>
{% include "maininclude/footer.html" %}
</body>
</html> | azul-cloud/start | main/templates/maininclude/base.html | HTML | mit | 1,368 |
import nextConnect from 'next-connect'
import auth from '../../middleware/auth'
import { deleteUser, updateUserByUsername } from '../../lib/db'
const handler = nextConnect()
handler
.use(auth)
.get((req, res) => {
// You do not generally want to return the whole user object
// because it may contain sensitive field such as !!password!! Only return what needed
// const { name, username, favoriteColor } = req.user
// res.json({ user: { name, username, favoriteColor } })
res.json({ user: req.user })
})
.use((req, res, next) => {
// handlers after this (PUT, DELETE) all require an authenticated user
// This middleware to check if user is authenticated before continuing
if (!req.user) {
res.status(401).send('unauthenticated')
} else {
next()
}
})
.put((req, res) => {
const { name } = req.body
const user = updateUserByUsername(req, req.user.username, { name })
res.json({ user })
})
.delete((req, res) => {
deleteUser(req)
req.logOut()
res.status(204).end()
})
export default handler
| flybayer/next.js | examples/with-passport-and-next-connect/pages/api/user.js | JavaScript | mit | 1,087 |
<?php
namespace Plumber\Tests\Deployer;
use Plumber\Server\Server;
class NoRsyncDeployerTest extends \PHPUnit_Framework_TestCase
{
public function testRsyncDeployWithNotExistingRsyncExcludeFile()
{
$server = new Server( 'localhost', 'julien', '/var/www/', 22 );
$deployer = new \Plumber\Deployer\NoRsyncDeployer();
$this->assertTrue( $deployer->deploy( $server, array() ), 'This deployer always returns true.' );
}
public function testGetDeployerName()
{
$deployer = new \Plumber\Deployer\NoRsyncDeployer();
$this->assertEquals( 'no rsync', $deployer->getName(), 'The name must be no rsync' );
}
} | fiunchinho/Plumber | tests/Plumber/Deployer/NoRsyncDeployerTest.php | PHP | mit | 618 |
!function(a){var b,c,d;return a.localStorage||(c={setItem:function(a,b,c){var d,e;return null==c&&(c=!1),d=c?-1:30,e=new Date,e.setDate(e.getDate()+d),document.cookie=""+a+"="+escape(b)+"; expires="+e.toUTCString()},getItem:function(a){return document.cookie.indexOf(-1!==""+a+"=")?unescape(document.cookie.split(""+a+"=")[1].split(";")[0].replace("=","")):!1},removeItem:function(a){return this.setItem(a,"",!0)}}),d=localStorage||c,b=function(){function a(b){return this.key=b,this instanceof a?this:new a(this.key)}return a.prototype.key=null,a.prototype.get=function(){var a,b;a=d.getItem(this.key);try{return JSON.parse(a)}catch(c){return b=c,a}},a.prototype.set=function(a){var b;try{JSON.parse(a)}catch(c){b=c,a=JSON.stringify(a)}return d.setItem(this.key,a),this},a.prototype.remove=function(){return d.removeItem(this.key),this},a}(),a.Wafer=b}(window); | calebrash/wafer | dist/wafer.min.js | JavaScript | mit | 862 |
import { injectReducer } from 'STORE/reducers'
export default store => ({
path : 'checkHistoryList.html',
getComponent(nextState, cb) {
require.ensure([], (require) => {
const CheckHistoryList = require('VIEW/CheckHistoryList').default
const reducer = require('REDUCER/checkHistoryList').default
injectReducer(store, { key: 'checkHistoryList', reducer })
cb(null, CheckHistoryList)
}, 'checkHistoryList')
}
})
| OwlAford/IFP | src/routes/main/checkHistoryList.js | JavaScript | mit | 449 |
<?php
declare(strict_types=1);
namespace ShlinkMigrations;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\Migrations\AbstractMigration;
use function is_subclass_of;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160819142757 extends AbstractMigration
{
/**
* @throws Exception
* @throws SchemaException
*/
public function up(Schema $schema): void
{
$platformClass = $this->connection->getDatabasePlatform();
$table = $schema->getTable('short_urls');
$column = $table->getColumn('short_code');
match (true) {
is_subclass_of($platformClass, MySQLPlatform::class) => $column
->setPlatformOption('charset', 'utf8mb4')
->setPlatformOption('collation', 'utf8mb4_bin'),
is_subclass_of($platformClass, SqlitePlatform::class) => $column->setPlatformOption('collate', 'BINARY'),
default => null,
};
}
public function down(Schema $schema): void
{
// Nothing to roll back
}
public function isTransactional(): bool
{
return ! ($this->connection->getDatabasePlatform() instanceof MySQLPlatform);
}
}
| shlinkio/shlink | data/migrations/Version20160819142757.php | PHP | mit | 1,364 |
my personal site
| cursorzz/cursorzz.github.io | README.md | Markdown | mit | 17 |
<?php
namespace RectorPrefix20210615;
if (\class_exists('Tx_Extbase_Property_TypeConverter_AbstractFileFolderConverter')) {
return;
}
class Tx_Extbase_Property_TypeConverter_AbstractFileFolderConverter
{
}
\class_alias('Tx_Extbase_Property_TypeConverter_AbstractFileFolderConverter', 'Tx_Extbase_Property_TypeConverter_AbstractFileFolderConverter', \false);
| RectorPHP/Rector | vendor/ssch/typo3-rector/stubs/Tx_Extbase_Property_TypeConverter_AbstractFileFolderConverter.php | PHP | mit | 364 |
;(function() {
angular.module('app.core')
.config(config);
/* @ngInject */
function config($stateProvider, $locationProvider, $urlRouterProvider) {
$stateProvider
/**
* @name landing
* @type {route}
* @description First page for incoming users, and for default routing
* for all failed routes.
*/
.state('landing', {
url: '/',
templateUrl: '/html/modules/landing/landing.html',
controller: 'LandingController',
controllerAs: 'vm'
})
/**
* @name home
* @type {route}
* @description User landing page, the main display.
*/
.state('home', {
url: '',
abstract: true,
views: {
'': {
templateUrl: 'html/modules/home/template.html'
},
'current-routes@home': {
templateUrl: 'html/modules/layout/current-routes.html',
controller: 'CurrentRoutesController',
controllerAs: 'vm'
},
'add-routes@home': {
templateUrl: 'html/modules/layout/add-routes.html',
controller: 'AddRoutesController',
controllerAs: 'vm'
}
}
})
.state('home.home', {
url: '/home',
authenticate: true,
views: {
'container@home': {
templateUrl: 'html/modules/home/welcome.html'
}
}
})
.state('home.new-route', {
url: '/new-route/:route',
authenticate: true,
views: {
'container@home': {
templateUrl: 'html/modules/routes/new-route.html',
controller: 'NewRouteController',
controllerAs: 'vm'
}
}
})
/**
* @name editRoute
* @type {route}
* @description View for editing a specific route. Provides options
* to edit or delete the route.
*/
.state('home.edit-route', {
url: '/routes/{route:.*}',
authenticate: true,
views: {
'container@home': {
templateUrl: '/html/modules/routes/edit-routes.html',
controller: 'EditRoutesController',
controllerAs: 'vm',
}
}
})
/**
* @name Docs
* @type {route}
* @description View for the project documentation
*
*/
.state('docs',{
url:'',
abstract: true,
views: {
'': {
templateUrl: '/html/modules/docs/docs.html'
},
'doc-list@docs': {
templateUrl: '/html/modules/docs/docs-list.html',
controller: 'DocsController',
controllerAs: 'vm'
}
}
})
.state('docs.docs', {
url: '/docs',
views: {
'container@docs': {
templateUrl: '/html/modules/docs/current-doc.html'
}
}
})
.state('docs.current-doc', {
url: '/docs/:doc',
views: {
'container@docs': {
templateUrl: function($stateParams) {
return '/html/modules/docs/pages/' + $stateParams.doc + '.html';
}
}
}
})
.state('home.analytics', {
url: '/analytics/{route:.*}',
authenticate: true,
views: {
'container@home': {
templateUrl: '/html/modules/analytics/analytics.html',
controller: 'AnalyticsController',
controllerAs: 'vm'
}
}
});
// default uncaught routes to landing page
$urlRouterProvider.otherwise('/');
// enable HTML5 mode
$locationProvider.html5Mode(true);
}
}).call(this);
| radiant-persimmons/mockr | src/client/app/core/config/routes.config.js | JavaScript | mit | 3,748 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
namespace CommonTypes
{
/// <summary>
/// BrokerSite hides the replication in a site making the calls transparent.
/// </summary>
[Serializable]
public class BrokerSiteFrontEnd : IBroker
{
private string siteName;
private List<BrokerPairDTO> brokersAlive;
public BrokerSiteFrontEnd(ICollection<BrokerPairDTO> brokers,string siteName)
{
this.brokersAlive = brokers.ToList();
this.siteName = siteName;
}
private void RemoveCrashedBrokers(string brokerName)
{
lock (this)
{
foreach (BrokerPairDTO pair in brokersAlive)
{
if (pair.LogicName.Equals(brokerName))
{
brokersAlive.Remove(pair);
break;
}
}
}
}
private BrokerPairDTO[] GetCopy()
{
lock (this)
{
return brokersAlive.ToArray();
}
}
public void Diffuse(Event e)
{
BrokerPairDTO[] brokers = GetCopy();
foreach (BrokerPairDTO pair in brokers)
{
try
{
(Activator.GetObject(typeof(IBroker), pair.Url) as IBroker).Diffuse(e);
}
catch (Exception)
{
RemoveCrashedBrokers(pair.LogicName);
}
}
}
public void AddRoute(Route route)
{
BrokerPairDTO[] brokers = GetCopy();
foreach (BrokerPairDTO pair in brokers)
{
try
{
(Activator.GetObject(typeof(IBroker), pair.Url) as IBroker).AddRoute(route);
}
catch (Exception e)
{
RemoveCrashedBrokers(pair.LogicName);
Console.WriteLine(e);
}
}
}
public void RemoveRoute(Route route)
{
BrokerPairDTO[] brokers = GetCopy();
foreach (BrokerPairDTO pair in brokers)
{
try
{
(Activator.GetObject(typeof(IBroker), pair.Url) as IBroker).RemoveRoute(route);
}
catch (Exception)
{
RemoveCrashedBrokers(pair.LogicName);
}
}
}
public void Subscribe(Subscription subscription)
{
BrokerPairDTO[] brokers = GetCopy();
foreach (BrokerPairDTO pair in brokers)
{
try
{
(Activator.GetObject(typeof(IBroker), pair.Url) as IBroker).Subscribe(subscription);
}
catch (Exception)
{
RemoveCrashedBrokers(pair.LogicName);
}
}
}
public void Unsubscribe(Subscription subscription)
{
BrokerPairDTO[] brokers = GetCopy();
foreach (BrokerPairDTO pair in brokers)
{
try
{
(Activator.GetObject(typeof(IBroker), pair.Url) as IBroker).Unsubscribe(subscription);
}
catch (Exception)
{
RemoveCrashedBrokers(pair.LogicName);
}
}
}
public void Sequence(Bludger bludger)
{
BrokerPairDTO[] brokers = GetCopy();
foreach (BrokerPairDTO pair in brokers)
{
try
{
(Activator.GetObject(typeof(IBroker), pair.Url) as IBroker).Sequence(bludger);
}
catch (Exception)
{
RemoveCrashedBrokers(pair.LogicName);
}
}
}
public void Bludger(Bludger bludger)
{
BrokerPairDTO[] brokers = GetCopy();
foreach (BrokerPairDTO pair in brokers)
{
try
{
(Activator.GetObject(typeof(IBroker), pair.Url) as IBroker).Bludger(bludger);
}
catch (Exception)
{
RemoveCrashedBrokers(pair.LogicName);
}
}
}
public override string ToString()
{
lock (this)
{
string res = siteName + " :" + Environment.NewLine;
foreach (BrokerPairDTO dto in brokersAlive)
{
res += dto.ToString() + Environment.NewLine;
}
return res;
}
}
}
}
| pasadinhas/dad-project | SESDAD/CommonTypes/BrokerSiteFrontEnd.cs | C# | mit | 4,968 |
import Route from '@ember/routing/route';
import { A } from '@ember/array';
import { hash } from 'rsvp';
import EmberObject from '@ember/object'
export default Route.extend({
model: function() {
return hash({
exampleModel: EmberObject.create(),
disableSubmit: false,
selectedLanguage: null,
selectOptions: A([
{label: 'French', value: 'fr'},
{label: 'English', value: 'en'},
{label: 'German', value: 'gr'}
]),
radioOptions: A([
{label: 'Ruby', value: 'ruby'},
{label: 'Javascript', value: 'js'},
{label: 'Cold Fusion', value: 'cf'}
])
});
},
actions: {
submit: function() {
window.alert('You triggered a form submit!');
},
toggleErrors: function() {
var model = this.get('currentModel').exampleModel;
if(model.get('errors')) {
model.set('errors', null);
}else{
var errors = {
first_name: A(['That first name is wrong']),
last_name: A(['That last name is silly']),
language: A(['Please choose a better language']),
isAwesome: A(['You must be awesome to submit this form']),
bestLanguage: A(['Wrong, Cold Fusion is the best language']),
essay: A(['This essay is not very good'])
};
model.set('errors', errors);
}
},
toggleSelectValue: function() {
if(this.get('currentModel.exampleModel.language')) {
this.set('currentModel.exampleModel.language', null);
}else{
this.set('currentModel.exampleModel.language', 'fr');
}
},
toggleSubmit: function() {
if(this.get('currentModel.disableSubmit')) {
this.set('currentModel.disableSubmit', false);
}else{
this.set('currentModel.disableSubmit', true);
}
},
toggleCheckbox: function() {
if(this.get('currentModel.exampleModel.isAwesome')) {
this.set('currentModel.exampleModel.isAwesome', false);
} else {
this.set('currentModel.exampleModel.isAwesome', true);
}
},
toggleRadio: function() {
if(this.get('currentModel.exampleModel.bestLanguage')) {
this.set('currentModel.exampleModel.bestLanguage', null);
}else{
this.set('currentModel.exampleModel.bestLanguage', 'js');
}
}
}
});
| Emerson/ember-form-master-2000 | tests/dummy/app/routes/application.js | JavaScript | mit | 2,343 |
import lowerCaseFirst from 'lower-case-first';
import {handles} from 'marty';
import Override from 'override-decorator';
function addHandlers(ResourceStore) {
const {constantMappings} = this;
return class ResourceStoreWithHandlers extends ResourceStore {
@Override
@handles(constantMappings.getMany.done)
getManyDone(payload) {
super.getManyDone(payload);
this.hasChanged();
}
@Override
@handles(constantMappings.getSingle.done)
getSingleDone(payload) {
super.getSingleDone(payload);
this.hasChanged();
}
@handles(
constantMappings.postSingle.done,
constantMappings.putSingle.done,
constantMappings.patchSingle.done
)
changeSingleDone(args) {
// These change actions may return the inserted or modified object, so
// update that object if possible.
if (args.result) {
this.getSingleDone(args);
}
}
};
}
function addFetch(
ResourceStore,
{
actionsKey = `${lowerCaseFirst(this.name)}Actions`
}
) {
const {methodNames, name, plural} = this;
const {getMany, getSingle} = methodNames;
const refreshMany = `refresh${plural}`;
const refreshSingle = `refresh${name}`;
return class ResourceStoreWithFetch extends ResourceStore {
getActions() {
return this.app[actionsKey];
}
[getMany](options, {refresh} = {}) {
return this.fetch({
id: `c${this.collectionKey(options)}`,
locally: () => this.localGetMany(options),
remotely: () => this.remoteGetMany(options),
refresh
});
}
[refreshMany](options) {
return this[getMany](options, {refresh: true});
}
localGetMany(options) {
return super[getMany](options);
}
remoteGetMany(options) {
return this.getActions()[getMany](options);
}
[getSingle](id, options, {refresh} = {}) {
return this.fetch({
id: `i${this.itemKey(id, options)}`,
locally: () => this.localGetSingle(id, options),
remotely: () => this.remoteGetSingle(id, options),
refresh
});
}
[refreshSingle](id, options) {
return this[getSingle](id, options, {refresh: true});
}
localGetSingle(id, options) {
return super[getSingle](id, options);
}
remoteGetSingle(id, options) {
return this.getActions()[getSingle](id, options);
}
fetch({refresh, ...options}) {
if (refresh) {
const baseLocally = options.locally;
options.locally = function refreshLocally() {
if (refresh) {
refresh = false;
return undefined;
} else {
return this::baseLocally();
}
};
}
return super.fetch(options);
}
};
}
export default function extendStore(
ResourceStore,
{
useFetch = true,
...options
}
) {
ResourceStore = this::addHandlers(ResourceStore, options);
if (useFetch) {
ResourceStore = this::addFetch(ResourceStore, options);
}
return ResourceStore;
}
| taion/flux-resource-marty | src/store.js | JavaScript | mit | 3,040 |
<?php
namespace proyecto\backendBundle\Entity;
/**
* Entidad Respuesta
* @author Javier Burguillo Sánchez
*/
class Respuesta
{
/**
* @var integer
*/
private $id;
/**
* @var string
*/
private $respuesta;
/**
* @var \proyecto\backendBundle\Entity\Subpregunta
*/
private $idSubpregunta;
/**
* @var \proyecto\backendBundle\Entity\Participante
*/
private $idParticipante;
/**
* Obtener id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Establecer respuesta
*
* @param string
* @return Respuesta
*/
public function setRespuesta($respuesta)
{
$this->respuesta = $respuesta;
return $this;
}
/**
* Obtener respuesta
*
* @return string
*/
public function getRespuesta()
{
return $this->respuesta;
}
/**
* Establecer idSubpregunta
*
* @param \proyecto\backendBundle\Entity\Subpregunta
* @return Respuesta
*/
public function setIdSubpregunta(\proyecto\backendBundle\Entity\Subpregunta $idSubpregunta = null)
{
$this->idSubpregunta = $idSubpregunta;
return $this;
}
/**
* Obtener idSubpregunta
*
* @return \proyecto\backendBundle\Entity\Subpregunta
*/
public function getIdSubpregunta()
{
return $this->idSubpregunta;
}
/**
* Establecer idParticipante
*
* @param \proyecto\backendBundle\Entity\Participante
* @return Respuesta
*/
public function setIdParticipante(\proyecto\backendBundle\Entity\Participante $idParticipante = null)
{
$this->idParticipante = $idParticipante;
return $this;
}
/**
* Obtener idParticipante
*
* @return \proyecto\backendBundle\Entity\Participante
*/
public function getIdParticipante()
{
return $this->idParticipante;
}
} | jburgui/proyecto2.0 | src/proyecto/backendBundle/Entity/Respuesta.php | PHP | mit | 2,024 |
$('.js-toggle-menu').click(function(e){
e.preventDefault();
$(this).siblings().toggle();
});
$('.nav--primary li').click(function(){
$(this).find('ul').toggleClass('active');
});
| sudojesse/sdb | js/main.js | JavaScript | mit | 182 |
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.core.network;
import io.netty.channel.Channel;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.local.LocalAddress;
import net.minecraft.network.NetworkManager;
import org.spongepowered.api.MinecraftVersion;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.common.SpongeMinecraftVersion;
import org.spongepowered.common.bridge.network.NetworkManagerBridge;
import org.spongepowered.common.util.Constants;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.UnknownHostException;
import javax.annotation.Nullable;
@SuppressWarnings("rawtypes")
@Mixin(NetworkManager.class)
public abstract class NetworkManagerMixin extends SimpleChannelInboundHandler implements NetworkManagerBridge {
@Shadow private Channel channel;
@Shadow public abstract SocketAddress getRemoteAddress();
@Nullable private InetSocketAddress impl$virtualHost;
@Nullable private MinecraftVersion impl$version;
@Override
public InetSocketAddress bridge$getAddress() {
final SocketAddress remoteAddress = getRemoteAddress();
if (remoteAddress instanceof LocalAddress) { // Single player
return Constants.Networking.LOCALHOST;
}
return (InetSocketAddress) remoteAddress;
}
@Override
public InetSocketAddress bridge$getVirtualHost() {
if (this.impl$virtualHost != null) {
return this.impl$virtualHost;
}
final SocketAddress local = this.channel.localAddress();
if (local instanceof LocalAddress) {
return Constants.Networking.LOCALHOST;
}
return (InetSocketAddress) local;
}
@Override
public void bridge$setVirtualHost(final String host, final int port) {
try {
this.impl$virtualHost = new InetSocketAddress(InetAddress.getByAddress(host,
((InetSocketAddress) this.channel.localAddress()).getAddress().getAddress()), port);
} catch (UnknownHostException e) {
this.impl$virtualHost = InetSocketAddress.createUnresolved(host, port);
}
}
@Override
public MinecraftVersion bridge$getVersion() {
return this.impl$version;
}
@Override
public void bridge$setVersion(final int version) {
this.impl$version = new SpongeMinecraftVersion(String.valueOf(version), version);
}
}
| SpongePowered/SpongeCommon | src/main/java/org/spongepowered/common/mixin/core/network/NetworkManagerMixin.java | Java | mit | 3,754 |
function solve(message) {
let tagValidator = /^<message((?:\s+[a-z]+="[A-Za-z0-9 .]+"\s*?)*)>((?:.|\n)+?)<\/message>$/;
let tokens = tagValidator.exec(message);
if (!tokens) {
console.log("Invalid message format");
return;
}
let [match, attributes, body] = tokens;
let attributeValidator = /\s+([a-z]+)="([A-Za-z0-9 .]+)"\s*?/g;
let sender = '';
let recipient = '';
let attributeTokens = attributeValidator.exec(attributes);
while (attributeTokens) {
if (attributeTokens[1] === 'to') {
recipient = attributeTokens[2];
} else if (attributeTokens[1] === 'from') {
sender = attributeTokens[2];
}
attributeTokens = attributeValidator.exec(attributes);
}
if (sender === '' || recipient === '') {
console.log("Missing attributes");
return;
}
body = body.replace(/\n/g, '</p>\n <p>');
let html = `<article>\n <div>From: <span class="sender">${sender}</span></div>\n`;
html += ` <div>To: <span class="recipient">${recipient}</span></div>\n`;
html += ` <div>\n <p>${body}</p>\n </div>\n</article>`;
console.log(html);
}
solve(`<message from="John Doe" to="Alice">Not much, just chillin. How about you?</message>`);
/*
solve( `<message to="Bob" from="Alice" timestamp="1497254092">Hey man, what's up?</message>`,
`<message from="Ivan Ivanov" to="Grace">Not much, just chillin. How about you?</message>`
);
*/ | kalinmarkov/SoftUni | JS Core/JS Fundamentals/Exams/03. XML Messenger.js | JavaScript | mit | 1,486 |
"""
Tests for a door card.
"""
import pytest
from onirim import card
from onirim import component
from onirim import core
from onirim import agent
class DoorActor(agent.Actor):
"""
"""
def __init__(self, do_open):
self._do_open = do_open
def open_door(self, content, door_card):
return self._do_open
DRAWN_CAN_NOT_OPEN = (
card.Color.red,
False,
component.Content(
undrawn_cards=[],
hand=[card.key(card.Color.blue)]),
component.Content(
undrawn_cards=[],
hand=[card.key(card.Color.blue)],
limbo=[card.door(card.Color.red)]),
)
DRAWN_DO_NOT_OPEN = (
card.Color.red,
False,
component.Content(
undrawn_cards=[],
hand=[card.key(card.Color.red)]),
component.Content(
undrawn_cards=[],
hand=[card.key(card.Color.red)],
limbo=[card.door(card.Color.red)]),
)
DRAWN_DO_OPEN = (
card.Color.red,
True,
component.Content(
undrawn_cards=[],
hand=[
card.key(card.Color.red),
card.key(card.Color.red),
card.key(card.Color.red),
]),
component.Content(
undrawn_cards=[],
discarded=[card.key(card.Color.red)],
hand=[card.key(card.Color.red), card.key(card.Color.red)],
opened=[card.door(card.Color.red)]),
)
DRAWN_DO_OPEN_2 = (
card.Color.red,
True,
component.Content(
undrawn_cards=[],
hand=[
card.key(card.Color.blue),
card.key(card.Color.red),
]),
component.Content(
undrawn_cards=[],
discarded=[card.key(card.Color.red)],
hand=[card.key(card.Color.blue)],
opened=[card.door(card.Color.red)]),
)
DRAWN_CASES = [
DRAWN_CAN_NOT_OPEN,
DRAWN_DO_NOT_OPEN,
DRAWN_DO_OPEN,
DRAWN_DO_OPEN_2,
]
@pytest.mark.parametrize(
"color, do_open, content, content_after",
DRAWN_CASES)
def test_drawn(color, do_open, content, content_after):
door_card = card.door(color)
door_card.drawn(core.Core(DoorActor(do_open), agent.Observer(), content))
assert content == content_after
| cwahbong/onirim-py | tests/test_door.py | Python | mit | 2,159 |
/*
**==============================================================================
**
** Copyright (c) 2003, 2004, 2005, 2006, Michael Brasher, Karl Schopmeyer
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and associated documentation files (the "Software"),
** to deal in the Software without restriction, including without limitation
** the rights to use, copy, modify, merge, publish, distribute, sublicense,
** and/or sell copies of the Software, and to permit persons to whom the
** Software is furnished to do so, subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in
** all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
** SOFTWARE.
**
**==============================================================================
*/
#include "OS.h"
int OS::close(Sock sock)
{
int result;
SF_RESTART(::close(sock), result);
return result;
}
| LegalizeAdulthood/cimple | src/server/OS_close.cpp | C++ | mit | 1,444 |
'use strict';
const test = require('ava');
const hashSet = require('../index');
const MySet = hashSet(x => x);
test('should not change empty set', t => {
const set = new MySet();
set.clear();
t.is(set.size, 0);
});
test('should clear set', t => {
const set = new MySet();
set.add(1);
set.clear();
t.is(set.size, 0);
});
| blond/hash-set | test/clear.js | JavaScript | mit | 356 |
Unframed XHR
===
Extends the `Unframed` prototype with five methods.
One to send any XHR request to a url that is not yet busy for this application, eventually set a tieout and a callback or emit an application event on response.
~~~
xhrSend(method, url, headers, body, timeout, callback)
~~~
And four conveniences for the most common form of HTTP request:
~~~
xhrGetText(url, query, headers, timeout, callback)
xhrPostForm(url, form, timeout, callback)
xhrGetJson(url, query, timeout, callback)
xhrPostJson(url, request, timeout, callback)
~~~
These methods provide an API to send GET and POST requests to all type of web resources, with a minimum of conveniences for JSON, HTML and XML.
And by failing if the `url` requested is already busy, these methods force their applications to avoid concurrent requests to the same network resource.
Synopsis
---
If the URL requested is not busy for `myapp`, send a GET request for a JSON resource.
~~~javascript
myapp.xhrGetJson('hello.php');
~~~
Or send a query along, as a map of arguments.
~~~javascript
myapp.xhrGetJson('hello.php', {'n': 'World'});
~~~
Since `callback(status, message)` was left undefined an application event will be emitted on response.
For instance, on success.
~~~
200 GET hello.php {"who": "World"}
~~~
To POST a JSON body instead, do.
~~~javascript
myapp.xhrPostJson('greetings.php', {'who': 'World'});
~~~
Note that `xhrSend`, `xhrGetText`, `xhrPostForm`, `xhrGetJSON` and `xhrPostJson` methods maintain a table of busy URLs and prevent concurrent requests to the same resource. | laurentszyster/unframed.js | doc/unframed_xhr.md | Markdown | mit | 1,566 |
# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Network::Mgmt::V2019_08_01
module Models
#
# Response for ListBastionHosts API service call.
#
class BastionHostListResult
include MsRestAzure
include MsRest::JSONable
# @return [Array<BastionHost>] List of Bastion Hosts in a resource group.
attr_accessor :value
# @return [String] URL to get the next set of results.
attr_accessor :next_link
# return [Proc] with next page method call.
attr_accessor :next_method
#
# Gets the rest of the items for the request, enabling auto-pagination.
#
# @return [Array<BastionHost>] operation results.
#
def get_all_items
items = @value
page = self
while page.next_link != nil && !page.next_link.strip.empty? do
page = page.get_next_page
items.concat(page.value)
end
items
end
#
# Gets the next page of results.
#
# @return [BastionHostListResult] with next page content.
#
def get_next_page
response = @next_method.call(@next_link).value! unless @next_method.nil?
unless response.nil?
@next_link = response.body.next_link
@value = response.body.value
self
end
end
#
# Mapper for BastionHostListResult class as Ruby Hash.
# This will be used for serialization/deserialization.
#
def self.mapper()
{
client_side_validation: true,
required: false,
serialized_name: 'BastionHostListResult',
type: {
name: 'Composite',
class_name: 'BastionHostListResult',
model_properties: {
value: {
client_side_validation: true,
required: false,
serialized_name: 'value',
type: {
name: 'Sequence',
element: {
client_side_validation: true,
required: false,
serialized_name: 'BastionHostElementType',
type: {
name: 'Composite',
class_name: 'BastionHost'
}
}
}
},
next_link: {
client_side_validation: true,
required: false,
serialized_name: 'nextLink',
type: {
name: 'String'
}
}
}
}
}
end
end
end
end
| Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-08-01/generated/azure_mgmt_network/models/bastion_host_list_result.rb | Ruby | mit | 2,770 |
### This script fetches level-1 PACS imaging data, using a list generated by the
### archive (in the CSV format), attaches sky coordinates and masks to them
### (by calling the convertL1ToScanam task) and save them to disk in the correct
### format for later use by Scanamorphos.
### See important instructions below.
#######################################################
### This script is part of the Scanamorphos package.
### HCSS is free software: you can redistribute it and/or modify
### it under the terms of the GNU Lesser General Public License as
### published by the Free Software Foundation, either version 3 of
### the License, or (at your option) any later version.
#######################################################
## Import classes and definitions:
import os
from herschel.pacs.spg.phot import ConvertL1ToScanamTask
#######################################################
## local settings:
dir_root = "/pcdisk/stark/aribas/Desktop/modeling_TDs/remaps_Cha/PACS/scanamorphos/"
path = dir_root +"L1/"
### number of observations:
n_obs = 2
#######################################################
## Do a multiple target search in the archive and use the "save all results as CSV" option.
## --> ascii table 'results.csv' where lines can be edited
## (suppress unwanted observations and correct target names)
## Create the directories contained in the dir_out variables (l. 57)
## before running this script.
#######################################################
## observations:
table_obs = asciiTableReader(file=dir_root+'results_fast.csv', tableType='CSV', skipRows=1)
list_obsids = table_obs[0].data
list_names = table_obs[1].data
for i_obs in range(n_obs):
##
num_obsid = list_obsids[i_obs]
source = list_names[i_obs]
source = str.lower(str(source))
dir_out = path+source+"_processed_obsids"
# create directory if it does not exist
if not(os.path.exists(dir_out)):
os.system('mkdir '+dir_out)
##
print ""
print "Downloading obsid " + `num_obsid`
obs = getObservation(num_obsid, useHsa=True, instrument="PACS", verbose=True)
###
frames = obs.level1.refs["HPPAVGR"].product.refs[0].product
convertL1ToScanam(frames, cancelGlitch=1, assignRaDec=1, outDir=dir_out)
###
frames = obs.level1.refs["HPPAVGB"].product.refs[0].product
convertL1ToScanam(frames, cancelGlitch=1, assignRaDec=1, outDir=dir_out)
### END OF SCRIPT
#######################################################
| alvaroribas/modeling_TDs | Herschel_mapmaking/scanamorphos/PACS/general_script_L1_PACS.py | Python | mit | 2,499 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sim908Connect.Lib.Constants
{
internal class CommandFormats
{
internal const string AT_CGSNBASE = "AT+CGSN";
internal const string ATE = "ATE";
internal const string AT_CFUN = "AT_CFUN";
}
}
| thehoneymad/Sim908Connect | Sim908Connect/Lib/Constants/CommandFormats.cs | C# | mit | 358 |
/**
@file std_streambuf.h
@brief suppresses warnings in streambuf.
@author HRYKY
@version $Id: std_streambuf.h 337 2014-03-23 14:12:33Z [email protected] $
*/
#ifndef STD_STREAMBUF_H_20140323003904693
#define STD_STREAMBUF_H_20140323003904693
#include "hryky/pragma.h"
#pragma hryky_pragma_push_warning
# include <streambuf>
#pragma hryky_pragma_pop_warning
//------------------------------------------------------------------------------
// defines macros
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// declares types
//------------------------------------------------------------------------------
namespace hryky
{
} // namespace hryky
//------------------------------------------------------------------------------
// declares classes
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// declares global functions
//------------------------------------------------------------------------------
namespace hryky
{
} // namespace hryky
//------------------------------------------------------------------------------
// defines global functions
//------------------------------------------------------------------------------
#endif // STD_STREAMBUF_H_20140323003904693
// end of file
| hiroyuki-seki/hryky-codebase | lib/core/include/hryky/std/std_streambuf.h | C | mit | 1,445 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>SendMessage</title>
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="SendMessage";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><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 class="navBarCell1Rev">Class</li>
<li><a href="package-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><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../nxt/http/PlaceBidOrder.html" title="class in nxt.http"><span class="strong">Prev Class</span></a></li>
<li><a href="../../nxt/http/SendMoney.html" title="class in nxt.http"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?nxt/http/SendMessage.html" target="_top">Frames</a></li>
<li><a href="SendMessage.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#methods_inherited_from_class_java.lang.Object">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li>Method</li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">nxt.http</div>
<h2 title="Class SendMessage" class="title">Class SendMessage</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>nxt.http.SendMessage</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public final class <span class="strong">SendMessage</span>
extends java.lang.Object</pre>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><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 class="navBarCell1Rev">Class</li>
<li><a href="package-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><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../nxt/http/PlaceBidOrder.html" title="class in nxt.http"><span class="strong">Prev Class</span></a></li>
<li><a href="../../nxt/http/SendMoney.html" title="class in nxt.http"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?nxt/http/SendMessage.html" target="_top">Frames</a></li>
<li><a href="SendMessage.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#methods_inherited_from_class_java.lang.Object">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li>Method</li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| stevedoe/nxt-client | html/doc/nxt/http/SendMessage.html | HTML | mit | 5,534 |
'use strict';
const path = require('path');
const jwt = require('jsonwebtoken');
const AuthConfig = require(path.resolve('./config')).Auth;
const jwtSecret = AuthConfig.jwt.secret;
const tokenExpirePeriod = AuthConfig.jwt.tokenExpirePeriod;
function generateToken(payLoad) {
const isObject = (typeof payLoad === 'object');
if (payLoad) {
if (isObject) {
return new Promise((resolve, reject) => {
jwt.sign(payLoad, jwtSecret, { expiresIn: tokenExpirePeriod }, (error, token) => {
if (error) {
reject(error);
} else {
resolve(token);
}
});
})
} else {
const error = new TypeError('Token Payload Must Be An Object');
return Promise.reject(error);
}
} else {
const error = new Error('Token Payload Should Not Be Empty');
return Promise.reject(error);
}
}
function verifyToken(token) {
if (token) {
return new Promise((resolve, reject) => {
jwt.verify(token, jwtSecret, (error, decodedToken) => {
if (error) {
reject(error);
} else {
resolve(decodedToken);
}
});
})
} else {
const error = new Error('Token Should Not Be Empty');
return Promise.reject(error);
}
}
module.exports = {
generate: generateToken,
verify: verifyToken
};
| shivarajnaidu/uv-token-based-auth-with-nodejs-passportjs-mysql | app/lib/token.js | JavaScript | mit | 1,542 |
html {
background-color: white;
}
ul{
display: inline-block;
}
.listone{
margin-left: 75px;
}
.listtwo{
margin-left: 50px;
}
li{
margin-bottom: 10px;
}
p{
font-size: 10px;
margin:0px;
}
h1 p{
text-align: center;
font-weight: bold;
}
h1{
border-bottom: 1px solid black;
padding-bottom: 10px;
}
div{
border-bottom: 1px solid black;
padding-bottom: 20px;
padding-top: 20px;
text-align: center;
}
/*
Reflect
What is important to know when linking an external file (like a stylesheet) to an HTML file?
What tricks did you use to help you with positioning? How hard was it to get the site as you wanted it?
What CSS did you use to modify the element style (like size, color, etc.)
Did you modify the HTML to include classes or ids? If so, which did you choose and why? If you didn't, how would you know which one to add to your HTML?
When you compared your site to the actual code base, which do you think had cleaner code that followed best practices and why?
*/ | amblount/phase-0 | week-3/stylesheets/my-berkshire-stylesheet.css | CSS | mit | 995 |
//
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: android/libcore/luni/src/main/java/org/apache/harmony/security/asn1/ASN1Enumerated.java
//
#ifndef _OrgApacheHarmonySecurityAsn1ASN1Enumerated_H_
#define _OrgApacheHarmonySecurityAsn1ASN1Enumerated_H_
#include "J2ObjC_header.h"
#include "org/apache/harmony/security/asn1/ASN1Primitive.h"
@class OrgApacheHarmonySecurityAsn1BerInputStream;
@class OrgApacheHarmonySecurityAsn1BerOutputStream;
/*!
@author Stepan M. Mishura
@version $Revision$
*/
/*!
@brief This class represents ASN.1 Enumerated type.
*/
@interface OrgApacheHarmonySecurityAsn1ASN1Enumerated : OrgApacheHarmonySecurityAsn1ASN1Primitive
#pragma mark Public
/*!
@brief Constructs ASN.1 Enumerated type
The constructor is provided for inheritance purposes
when there is a need to create a custom ASN.1 Enumerated type.
To get a default implementation it is recommended to use
getInstance() method.
*/
- (instancetype)init;
- (id)decodeWithOrgApacheHarmonySecurityAsn1BerInputStream:(OrgApacheHarmonySecurityAsn1BerInputStream *)inArg;
- (void)encodeContentWithOrgApacheHarmonySecurityAsn1BerOutputStream:(OrgApacheHarmonySecurityAsn1BerOutputStream *)outArg;
/*!
@brief Extracts array of bytes from BER input stream.
@return array of bytes
*/
- (id)getDecodedObjectWithOrgApacheHarmonySecurityAsn1BerInputStream:(OrgApacheHarmonySecurityAsn1BerInputStream *)inArg;
/*!
@brief Returns ASN.1 Enumerated type default implementation
The default implementation works with encoding
that is represented as byte array.
@return ASN.1 Enumerated type default implementation
*/
+ (OrgApacheHarmonySecurityAsn1ASN1Enumerated *)getInstance;
- (void)setEncodingContentWithOrgApacheHarmonySecurityAsn1BerOutputStream:(OrgApacheHarmonySecurityAsn1BerOutputStream *)outArg;
@end
J2OBJC_STATIC_INIT(OrgApacheHarmonySecurityAsn1ASN1Enumerated)
FOUNDATION_EXPORT void OrgApacheHarmonySecurityAsn1ASN1Enumerated_init(OrgApacheHarmonySecurityAsn1ASN1Enumerated *self);
FOUNDATION_EXPORT OrgApacheHarmonySecurityAsn1ASN1Enumerated *new_OrgApacheHarmonySecurityAsn1ASN1Enumerated_init() NS_RETURNS_RETAINED;
FOUNDATION_EXPORT OrgApacheHarmonySecurityAsn1ASN1Enumerated *OrgApacheHarmonySecurityAsn1ASN1Enumerated_getInstance();
J2OBJC_TYPE_LITERAL_HEADER(OrgApacheHarmonySecurityAsn1ASN1Enumerated)
#endif // _OrgApacheHarmonySecurityAsn1ASN1Enumerated_H_
| benf1977/j2objc-serialization-example | j2objc/include/org/apache/harmony/security/asn1/ASN1Enumerated.h | C | mit | 2,401 |
<!-- START REVOLUTION SLIDER 5.0 -->
<div id="slider_container" class="rev_slider_wrapper">
<div id="rev-slider" class="rev_slider" data-version="5.0">
<ul>
<li data-transition="slideremovedown">
<!-- MAIN IMAGE -->
<img src="<?php echo $this->common->theme_link(); ?>img/slider/revolution/slider01.jpg" alt="" width="1920" height="600">
<!-- LAYER NR. 1 -->
<div class="tp-caption captionHeadline3 text-shadow"
id="slide-51-layer-1"
data-x="['left','left','left','left']" data-hoffset="['80','80','80','80']"
data-y="['top','top','top','top']" data-voffset="['180','180','180','180']"
data-width="504"
data-height="133"
data-whitespace="normal"
data-transform_idle="o:1;"
data-transform_in="y:[100%];z:0;rX:0deg;rY:0;rZ:0;sX:1;sY:1;skX:0;skY:0;s:1500;e:Power3.easeInOut;"
data-transform_out="y:[100%];s:1000;s:1000;"
data-mask_in="x:0px;y:0px;s:inherit;e:inherit;"
data-mask_out="x:inherit;y:inherit;s:inherit;e:inherit;"
data-start="500"
data-splitin="none"
data-splitout="none"
data-responsive_offset="on"
style="z-index: 5; white-space: normal;">
Lulusan dijamin Kerja
</div>
<!-- LAYER NR. 2 -->
<div class="tp-caption captionButtonlink"
id="slide-400-layer-3"
data-x="['left','left','left','left']" data-hoffset="['85','85','85','85']"
data-y="['top','top','top','top']" data-voffset="['355','355','355','355']"
data-width="['auto','auto','auto','auto']"
data-height="['auto','auto','auto','auto']"
data-transform_idle="o:1;"
data-transform_in="x:right;s:2000;e:Power4.easeInOut;"
data-transform_out="s:1000;e:Power2.easeInOut;s:1000;e:Power2.easeInOut;"
data-start="700"
data-splitin="none"
data-splitout="none"
data-responsive_offset="on"
style="z-index: 6; white-space: nowrap;"><a href="#" class="btn btn-primary btn-icon">Learn more <i class="fa fa-link"></i></a>
</div>
<!-- <div class="tp-caption"
id="slide-400-layer-4"
data-x="['right','right','right','right']" data-hoffset="['200','200','150','200']"
data-y="['bottom','bottom','bottom','bottom']" data-voffset="['0','0','0','0']"
data-transform_idle="o:1;"
data-transform_in="y:[100%];z:0;rX:0deg;rY:0;rZ:0;sX:1;sY:1;skX:0;skY:0;s:1500;e:Power3.easeInOut;"
data-transform_out="y:[100%];s:1000;s:1000;"
data-start="2500"
data-splitin="none"
data-splitout="none"
data-responsive_offset="on"
style="z-index: 6; white-space: nowrap;">
<img src="<?php echo $this->common->theme_link(); ?>img/slider/revolution/workerno1.png" class="img-Construction" width="400" alt="">
</div> -->
</li>
<li data-transition="slideremovedown">
<!-- MAIN IMAGE -->
<img src="<?php echo $this->common->theme_link(); ?>img/slider/revolution/slider02.jpg" alt="" width="1920" height="600">
<!-- LAYER NR. 1 -->
<div class="tp-caption captionHeadline3 text-shadow"
id="slide-51-layer-1"
data-x="['left','left','left','left']" data-hoffset="['80','80','80','80']"
data-y="['top','top','top','top']" data-voffset="['180','180','180','180']"
data-width="700"
data-height="133"
data-whitespace="normal"
data-transform_idle="o:1;"
data-transform_in="y:[100%];z:0;rX:0deg;rY:0;rZ:0;sX:1;sY:1;skX:0;skY:0;s:1500;e:Power3.easeInOut;"
data-transform_out="y:[100%];s:1000;s:1000;"
data-mask_in="x:0px;y:0px;s:inherit;e:inherit;"
data-mask_out="x:inherit;y:inherit;s:inherit;e:inherit;"
data-start="500"
data-splitin="none"
data-splitout="none"
data-responsive_offset="on"
style="z-index: 5; white-space: normal;">
Fasilitas belajar lengkap
</div>
<!-- LAYER NR. 2 -->
<div class="tp-caption captionButtonlink"
id="slide-400-layer-3"
data-x="['left','left','left','left']" data-hoffset="['85','85','85','85']"
data-y="['top','top','top','top']" data-voffset="['355','355','355','355']"
data-width="['auto','auto','auto','auto']"
data-height="['auto','auto','auto','auto']"
data-transform_idle="o:1;"
data-transform_in="x:right;s:2000;e:Power4.easeInOut;"
data-transform_out="s:1000;e:Power2.easeInOut;s:1000;e:Power2.easeInOut;"
data-start="700"
data-splitin="none"
data-splitout="none"
data-responsive_offset="on"
style="z-index: 6; white-space: nowrap;"><a href="#" class="btn btn-primary btn-icon">Learn more <i class="fa fa-link"></i></a>
</div>
<div class="tp-caption"
id="slide-400-layer-4"
data-x="['right','right','right','right']" data-hoffset="['200','200','150','200']"
data-y="['bottom','bottom','bottom','bottom']" data-voffset="['0','0','0','0']"
data-transform_idle="o:1;"
data-transform_in="y:[100%];z:0;rX:0deg;rY:0;rZ:0;sX:1;sY:1;skX:0;skY:0;s:1500;e:Power3.easeInOut;"
data-transform_out="y:[100%];s:1000;s:1000;"
data-start="2500"
data-splitin="none"
data-splitout="none"
data-responsive_offset="on"
style="z-index: 6; white-space: nowrap;">
<img src="<?php echo $this->common->theme_link(); ?>img/slider/revolution/fitur01.png" class="img-Construction" width="400" alt="">
</div>
</li>
<li data-transition="slideremovedown">
<!-- MAIN IMAGE -->
<img src="<?php echo $this->common->theme_link(); ?>img/slider/revolution/slider03.jpg" alt="" width="1920" height="600">
<!-- LAYER NR. 1 -->
<div class="tp-caption captionHeadline3 text-shadow"
id="slide-51-layer-1"
data-x="['left','left','left','left']" data-hoffset="['80','80','80','80']"
data-y="['top','top','top','top']" data-voffset="['180','180','180','180']"
data-width="700"
data-height="133"
data-whitespace="normal"
data-transform_idle="o:1;"
data-transform_in="y:[100%];z:0;rX:0deg;rY:0;rZ:0;sX:1;sY:1;skX:0;skY:0;s:1500;e:Power3.easeInOut;"
data-transform_out="y:[100%];s:1000;s:1000;"
data-mask_in="x:0px;y:0px;s:inherit;e:inherit;"
data-mask_out="x:inherit;y:inherit;s:inherit;e:inherit;"
data-start="500"
data-splitin="none"
data-splitout="none"
data-responsive_offset="on"
style="z-index: 5; white-space: normal;">
Agen Langsung Cruiseline
</div>
<!-- LAYER NR. 2 -->
<div class="tp-caption captionButtonlink"
id="slide-400-layer-3"
data-x="['left','left','left','left']" data-hoffset="['85','85','85','85']"
data-y="['top','top','top','top']" data-voffset="['355','355','355','355']"
data-width="['auto','auto','auto','auto']"
data-height="['auto','auto','auto','auto']"
data-transform_idle="o:1;"
data-transform_in="x:right;s:2000;e:Power4.easeInOut;"
data-transform_out="s:1000;e:Power2.easeInOut;s:1000;e:Power2.easeInOut;"
data-start="700"
data-splitin="none"
data-splitout="none"
data-responsive_offset="on"
style="z-index: 6; white-space: nowrap;"><a href="#" class="btn btn-primary btn-icon">Learn more <i class="fa fa-link"></i></a>
</div>
<div class="tp-caption"
id="slide-400-layer-4"
data-x="['right','right','right','right']" data-hoffset="['200','200','150','200']"
data-y="['bottom','bottom','bottom','bottom']" data-voffset="['0','0','0','0']"
data-transform_idle="o:1;"
data-transform_in="y:[100%];z:0;rX:0deg;rY:0;rZ:0;sX:1;sY:1;skX:0;skY:0;s:1500;e:Power3.easeInOut;"
data-transform_out="y:[100%];s:1000;s:1000;"
data-start="2500"
data-splitin="none"
data-splitout="none"
data-responsive_offset="on"
style="z-index: 6; white-space: nowrap;">
<img src="<?php echo $this->common->theme_link(); ?>img/slider/revolution/fitur02.png" class="img-Construction" width="400" alt="">
</div>
</li>
</ul>
</div><!-- END REVOLUTION SLIDER -->
</div>
<!-- END OF SLIDER WRAPPER -->
<!-- Start contain wrapp -->
<div class="contain-wrapp gray-container padding-clear margin-mintop85 feature-Construction">
<div class="container">
<div class="icon-wrapp">
<div class="icon-boxline">
<i class="fa fa-home fa-3x fa-primary"></i>
<h5>Lulusan Dijamin Siap Kerja</h5>
<p>
Dengan dididik dan dilatih oleh instruktur berpengalaman luas di dalam dan luar negeri serta didukung oleh sarana yang lengkap serya kurikulum yang up to date dalam menjamin lulusan bosssignalfx siap kerja.
</p>
</div>
<div class="icon-boxline">
<i class="fa fa-wrench fa-3x fa-primary"></i>
<h5>Recruitmen Supporting Cruiseline</h5>
<p>
Poltenkas Denpasar adalah salah satu kampus yang ditunjuk sebagai Rekruitmen Supporting Partner untuk Royal Carribean Cruiseline, Carnival Cruiseline, dan MSC Cruiseline.
</p>
</div>
<div class="icon-boxline">
<i class="fa fa-group fa-3x fa-primary"></i>
<h5>Pendidikan Berkualitas dengan Harga Terjangkau</h5>
<p>
Dengan biaya kuliah yang terjangkau dan transparan. bosssignalfx mampu memberikan pendidikan bermutu tinggi dan tambahan keahlian seperti Fruit Carving, Bar Flair, Barista, Winecology, Banquet Service, Pastry Bakery, Event Organizer, E-Commerce.
</p>
</div>
</div>
</div>
</div>
<!-- End contain wrapp -->
<div class="clearfix"></div>
<!-- Start contain wrapp -->
<div class="contain-wrapp gray-container padding-bot40">
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="section-heading">
<h3>Build Your Future with Us!</h3>
<p>Doctus salutatus est ea, postea doming veritus in nec, sanctus fierent antiopam no pro</p>
<i class="fa fa-rocket"></i>
</div>
</div>
</div>
<div class="row marginbot30">
<div class="col-md-8 col-md-offset-2 text-center">
<p>
Quod assum persecuti ne eum. Et eam paulo menandri dissentiet. Mei eu altera offendit accusamus. Mel te sint verear deseruisse, cu graece disputando quo. Zril putent mel et, eam quot accusam ea. Quo voluptatibus signiferumque te, in partem argumentum honestatis duo.
</p>
<p><a href="#" class="btn btn-default">View our profile</a> <a href="#" class="btn btn-primary">View our services</a></p>
</div>
</div>
<div class="row">
<div class="col-md-10 col-md-offset-1 text-center">
<img src="<?php echo $this->common->theme_link(); ?>img/group.png" class="img-responsive" alt="" />
<div class="divider margintop-clear"></div>
</div>
</div>
<div class="row">
<div class="col-md-3 col-sm-6">
<div class="col-icon centered">
<i class="fa fa-tablet fa-2x icon-circle icon-bordered"></i>
<h5>Responsive</h5>
<p>
Cu nec salutandi voluptat teros definitionem ad ius, ut eam unumiunanios.
</p>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="col-icon centered">
<i class="fa fa-magic fa-2x icon-circle icon-bordered"></i>
<h5>Clean</h5>
<p>
Cu nec salutandi voluptat teros definitionem ad ius, ut eam unumiunanios.
</p>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="col-icon centered">
<i class="fa fa-flask fa-2x icon-circle icon-bordered"></i>
<h5>Bootstrap3</h5>
<p>
Cu nec salutandi voluptat teros definitionem ad ius, ut eam unumiunanios.
</p>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="col-icon centered">
<i class="fa fa-code fa-2x icon-circle icon-bordered"></i>
<h5>Valid code</h5>
<p>
Cu nec salutandi voluptat teros definitionem ad ius, ut eam unumiunanios.
</p>
</div>
</div>
</div>
</div>
</div>
<!-- End contain wrapp -->
<div class="clearfix"></div>
<!-- Start contain wrapp -->
<div id="portfolio" class="contain-wrapp paddingbot-clear">
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="section-heading">
<h3>Galeri Kami</h3>
<p>Adhuc doming placerat sea ut, graeci perfecto scriptorem nam</p>
<i class="fa fa-image"></i>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<!-- Start gallery filter -->
<ul class="filter-items">
<li><a href="#" data-filter="" class="active">All</a></li>
<li><a href="#" data-filter="web">Kampus Activity</a></li>
<li><a href="#" data-filter="graphic">Fasilitas</a></li>
<li><a href="#" data-filter="logo">Belajar Mengajar</a></li>
</ul>
<!-- End gallery filter -->
</div>
</div>
</div>
<!-- Start Images Gallery -->
<div class="fullwidth">
<div id="gallery" class="masonry gallery">
<div class="grid-sizer col-md-3 col-sm-6 col-xs-6"></div>
<!-- Start Gallery 01 -->
<div data-filter="web" class="grid-item col-md-3 col-sm-6 col-xs-6">
<div class="img-wrapper">
<div class="img-caption capZoomIn">
<a href="img/gallery/zoom980x980.jpg" data-pretty="prettyPhoto" class="zoomer"><i class="fa fa-search"></i></a>
<h5><a href="portfolio-detail.html">Vituperatoribus</a></h5>
<a href="#" class="img-categorie">Web design</a>
</div>
<img src="<?php echo $this->common->theme_link(); ?>img/gallery/380x380/img13.jpg" class="img-fullwidth" alt="" />
</div>
</div>
<!-- End Gallery 01 -->
<!-- Star Gallery 02 -->
<div data-filter="graphic" class="grid-item col-md-3 col-sm-6 col-xs-6">
<div class="img-wrapper">
<div class="img-caption capZoomIn">
<a href="img/gallery/zoom980x980.jpg" data-pretty="prettyPhoto" class="zoomer"><i class="fa fa-search"></i></a>
<h5><a href="portfolio-detail.html">Vituperatoribus</a></h5>
<a href="#" class="img-categorie">Web design</a>
</div>
<img src="<?php echo $this->common->theme_link(); ?>img/gallery/380x380/img14.jpg" class="img-fullwidth" alt="" />
</div>
</div>
<!-- End Gallery 02 -->
<!-- Start Gallery 03 -->
<div data-filter="app" class="grid-item col-md-3 col-sm-6 col-xs-6">
<div class="img-wrapper">
<div class="img-caption capZoomIn">
<a href="img/gallery/zoom980x980.jpg" data-pretty="prettyPhoto" class="zoomer"><i class="fa fa-search"></i></a>
<h5><a href="portfolio-detail.html">Persequeris</a></h5>
<a href="#" class="img-categorie">App design</a>
</div>
<img src="<?php echo $this->common->theme_link(); ?>img/gallery/380x380/img15.jpg" class="img-fullwidth" alt="" />
</div>
</div>
<!-- End Gallery 03 -->
<!-- Start Gallery 04 -->
<div data-filter="logo" class="grid-item col-md-3 col-sm-6 col-xs-6">
<div class="img-wrapper">
<div class="img-caption capZoomIn">
<a href="img/gallery/zoom980x980.jpg" data-pretty="prettyPhoto" class="zoomer"><i class="fa fa-search"></i></a>
<h5><a href="portfolio-detail.html">An ancillae</a></h5>
<a href="#" class="img-categorie">logo design</a>
</div>
<img src="<?php echo $this->common->theme_link(); ?>img/gallery/380x380/img16.jpg" class="img-fullwidth" alt="" />
</div>
</div>
<!-- End Gallery 04 -->
<!-- Start Gallery 05 -->
<div data-filter="logo" class="grid-item col-md-3 col-sm-6 col-xs-6">
<div class="img-wrapper">
<div class="img-caption capZoomIn">
<a href="img/gallery/zoom980x980.jpg" data-pretty="prettyPhoto" class="zoomer"><i class="fa fa-search"></i></a>
<h5><a href="portfolio-detail.html">Viris copiosae</a></h5>
<a href="#" class="img-categorie">logo design</a>
</div>
<img src="<?php echo $this->common->theme_link(); ?>img/gallery/380x380/img17.jpg" class="img-fullwidth" alt="" />
</div>
</div>
<!-- End Gallery 05 -->
<!-- Start Gallery 06 -->
<div data-filter="web" class="grid-item col-md-3 col-sm-6 col-xs-6">
<div class="img-wrapper">
<div class="img-caption capZoomIn">
<a href="img/gallery/zoom980x980.jpg" data-pretty="prettyPhoto" class="zoomer"><i class="fa fa-search"></i></a>
<h5><a href="portfolio-detail.html">Reprimique</a></h5>
<a href="#" class="img-categorie">Web design</a>
</div>
<img src="<?php echo $this->common->theme_link(); ?>img/gallery/380x380/img18.jpg" class="img-fullwidth" alt="" />
</div>
</div>
<!-- End Gallery 06 -->
<!-- Start Gallery 07 -->
<div data-filter="graphic" class="grid-item col-md-3 col-sm-6 col-xs-6">
<div class="img-wrapper">
<div class="img-caption capZoomIn">
<a href="img/gallery/zoom980x980.jpg" data-pretty="prettyPhoto" class="zoomer"><i class="fa fa-search"></i></a>
<h5><a href="portfolio-detail.html">Simul labitur</a></h5>
<a href="#" class="img-categorie">Graphic design</a>
</div>
<img src="<?php echo $this->common->theme_link(); ?>img/gallery/380x380/img19.jpg" class="img-fullwidth" alt="" />
</div>
</div>
<!-- End Gallery 07 -->
<!-- Start Gallery 08 -->
<div data-filter="app" class="grid-item col-md-3 col-sm-6 col-xs-6">
<div class="img-wrapper">
<div class="img-caption capZoomIn">
<a href="img/gallery/zoom980x980.jpg" data-pretty="prettyPhoto" class="zoomer"><i class="fa fa-search"></i></a>
<h5><a href="portfolio-detail.html">Consetetur</a></h5>
<a href="#" class="img-categorie">App design</a>
</div>
<img src="<?php echo $this->common->theme_link(); ?>img/gallery/380x380/img20.jpg" class="img-fullwidth" alt="" />
</div>
</div>
<!-- End Gallery 08 -->
</div>
<div class="row">
<div class="col-md-12">
<a href="portfolio-alt1.html" class="btn btn-primary btn-lg btn-block">View more Gallery</a>
</div>
</div>
</div>
<!-- End Images Gallery -->
<!-- End contain wrapp -->
<div class="clearfix"></div>
<!-- Start parallax -->
<div class="parallax parallax-two bg3">
<div class="parallax-container padding-bot30">
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2 owl-column-wrapp">
<div id="testimoni" class="owl-carousel">
<div class="item">
<div class="testimoni-single">
<blockquote class="centered">
Kemampuan Alumni bosssignalfx Dalam Bekerja Tidak Perlu Diragukan Lagi Karena Selain Cekatan Juga Fast Learner, Saya Mencari Staf Yang Seperti Itu Dan Itulah Yang Dibutuhkan Industri Saat Ini.
</blockquote>
<span class="block"><a href="#">Tusan Aryasa</a> - Housekeeper Estate Como Shambhala Executive </span>
<img src="<?php echo $this->common->theme_link(); ?>img/testimoni/tusan.jpg" class="img-circle testimoni-avatar" alt="" />
</div>
</div>
<div class="item">
<div class="testimoni-single">
<blockquote class="centered">
Saya Merekomendasi bosssignalfx Sebagai Tempat Anda Kuliah Perhotelan Karena Terbukti Dari Mahasiswa Yang On The Job Training Di Tempat Kami Menunjukkan Sikap Yang Loyal & Hardworker.
</blockquote>
<span class="block"><a href="#">Sukarmajaya</a> - Executive Chef The Villas, Seminyak </span>
<img src="<?php echo $this->common->theme_link(); ?>img/testimoni/sukarmajaya.jpg" class="img-circle testimoni-avatar" alt="" />
</div>
</div>
<div class="item">
<div class="testimoni-single">
<blockquote class="centered">
Dari Berbagai Kampus Yang Mahasiswanya On The Job Trainng Di Tempat Kami bosssignalfx Selalu Memberikan Mahasiswa Yang Terbaik Dalam Hal Disiplin & Teamwork. Thank’s bosssignalfx.
</blockquote>
<span class="block"><a href="#">Ni Made Restiti</a> - Personnel Manager UN'S Hotel & Restaurant, Legian - Kuta</span>
<img src="<?php echo $this->common->theme_link(); ?>img/testimoni/restiti.jpg" class="img-circle testimoni-avatar" alt="" />
</div>
</div>
<div class="item">
<div class="testimoni-single">
<blockquote class="centered">
Saya Ucapkan Terima Kasih Yang Banyak Kepada bosssignalfx Yang Telah Memberikan Tenaga Training Handal Dan Cepat Beradaptasi Dengan Pola Kerja High Speed Di Beach Club Kami. </blockquote>
<span class="block"><a href="#"> I Made Dwi Artha Pradnya</a> - Asst. Restaurant Manager Potato Head Beach Club Seminyak- Kuta</span>
<img src="<?php echo $this->common->theme_link(); ?>img/testimoni/dwi.jpg" class="img-circle testimoni-avatar" alt="" />
</div>
</div>
<div class="item">
<div class="testimoni-single">
<blockquote class="centered">
bosssignalfx Selalu Mensupport Untuk Tenaga Training Di Hotel Kami, Kami Pilih bosssignalfx Karena Tenaganya Siap Pakai, Disiplin & Memiliki Positive Attitude. </blockquote>
<span class="block"><a href="#">I Made Wirta</a> - Executive Housekeeper Amarterra Villas Bali By Accor, Nusa Dua</span>
<img src="<?php echo $this->common->theme_link(); ?>img/testimoni/wirta.jpg" class="img-circle testimoni-avatar" alt="" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End parallax -->
<div class="clearfix"></div>
<!-- Start cta primary -->
<div class="cta-wrapper cta-primary">
<div class="container">
<div class="row">
<div class="col-md-12">
<h4>Ayo Daftar Sekarang</h4>
<p>Mari bergabung dengan ratusan alumni lain.</p>
<a class="btn" href="#">Daftar Sekarang!</a>
</div>
</div>
</div>
</div>
<!-- End cta primary -->
<div class="clearfix"></div>
| dodeagung/KLGH | public_html/application/views/frontpage/home_view.php | PHP | mit | 24,501 |
<?php
namespace AppBundle\Form;
use AppBundle\AppBundle;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ProductType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name')
->add('price')
->add('productType')
;
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'AppBundle\Entity\Product'
));
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'appbundle_product';
}
}
| Bunkermaster/exosymfony | src/AppBundle/Form/ProductType.php | PHP | mit | 885 |
---
layout: post
date: 2016-10-16
title: "Sherri Hill Prom Dresses Style 32176 Sleeveless Sweep/Brush Train Aline/Princess"
category: Sherri Hill
tags: [Sherri Hill ,Sherri Hill,Aline/Princess ,Strapless,Sweep/Brush Train,Sleeveless]
---
### Sherri Hill Prom Dresses Style 32176
Just **$399.99**
### Sleeveless Sweep/Brush Train Aline/Princess
<table><tr><td>BRANDS</td><td>Sherri Hill</td></tr><tr><td>Silhouette</td><td>Aline/Princess </td></tr><tr><td>Neckline</td><td>Strapless</td></tr><tr><td>Hemline/Train</td><td>Sweep/Brush Train</td></tr><tr><td>Sleeve</td><td>Sleeveless</td></tr></table>
<a href="https://www.readybrides.com/en/sherri-hill-/50396-sherri-hill-prom-dresses-style-32176.html"><img src="//img.readybrides.com/116196/sherri-hill-prom-dresses-style-32176.jpg" alt="Sherri Hill Prom Dresses Style 32176" style="width:100%;" /></a>
<!-- break --><a href="https://www.readybrides.com/en/sherri-hill-/50396-sherri-hill-prom-dresses-style-32176.html"><img src="//img.readybrides.com/116195/sherri-hill-prom-dresses-style-32176.jpg" alt="Sherri Hill Prom Dresses Style 32176" style="width:100%;" /></a>
Buy it: [https://www.readybrides.com/en/sherri-hill-/50396-sherri-hill-prom-dresses-style-32176.html](https://www.readybrides.com/en/sherri-hill-/50396-sherri-hill-prom-dresses-style-32176.html)
| nicedaymore/nicedaymore.github.io | _posts/2016-10-16-Sherri-Hill-Prom-Dresses-Style-32176-Sleeveless-SweepBrush-Train-AlinePrincess.md | Markdown | mit | 1,321 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from conans.model import Generator
from conans.client.generators import VisualStudioGenerator
from xml.dom import minidom
from conans.util.files import load
class VisualStudioMultiGenerator(Generator):
template = """<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" >
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup />
<ItemGroup />
</Project>
"""
@property
def filename(self):
pass
@property
def content(self):
configuration = str(self.conanfile.settings.build_type)
platform = {'x86': 'Win32', 'x86_64': 'x64'}.get(str(self.conanfile.settings.arch))
vsversion = str(self.settings.compiler.version)
# there is also ClCompile.RuntimeLibrary, but it's handling is a bit complicated, so skipping for now
condition = " '$(Configuration)' == '%s' And '$(Platform)' == '%s' And '$(VisualStudioVersion)' == '%s' "\
% (configuration, platform, vsversion + '.0')
name_multi = 'conanbuildinfo_multi.props'
name_current = ('conanbuildinfo_%s_%s_%s.props' % (configuration, platform, vsversion)).lower()
multi_path = os.path.join(self.output_path, name_multi)
if os.path.isfile(multi_path):
content_multi = load(multi_path)
else:
content_multi = self.template
dom = minidom.parseString(content_multi)
import_node = dom.createElement('Import')
import_node.setAttribute('Condition', condition)
import_node.setAttribute('Project', name_current)
import_group = dom.getElementsByTagName('ImportGroup')[0]
children = import_group.getElementsByTagName("Import")
for node in children:
if name_current == node.getAttribute("Project") and condition == node.getAttribute("Condition"):
break
else:
import_group.appendChild(import_node)
content_multi = dom.toprettyxml()
content_multi = "\n".join(line for line in content_multi.splitlines() if line.strip())
vs_generator = VisualStudioGenerator(self.conanfile)
content_current = vs_generator.content
return {name_multi: content_multi, name_current: content_current}
| lasote/conan | conans/client/generators/visualstudio_multi.py | Python | mit | 2,436 |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class M_slider extends Main_model {
function __construct() {
parent::__construct();
$this->table = array(
'name' => 'tbl_slider',
'coloumn' => array(
'slider_id' => array('id'=>'slider_id', 'label'=>'ID', 'idkey'=>true, 'visible'=>false, 'field_visible'=>true, 'format'=>'HIDDEN'),
'slider_name' => array('id'=>'slider_name', 'label'=>'Slider Name', 'idkey'=>false, 'visible'=>true, 'field_visible'=>true, 'format'=>'TEXT'),
'slider_publish' => array('id'=>'slider_publish', 'label'=>'Date Publish', 'idkey'=>false, 'visible'=>true, 'field_visible'=>true, 'format'=>'TEXT'),
'slider_expire' => array('id'=>'slider_expire', 'label'=>'Date Expired', 'idkey'=>false, 'visible'=>true, 'field_visible'=>true, 'format'=>'TEXT'),
'slider_images' => array('id'=>'slider_images', 'label'=>'Image', 'idkey'=>false, 'visible'=>false, 'field_visible'=>true, 'format'=>'FILE'),
),
'join' =>array(
),
'where' => array(),
'keys' => 'slider_id',
'option_name' => ''
);
}
function fields()
{
$data = array();
return $data;
}
function getlist($params)
{
$list = $this->getListData($params);
$nomor = $params['start'];
$data['records'] = array();
foreach($list['records']->result() as $row):
$actions = '';
$actions .= '<a data-id="'.$row->slider_id.'" data-target="form_modal_slider" data-toggle="modal" class="btn btn-xs btn-success btn-editable"><i class="glyphicon glyphicon-edit"></i>Ubah</a>';
$actions .= '<a data-id="'.$row->slider_id.'" class="btn btn-xs btn-danger btn-removable"><i class="glyphicon glyphicon-trash"></i>Hapus</a>';
$data['records'][] = array(
$nomor+1,
$row->slider_name,
$row->slider_publish,
$row->slider_expire,
$actions
);
$nomor++;
endforeach;
$data['total'] = $list['total'];
$data['total_filter'] = $list['total_filter'];
return $data;
}
} | dwivivagoal/KuizMilioner | application/modules/webadmin/models/M_slider.php | PHP | mit | 2,465 |
# Digits
- [Data source](https://archive.ics.uci.edu/ml/datasets/Optical+Recognition+of+Handwritten+Digits)
- Train dataset: Samples: 3823 Attributes: 65
- Test dataset: Samples: 1,797 Attributes: 65
- Dont use first column
- Target column: last column (class 0-9)
- Additional preprocessing needed: feature scaling
| pplonski/datasets-for-start | digits/README.md | Markdown | mit | 324 |
package org.katlas.JavaKh.rows;
import org.katlas.JavaKh.utils.RedBlackIntegerTree;
public class RedBlackIntegerMap<F> extends RedBlackIntegerTree<F> implements MatrixRow<F> {
/**
*
*/
private static final long serialVersionUID = 5885667469881867107L;
public void compact() {
}
public void putLast(int key, F f) {
put(key, f);
}
@Override
public void put(int key, F value) {
if(value == null) {
remove(key);
} else {
super.put(key, value);
}
}
}
| craigfreilly/masters-project-submission | src/KnotTheory/JavaKh-v2/src/org/katlas/JavaKh/rows/RedBlackIntegerMap.java | Java | mit | 518 |
---
title: DataCite Member Mailing List Subscription
layout: service
---
# Thank you for subscribing to the DataCite Member Mailing List
This confirms that you have succesfully subscribed to the DataCite Member Mailing List. Please contact [email protected] should you have any queries. For further information about our privacy practices please review our Privacy Policy.
| datacite/homepage | source/subscription.html.md | Markdown | mit | 375 |
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.mediaservices.v2018_07_01;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The ListEdgePoliciesInput model.
*/
public class ListEdgePoliciesInput {
/**
* Unique identifier of the edge device.
*/
@JsonProperty(value = "deviceId")
private String deviceId;
/**
* Get unique identifier of the edge device.
*
* @return the deviceId value
*/
public String deviceId() {
return this.deviceId;
}
/**
* Set unique identifier of the edge device.
*
* @param deviceId the deviceId value to set
* @return the ListEdgePoliciesInput object itself.
*/
public ListEdgePoliciesInput withDeviceId(String deviceId) {
this.deviceId = deviceId;
return this;
}
}
| selvasingh/azure-sdk-for-java | sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/ListEdgePoliciesInput.java | Java | mit | 1,044 |
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* jkl
*/
package com.microsoft.azure.management.apimanagement.v2019_12_01.implementation;
import com.microsoft.azure.arm.model.implementation.WrapperImpl;
import com.microsoft.azure.management.apimanagement.v2019_12_01.Loggers;
import rx.Completable;
import rx.functions.Func1;
import rx.Observable;
import com.microsoft.azure.Page;
import com.microsoft.azure.management.apimanagement.v2019_12_01.LoggerContract;
class LoggersImpl extends WrapperImpl<LoggersInner> implements Loggers {
private final ApiManagementManager manager;
LoggersImpl(ApiManagementManager manager) {
super(manager.inner().loggers());
this.manager = manager;
}
public ApiManagementManager manager() {
return this.manager;
}
@Override
public LoggerContractImpl define(String name) {
return wrapModel(name);
}
private LoggerContractImpl wrapModel(LoggerContractInner inner) {
return new LoggerContractImpl(inner, manager());
}
private LoggerContractImpl wrapModel(String name) {
return new LoggerContractImpl(name, this.manager());
}
@Override
public Observable<LoggerContract> listByServiceAsync(final String resourceGroupName, final String serviceName) {
LoggersInner client = this.inner();
return client.listByServiceAsync(resourceGroupName, serviceName)
.flatMapIterable(new Func1<Page<LoggerContractInner>, Iterable<LoggerContractInner>>() {
@Override
public Iterable<LoggerContractInner> call(Page<LoggerContractInner> page) {
return page.items();
}
})
.map(new Func1<LoggerContractInner, LoggerContract>() {
@Override
public LoggerContract call(LoggerContractInner inner) {
return new LoggerContractImpl(inner, manager());
}
});
}
@Override
public Completable getEntityTagAsync(String resourceGroupName, String serviceName, String loggerId) {
LoggersInner client = this.inner();
return client.getEntityTagAsync(resourceGroupName, serviceName, loggerId).toCompletable();
}
@Override
public Observable<LoggerContract> getAsync(String resourceGroupName, String serviceName, String loggerId) {
LoggersInner client = this.inner();
return client.getAsync(resourceGroupName, serviceName, loggerId)
.map(new Func1<LoggerContractInner, LoggerContract>() {
@Override
public LoggerContract call(LoggerContractInner inner) {
return new LoggerContractImpl(inner, manager());
}
});
}
@Override
public Completable deleteAsync(String resourceGroupName, String serviceName, String loggerId, String ifMatch) {
LoggersInner client = this.inner();
return client.deleteAsync(resourceGroupName, serviceName, loggerId, ifMatch).toCompletable();
}
}
| selvasingh/azure-sdk-for-java | sdk/apimanagement/mgmt-v2019_12_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_12_01/implementation/LoggersImpl.java | Java | mit | 3,159 |
<?php
/**
* Created by PhpStorm.
* User: jmannion
* Date: 04/08/14
* Time: 22:17
*/
namespace JamesMannion\ForumBundle\Form\User;
use Symfony\Component\Form\FormBuilderInterface;
use JamesMannion\ForumBundle\Constants\Label;
use JamesMannion\ForumBundle\Constants\Button;
use JamesMannion\ForumBundle\Constants\Validation;
use Doctrine\ORM\EntityRepository;
use Symfony\Component\Form\AbstractType;
class UserCreateForm extends AbstractType {
private $name = 'userCreateForm';
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add(
'username',
'text',
array(
'mapped' => true,
'required' => true,
'label' => Label::REGISTRATION_USERNAME,
'max_length' => 100,
)
)
->add(
'email',
'repeated',
array(
'type' => 'email',
'mapped' => true,
'required' => true,
'max_length' => 100,
'invalid_message' => Validation::REGISTRATION_EMAIL_MATCH,
'first_options' => array(
'label' => Label::REGISTRATION_EMAIL,
),
'second_options' => array(
'label' => Label::REGISTRATION_REPEAT_EMAIL),
)
)
->add(
'password',
'repeated',
array(
'mapped' => true,
'type' => 'password',
'required' => true,
'max_length' => 100,
'invalid_message' => Validation::REGISTRATION_PASSWORD_MATCH,
'first_options' => array('label' => Label::REGISTRATION_PASSWORD),
'second_options' => array('label' => Label::REGISTRATION_REPEAT_PASSWORD)
)
)
->add(
'memorableQuestion',
'entity',
array(
'mapped' => true,
'required' => true,
'label' => Label::REGISTRATION_MEMORABLE_QUESTION,
'class' => 'JamesMannionForumBundle:MemorableQuestion',
'query_builder' =>
function(EntityRepository $er) {
return $er->createQueryBuilder('q')
->orderBy('q.question', 'ASC');
}
)
)
->add(
'memorableAnswer',
'text',
array(
'mapped' => true,
'required' => true,
'label' => Label::REGISTRATION_MEMORABLE_ANSWER,
'max_length' => 100,
)
)
->add(
'save',
'submit',
array(
'label' => Button::REGISTRATION_SUBMIT
)
);
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
} | mannion007/JamesMannionForum | src/JamesMannion/ForumBundle/Form/User/UserCreateForm.php | PHP | mit | 3,204 |
/**
* @file main.c
* @brief Main routine
*
* @section License
*
* Copyright (C) 2010-2015 Oryx Embedded SARL. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @author Oryx Embedded SARL (www.oryx-embedded.com)
* @version 1.6.4
**/
//Dependencies
#include <stdlib.h>
#include "stm32f4xx.h"
#include "stm32f4_discovery.h"
#include "stm32f4_discovery_lcd.h"
#include "os_port.h"
#include "core/net.h"
#include "drivers/stm32f4x7_eth.h"
#include "drivers/lan8720.h"
#include "dhcp/dhcp_client.h"
#include "ipv6/slaac.h"
#include "smtp/smtp_client.h"
#include "yarrow.h"
#include "error.h"
#include "debug.h"
//Application configuration
#define APP_MAC_ADDR "00-AB-CD-EF-04-07"
#define APP_USE_DHCP ENABLED
#define APP_IPV4_HOST_ADDR "192.168.0.20"
#define APP_IPV4_SUBNET_MASK "255.255.255.0"
#define APP_IPV4_DEFAULT_GATEWAY "192.168.0.254"
#define APP_IPV4_PRIMARY_DNS "8.8.8.8"
#define APP_IPV4_SECONDARY_DNS "8.8.4.4"
#define APP_USE_SLAAC ENABLED
#define APP_IPV6_LINK_LOCAL_ADDR "fe80::407"
#define APP_IPV6_PREFIX "2001:db8::"
#define APP_IPV6_PREFIX_LENGTH 64
#define APP_IPV6_GLOBAL_ADDR "2001:db8::407"
#define APP_IPV6_ROUTER "fe80::1"
#define APP_IPV6_PRIMARY_DNS "2001:4860:4860::8888"
#define APP_IPV6_SECONDARY_DNS "2001:4860:4860::8844"
//Global variables
uint_t lcdLine = 0;
uint_t lcdColumn = 0;
DhcpClientSettings dhcpClientSettings;
DhcpClientCtx dhcpClientContext;
SlaacSettings slaacSettings;
SlaacContext slaacContext;
YarrowContext yarrowContext;
uint8_t seed[32];
/**
* @brief Set cursor location
* @param[in] line Line number
* @param[in] column Column number
**/
void lcdSetCursor(uint_t line, uint_t column)
{
lcdLine = MIN(line, 10);
lcdColumn = MIN(column, 20);
}
/**
* @brief Write a character to the LCD display
* @param[in] c Character to be written
**/
void lcdPutChar(char_t c)
{
if(c == '\r')
{
lcdColumn = 0;
}
else if(c == '\n')
{
lcdColumn = 0;
lcdLine++;
}
else if(lcdLine < 10 && lcdColumn < 20)
{
//Display current character
LCD_DisplayChar(lcdLine * 24, lcdColumn * 16, c);
//Advance the cursor position
if(++lcdColumn >= 20)
{
lcdColumn = 0;
lcdLine++;
}
}
}
/**
* @brief I/O initialization
**/
void ioInit(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
//LED configuration
STM_EVAL_LEDInit(LED3);
STM_EVAL_LEDInit(LED4);
STM_EVAL_LEDInit(LED5);
STM_EVAL_LEDInit(LED6);
//Clear LEDs
STM_EVAL_LEDOff(LED3);
STM_EVAL_LEDOff(LED4);
STM_EVAL_LEDOff(LED5);
STM_EVAL_LEDOff(LED6);
//Initialize user button
STM_EVAL_PBInit(BUTTON_USER, BUTTON_MODE_GPIO);
//Enable GPIOE clock
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE);
//Configure PE2 (PHY_RST) pin as an output
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOE, &GPIO_InitStructure);
//Reset PHY transceiver (hard reset)
GPIO_ResetBits(GPIOE, GPIO_Pin_2);
sleep(10);
GPIO_SetBits(GPIOE, GPIO_Pin_2);
sleep(10);
}
/**
* @brief SMTP client test routine
* @return Error code
**/
error_t smtpClientTest(void)
{
error_t error;
//Authentication information
static SmtpAuthInfo authInfo =
{
NULL, //Network interface
"smtp.gmail.com", //SMTP server name
25, //SMTP server port
"username", //User name
"password", //Password
FALSE, //Use STARTTLS rather than implicit TLS
YARROW_PRNG_ALGO, //PRNG algorithm
&yarrowContext //PRNG context
};
//Recipients
static SmtpMailAddr recipients[2] =
{
{"Alice", "[email protected]", SMTP_RCPT_TYPE_TO}, //First recipient
{"Bob", "[email protected]", SMTP_RCPT_TYPE_CC} //Second recipient
};
//Mail contents
static SmtpMail mail =
{
{"Charlie", "[email protected]"}, //From
recipients, //Recipients
2, //Recipient count
"", //Date
"SMTP Client Demo", //Subject
"Hello World!" //Body
};
//Send mail
error = smtpSendMail(&authInfo, &mail);
//Return status code
return error;
}
/**
* @brief User task
**/
void userTask(void *param)
{
char_t buffer[40];
//Point to the network interface
NetInterface *interface = &netInterface[0];
//Initialize LCD display
lcdSetCursor(2, 0);
printf("IPv4 Addr\r\n");
lcdSetCursor(5, 0);
printf("Press user button\r\nto run test\r\n");
//Endless loop
while(1)
{
//Display IPv4 host address
lcdSetCursor(3, 0);
printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));
//User button pressed?
if(STM_EVAL_PBGetState(BUTTON_USER))
{
//SMTP client test routine
smtpClientTest();
//Wait for the user button to be released
while(STM_EVAL_PBGetState(BUTTON_USER));
}
//Loop delay
osDelayTask(100);
}
}
/**
* @brief LED blinking task
**/
void blinkTask(void *parameters)
{
//Endless loop
while(1)
{
STM_EVAL_LEDOn(LED4);
osDelayTask(100);
STM_EVAL_LEDOff(LED4);
osDelayTask(900);
}
}
/**
* @brief Main entry point
* @return Unused value
**/
int_t main(void)
{
error_t error;
uint_t i;
uint32_t value;
NetInterface *interface;
OsTask *task;
MacAddr macAddr;
#if (APP_USE_DHCP == DISABLED)
Ipv4Addr ipv4Addr;
#endif
#if (APP_USE_SLAAC == DISABLED)
Ipv6Addr ipv6Addr;
#endif
//Initialize kernel
osInitKernel();
//Configure debug UART
debugInit(115200);
//Start-up message
TRACE_INFO("\r\n");
TRACE_INFO("***********************************\r\n");
TRACE_INFO("*** CycloneTCP SMTP Client Demo ***\r\n");
TRACE_INFO("***********************************\r\n");
TRACE_INFO("Copyright: 2010-2015 Oryx Embedded SARL\r\n");
TRACE_INFO("Compiled: %s %s\r\n", __DATE__, __TIME__);
TRACE_INFO("Target: STM32F407\r\n");
TRACE_INFO("\r\n");
//Configure I/Os
ioInit();
//Initialize LCD display
STM32f4_Discovery_LCD_Init();
LCD_SetBackColor(Blue);
LCD_SetTextColor(White);
LCD_SetFont(&Font16x24);
LCD_Clear(Blue);
//Welcome message
lcdSetCursor(0, 0);
printf("SMTP Client Demo\r\n");
//Enable RNG peripheral clock
RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_RNG, ENABLE);
//Enable RNG
RNG_Cmd(ENABLE);
//Generate a random seed
for(i = 0; i < 32; i += 4)
{
//Wait for the RNG to contain a valid data
while(RNG_GetFlagStatus(RNG_FLAG_DRDY) == RESET);
//Get 32-bit random value
value = RNG_GetRandomNumber();
//Copy random value
seed[i] = value & 0xFF;
seed[i + 1] = (value >> 8) & 0xFF;
seed[i + 2] = (value >> 16) & 0xFF;
seed[i + 3] = (value >> 24) & 0xFF;
}
//PRNG initialization
error = yarrowInit(&yarrowContext);
//Any error to report?
if(error)
{
//Debug message
TRACE_ERROR("Failed to initialize PRNG!\r\n");
}
//Properly seed the PRNG
error = yarrowSeed(&yarrowContext, seed, sizeof(seed));
//Any error to report?
if(error)
{
//Debug message
TRACE_ERROR("Failed to seed PRNG!\r\n");
}
//TCP/IP stack initialization
error = netInit();
//Any error to report?
if(error)
{
//Debug message
TRACE_ERROR("Failed to initialize TCP/IP stack!\r\n");
}
//Configure the first Ethernet interface
interface = &netInterface[0];
//Set interface name
netSetInterfaceName(interface, "eth0");
//Set host name
netSetHostname(interface, "SMTPClientDemo");
//Select the relevant network adapter
netSetDriver(interface, &stm32f4x7EthDriver);
netSetPhyDriver(interface, &lan8720PhyDriver);
//Set host MAC address
macStringToAddr(APP_MAC_ADDR, &macAddr);
netSetMacAddr(interface, &macAddr);
//Initialize network interface
error = netConfigInterface(interface);
//Any error to report?
if(error)
{
//Debug message
TRACE_ERROR("Failed to configure interface %s!\r\n", interface->name);
}
#if (IPV4_SUPPORT == ENABLED)
#if (APP_USE_DHCP == ENABLED)
//Get default settings
dhcpClientGetDefaultSettings(&dhcpClientSettings);
//Set the network interface to be configured by DHCP
dhcpClientSettings.interface = interface;
//Disable rapid commit option
dhcpClientSettings.rapidCommit = FALSE;
//DHCP client initialization
error = dhcpClientInit(&dhcpClientContext, &dhcpClientSettings);
//Failed to initialize DHCP client?
if(error)
{
//Debug message
TRACE_ERROR("Failed to initialize DHCP client!\r\n");
}
//Start DHCP client
error = dhcpClientStart(&dhcpClientContext);
//Failed to start DHCP client?
if(error)
{
//Debug message
TRACE_ERROR("Failed to start DHCP client!\r\n");
}
#else
//Set IPv4 host address
ipv4StringToAddr(APP_IPV4_HOST_ADDR, &ipv4Addr);
ipv4SetHostAddr(interface, ipv4Addr);
//Set subnet mask
ipv4StringToAddr(APP_IPV4_SUBNET_MASK, &ipv4Addr);
ipv4SetSubnetMask(interface, ipv4Addr);
//Set default gateway
ipv4StringToAddr(APP_IPV4_DEFAULT_GATEWAY, &ipv4Addr);
ipv4SetDefaultGateway(interface, ipv4Addr);
//Set primary and secondary DNS servers
ipv4StringToAddr(APP_IPV4_PRIMARY_DNS, &ipv4Addr);
ipv4SetDnsServer(interface, 0, ipv4Addr);
ipv4StringToAddr(APP_IPV4_SECONDARY_DNS, &ipv4Addr);
ipv4SetDnsServer(interface, 1, ipv4Addr);
#endif
#endif
#if (IPV6_SUPPORT == ENABLED)
#if (APP_USE_SLAAC == ENABLED)
//Get default settings
slaacGetDefaultSettings(&slaacSettings);
//Set the network interface to be configured
slaacSettings.interface = interface;
//SLAAC initialization
error = slaacInit(&slaacContext, &slaacSettings);
//Failed to initialize SLAAC?
if(error)
{
//Debug message
TRACE_ERROR("Failed to initialize SLAAC!\r\n");
}
//Start IPv6 address autoconfiguration process
error = slaacStart(&slaacContext);
//Failed to start SLAAC process?
if(error)
{
//Debug message
TRACE_ERROR("Failed to start SLAAC!\r\n");
}
#else
//Set link-local address
ipv6StringToAddr(APP_IPV6_LINK_LOCAL_ADDR, &ipv6Addr);
ipv6SetLinkLocalAddr(interface, &ipv6Addr);
//Set IPv6 prefix
ipv6StringToAddr(APP_IPV6_PREFIX, &ipv6Addr);
ipv6SetPrefix(interface, &ipv6Addr, APP_IPV6_PREFIX_LENGTH);
//Set global address
ipv6StringToAddr(APP_IPV6_GLOBAL_ADDR, &ipv6Addr);
ipv6SetGlobalAddr(interface, &ipv6Addr);
//Set router
ipv6StringToAddr(APP_IPV6_ROUTER, &ipv6Addr);
ipv6SetRouter(interface, &ipv6Addr);
//Set primary and secondary DNS servers
ipv6StringToAddr(APP_IPV6_PRIMARY_DNS, &ipv6Addr);
ipv6SetDnsServer(interface, 0, &ipv6Addr);
ipv6StringToAddr(APP_IPV6_SECONDARY_DNS, &ipv6Addr);
ipv6SetDnsServer(interface, 1, &ipv6Addr);
#endif
#endif
//Create user task
task = osCreateTask("User Task", userTask, NULL, 800, 1);
//Failed to create the task?
if(task == OS_INVALID_HANDLE)
{
//Debug message
TRACE_ERROR("Failed to create task!\r\n");
}
//Create a task to blink the LED
task = osCreateTask("Blink", blinkTask, NULL, 500, 1);
//Failed to create the task?
if(task == OS_INVALID_HANDLE)
{
//Debug message
TRACE_ERROR("Failed to create task!\r\n");
}
//Start the execution of tasks
osStartKernel();
//This function should never return
return 0;
}
| miragecentury/M2_SE_RTOS_Project | Project/LPC1549_Keil/CycloneTCP_SSL_Crypto_Open_1_6_4/demo/st/stm32f4_discovery/smtp_client_demo/src/main.c | C | mit | 12,503 |
### Standalone SearchBox
```jsx
const { compose, withProps, lifecycle } = require("recompose");
const {
withScriptjs,
} = require("react-google-maps");
const { StandaloneSearchBox } = require("react-google-maps/lib/components/places/StandaloneSearchBox");
const PlacesWithStandaloneSearchBox = compose(
withProps({
googleMapURL: "https://maps.googleapis.com/maps/api/js?key=AIzaSyC4R6AN7SmujjPUIGKdyao2Kqitzr1kiRg&v=3.exp&libraries=geometry,drawing,places",
loadingElement: <div style={{ height: `100%` }} />,
containerElement: <div style={{ height: `400px` }} />,
}),
lifecycle({
componentWillMount() {
const refs = {}
this.setState({
places: [],
onSearchBoxMounted: ref => {
refs.searchBox = ref;
},
onPlacesChanged: () => {
const places = refs.searchBox.getPlaces();
this.setState({
places,
});
},
})
},
}),
withScriptjs
)(props =>
<div data-standalone-searchbox="">
<StandaloneSearchBox
ref={props.onSearchBoxMounted}
bounds={props.bounds}
onPlacesChanged={props.onPlacesChanged}
>
<input
type="text"
placeholder="Customized your placeholder"
style={{
boxSizing: `border-box`,
border: `1px solid transparent`,
width: `240px`,
height: `32px`,
padding: `0 12px`,
borderRadius: `3px`,
boxShadow: `0 2px 6px rgba(0, 0, 0, 0.3)`,
fontSize: `14px`,
outline: `none`,
textOverflow: `ellipses`,
}}
/>
</StandaloneSearchBox>
<ol>
{props.places.map(({ place_id, formatted_address, geometry: { location } }) =>
<li key={place_id}>
{formatted_address}
{" at "}
({location.lat()}, {location.lng()})
</li>
)}
</ol>
</div>
);
<PlacesWithStandaloneSearchBox />
```
| tomchentw/react-google-maps | src/components/places/StandaloneSearchBox.md | Markdown | mit | 1,945 |
/*! Slidebox.JS - v1.0 - 2013-11-30
* http://github.com/trevanhetzel/slidebox
*
* Copyright (c) 2013 Trevan Hetzel <trevan.co>;
* Licensed under the MIT license */
slidebox = function (params) {
// Carousel
carousel = function () {
var $carousel = $(params.container).children(".carousel"),
$carouselItem = $(".carousel li"),
$triggerLeft = $(params.leftTrigger),
$triggerRight = $(params.rightTrigger),
total = $carouselItem.length,
current = 0;
var moveLeft = function () {
if ( current > 0 ) {
$carousel.animate({ "left": "+=" + params.length + "px" }, params.speed );
current--;
}
};
var moveRight = function () {
if ( current < total - 2 ) {
$carousel.animate({ "left": "-=" + params.length + "px" }, params.speed );
current++;
}
};
// Initiliaze moveLeft on trigger click
$triggerLeft.on("click", function () {
moveLeft();
});
// Initiliaze moveRight on trigger click
$triggerRight.on("click", function () {
moveRight();
});
// Initiliaze moveLeft on left keypress
$(document).keydown(function (e){
if (e.keyCode == 37) {
moveLeft();
}
});
// Initiliaze moveRight on right keypress
$(document).keydown(function (e){
if (e.keyCode == 39) {
moveRight();
}
});
},
// Lightbox
lightbox = function () {
var trigger = ".carousel li a";
// Close lightbox when pressing esc key
$(document).keydown(function (e){
if (e.keyCode == 27) {
closeLightbox();
}
});
$(document)
// Close lightbox on any click
.on("click", function () {
closeLightbox();
})
// If clicked on a thumbnail trigger, proceed
.on("click", trigger, function (e) {
var $this = $(this);
// Prevent from clicking through
e.preventDefault();
e.stopPropagation();
// Grab the image URL
dest = $this.attr("href");
// Grab the caption from data attribute
capt = $this.children("img").data("caption");
enlarge(dest, capt);
/* If clicked on an enlarged image, stop propagation
so it doesn't get the close function */
$(document).on("click", ".lightbox img", function (e) {
e.stopPropagation();
});
});
closeLightbox = function () {
$(".lightbox-cont").remove();
$(".lightbox").remove();
},
enlarge = function (dest, capt) {
// Create new DOM elements
$("body").append("<div class='lightbox-cont'></div><div class='lightbox'></div>");
$(".lightbox").html(function () {
return "<img src='" + dest + "'><div class='lightbox-caption'>" + capt + "</div>";
});
}
}
// Initialize functions
carousel();
lightbox();
}; | trevanhetzel/slidebox | slidebox.js | JavaScript | mit | 3,369 |
<?php
// =============================================================================
// VIEWS/ETHOS/_POST-CAROUSEL.PHP
// -----------------------------------------------------------------------------
// Outputs the post carousel that appears at the top of the masthead.
// =============================================================================
GLOBAL $post_carousel_entry_id;
$post_carousel_entry_id = get_the_ID();
$is_enabled = x_get_option( 'x_ethos_post_carousel_enable', '' ) == '1';
$count = x_get_option( 'x_ethos_post_carousel_count' );
$display = x_get_option( 'x_ethos_post_carousel_display' );
switch ( $display ) {
case 'most-commented' :
$args = array(
'post_type' => 'post',
'posts_per_page' => $count,
'orderby' => 'comment_count',
'order' => 'DESC'
);
break;
case 'random' :
$args = array(
'post_type' => 'post',
'posts_per_page' => $count,
'orderby' => 'rand'
);
break;
case 'featured' :
$args = array(
'post_type' => 'post',
'posts_per_page' => $count,
'orderby' => 'date',
'meta_key' => '_x_ethos_post_carousel_display',
'meta_value' => 'on'
);
break;
}
?>
<?php if ( $is_enabled ) : ?>
<ul class="x-post-carousel unstyled">
<?php $wp_query = new WP_Query( $args ); ?>
<?php if ( $wp_query->have_posts() ) : ?>
<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
<li class="x-post-carousel-item">
<?php x_ethos_entry_cover( 'post-carousel' ); ?>
</li>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
<script>
jQuery(document).ready(function() {
jQuery('.x-post-carousel').slick({
speed : 500,
slide : 'li',
slidesToShow : <?php echo x_get_option( 'x_ethos_post_carousel_display_count_extra_large' ); ?>,
slidesToScroll : 1,
responsive : [
{ breakpoint : 1500, settings : { speed : 500, slide : 'li', slidesToShow : <?php echo x_get_option( 'x_ethos_post_carousel_display_count_large' ); ?> } },
{ breakpoint : 1200, settings : { speed : 500, slide : 'li', slidesToShow : <?php echo x_get_option( 'x_ethos_post_carousel_display_count_medium' ); ?> } },
{ breakpoint : 979, settings : { speed : 500, slide : 'li', slidesToShow : <?php echo x_get_option( 'x_ethos_post_carousel_display_count_small' ); ?> } },
{ breakpoint : 550, settings : { speed : 500, slide : 'li', slidesToShow : <?php echo x_get_option( 'x_ethos_post_carousel_display_count_extra_small' ); ?> } }
]
});
});
</script>
</ul>
<?php endif; ?> | whskyneat/element-wheels-blog | web/app/themes/x/framework/views/ethos/_post-carousel.php | PHP | mit | 2,761 |
import test from 'ava';
import Server from '../../src/server';
import IO from '../../src/socket-io';
test.cb('mock socket invokes each handler with unique reference', t => {
const socketUrl = 'ws://roomy';
const server = new Server(socketUrl);
const socket = new IO(socketUrl);
let handlerInvoked = 0;
const handler3 = function handlerFunc() {
t.true(true);
handlerInvoked += 1;
};
// Same functions but different scopes/contexts
socket.on('custom-event', handler3.bind(Object.create(null)));
socket.on('custom-event', handler3.bind(Object.create(null)));
// Same functions with same scope/context (only one should be added)
socket.on('custom-event', handler3);
socket.on('custom-event', handler3); // not expected
socket.on('connect', () => {
socket.join('room');
server.to('room').emit('custom-event');
});
setTimeout(() => {
t.is(handlerInvoked, 3, 'handler invoked too many times');
server.close();
t.end();
}, 500);
});
test.cb('mock socket invokes each handler per socket', t => {
const socketUrl = 'ws://roomy';
const server = new Server(socketUrl);
const socketA = new IO(socketUrl);
const socketB = new IO(socketUrl);
let handlerInvoked = 0;
const handler3 = function handlerFunc() {
t.true(true);
handlerInvoked += 1;
};
// Same functions but different scopes/contexts
socketA.on('custom-event', handler3.bind(socketA));
socketB.on('custom-event', handler3.bind(socketB));
// Same functions with same scope/context (only one should be added)
socketA.on('custom-event', handler3);
socketA.on('custom-event', handler3); // not expected
socketB.on('custom-event', handler3.bind(socketB)); // expected because bind creates a new method
socketA.on('connect', () => {
socketA.join('room');
socketB.join('room');
server.to('room').emit('custom-event');
});
setTimeout(() => {
t.is(handlerInvoked, 4, 'handler invoked too many times');
server.close();
t.end();
}, 500);
});
| thoov/mock-socket | tests/issues/65.test.js | JavaScript | mit | 2,017 |
import React from 'react'
import PropTypes from 'prop-types'
import VelocityTrimControls from './VelocityTrimControls'
import Instrument from '../../images/Instrument'
import styles from '../../styles/velocityTrim'
import { trimShape } from '../../reducers/velocityTrim'
const handleKeyDown = (event, item, bank, userChangedTrimEnd) => {
let delta = 0
event.nativeEvent.preventDefault()
switch (event.key) {
case 'ArrowUp':
delta = 1
break
case 'ArrowDown':
delta = -1
break
case 'PageUp':
delta = 5
break
case 'PageDown':
delta = -5
break
case 'Enter':
delta = 100
break
case 'Escape':
delta = -100
break
default:
break
}
if (delta !== 0) {
delta += item.trim
if (delta < 0) delta = 0
if (delta > 100) delta = 100
userChangedTrimEnd(item.note, delta, bank)
}
}
const VelocityTrim = (props) => {
const { item, bank, selected, playNote, selectTrim, userChangedTrimEnd } = props
const { note, trim, group, name } = item
return (
<section
tabIndex={note}
onKeyDown={e => handleKeyDown(e, item, bank, userChangedTrimEnd)}
onMouseUp={() => (selected ? null : selectTrim(note))}
className={selected ? styles.selected : ''}
role="presentation"
>
<div
className={styles.header}
onMouseUp={() => playNote(note, Math.round(127 * (trim / 100)), bank)}
role="button"
tabIndex={note}
>
<div>{note}</div>
<div>{group}</div>
<div>{Instrument(group)}</div>
</div>
<div
className={styles.noteName}
title={name}
>
{name}
</div>
<VelocityTrimControls {...props} />
</section>
)
}
VelocityTrim.propTypes = {
item: trimShape.isRequired,
selected: PropTypes.bool.isRequired,
playNote: PropTypes.func.isRequired,
selectTrim: PropTypes.func.isRequired,
userChangedTrimEnd: PropTypes.func.isRequired,
bank: PropTypes.number.isRequired,
}
export default VelocityTrim
| dkadrios/zendrum-stompblock-client | src/components/trims/VelocityTrim.js | JavaScript | mit | 2,066 |
class CreateTips < ActiveRecord::Migration[5.0]
def change
create_table :tips do |t|
t.text :body
t.timestamps
end
end
end
| agonzalez0515/Coco-app | db/migrate/20161220004643_create_tips.rb | Ruby | mit | 148 |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class MY_Controller extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->helper('url');
}
}
class Admin_Controller extends MY_Controller {
public function __construct() {
parent::__construct();
$this->is_logged_in();
}
public function is_logged_in() {
}
}
| bivinvinod/footballCrazy | application/core/MY_Controller.php | PHP | mit | 439 |
# chrome-launcher-cli [](https://travis-ci.org/ragingwind/chrome-launcher-cli)
> Chrome Launcher for CLI, which is a CLI tool extended from [chrome-launcher](https://www.npmjs.com/package/chrome-launcher). Please visit to [chrome-launcher](https://www.npmjs.com/package/chrome-launcher) page for more information.
## Install
```
$ npm install -g chrome-launcher-cli
```
## Usage
```js
chrome --help
```
## Receipts
### Test with Chrome Extension
```
chrome --app=file://test/index.html --system-developer-mode --load-extension=/test/extension --enable-extensions
```
## License
MIT © [Jimmy Moon](http://ragingwind.me)
| ragingwind/chrome-launcher-cli | readme.md | Markdown | mit | 719 |
/*
* Copyright (c) 2014-2016, Santili Y-HRAH KRONG
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sqlcreatetable.hpp>
namespace cppsqlx
{
SQLCreateTable::SQLCreateTable(std::string tablename)
{
_objectname = tablename;
_objecttype = "TABLE";
}
std::string SQLCreateTable::toString()
{
std::string query;
query = "CREATE ";
query += _objecttype + " " + _objectname;
if(_ds)
{
query += "(\n";
for(auto i = 1; i <= _ds->rowSize() ; i++)
{
query += _ds->at(i).name() + " " + _ds->at(i).type();
if(i != _ds->rowSize())
query += ",\n";
}
query += "\n)";
}
else
{
query += " AS\n";
query += _select;
}
switch(sqldialect_)
{
case DBPROVIDER::GREENPLUM :
{
query+= "\nDISTRIBUTED RANDOMLY";
break;
}
default:
break;
}
return query;
};
SQLCreateTable& SQLCreateTable::as(std::string select)
{
_select = select;
return *this;
}
SQLCreateTable& SQLCreateTable::sameAs(std::shared_ptr<Dataset> ds)
{
_ds = ds;
return *this;
}
};/*namespace cppsqlx*/
| Santili/cppsqlx | source/sqlcreatetable.cpp | C++ | mit | 2,452 |
<?php
/**
* Link posts
*
* @package Start Here
* @since Start Here 1.0.0
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="post-header">
<div class="header-metas">
<?php sh_post_format(); ?>
<?php if( is_singular() ) { edit_post_link( __( 'Edit', 'textdomain' ), '<span class="edit-link">', '</span>' ); } ?>
<span class="post-date">
<time class="published" datetime="<?php echo get_the_time('c'); ?>"><a title="<?php _e( 'Permalink to: ', 'textdomain' ); echo the_title(); ?>" href="<?php the_permalink(); ?>"><?php echo get_the_date(); ?></a></time>
</span>
<span class="post-author">
<?php _e( '- By ', 'textdomain' ); ?><a title="<?php _e('See other posts by ', 'textdomain'); the_author_meta( 'display_name' ); ?>" href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php the_author_meta( 'display_name' ); ?></a>
</span>
</div>
</header>
<div class="<?php if( is_single() ) { echo 'post-content'; } else { echo 'link-content'; } ?>">
<?php the_content(''); ?>
</div>
<?php if( !is_single() && has_excerpt() ) : ?>
<?php the_excerpt(); ?>
<a class="read-more" href="<?php the_permalink(); ?>" title="<?php echo _e( 'Read more', 'textdomain' ); ?>"><i class="g"></i><?php echo _e( 'Read more', 'textdomain' ); ?></a>
<?php endif; ?>
<?php if( is_single() ) : ?>
<footer class="post-footer">
<ul class="taxo-metas">
<?php if( get_the_category() ) { ?><li class="category"><i class="gicn gicn-category"></i><?php the_category(' • '); ?></li><?php } ?>
<li class="tag-links"><i class="gicn gicn-tag"></i><?php
$tags_list = get_the_tag_list( '', __( ' ', 'textdomain' ) );
if ( $tags_list ) :
printf( __( '%1$s', 'textdomain' ), $tags_list );
else :
_e( 'No tags', 'textdomain' );
endif; ?>
</li>
</ul>
</footer>
<?php endif; ?>
</article> | Manoz/start-here | start-here/templates/content-link.php | PHP | mit | 2,213 |
/*! HTML5 Boilerplate v5.2.0 | MIT License | https://html5boilerplate.com/ */
/*
* What follows is the result of much research on cross-browser styling.
* Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
* Kroc Camen, and the H5BP dev community and team.
*/
/* ==========================================================================
Base styles: opinionated defaults
========================================================================== */
html {
color: #222;
font-size: 1em;
line-height: 1.4;
}
/*
* Remove text-shadow in selection highlight:
* https://twitter.com/miketaylr/status/12228805301
*
* These selection rule sets have to be separate.
* Customize the background color to match your design.
*/
::-moz-selection {
background: #b3d4fc;
text-shadow: none;
}
::selection {
background: #b3d4fc;
text-shadow: none;
}
/*
* A better looking default horizontal rule
*/
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #ccc;
margin: 1em 0;
padding: 0;
}
/*
* Remove the gap between audio, canvas, iframes,
* images, videos and the bottom of their containers:
* https://github.com/h5bp/html5-boilerplate/issues/440
*/
audio,
canvas,
iframe,
img,
svg,
video {
vertical-align: middle;
}
/*
* Remove default fieldset styles.
*/
fieldset {
border: 0;
margin: 0;
padding: 0;
}
/*
* Allow only vertical resizing of textareas.
*/
textarea {
resize: vertical;
}
/* ==========================================================================
Browser Upgrade Prompt
========================================================================== */
.browserupgrade {
margin: 0.2em 0;
background: #ccc;
color: #000;
padding: 0.2em 0;
}
/* ==========================================================================
GENERAL!!!
========================================================================== */
body {
font-family: 'Oswald', sans-serif;
background-image: url("../img/fond.jpg") !important;
background-position: center;
width: 100%;
height: 500px;
background-size: cover;
}
.fondecran{
height: 100%;
}
/* ==========================================================================
NAVBAR!!!
========================================================================== */
#mainmenu {
padding-bottom: 2%;
}
#mainmenu li a {
padding-top: 6px;
padding-bottom: 0px;
margin-top: 7px;
height: 34px;
}
.container {
width: 83%;
}
#likefb {
width: 70px;
margin-top: -6%;
}
.border-nav {
border-left: 1px dotted grey;
}
#logo1 {
margin-top: -13px;
width: 60%;
}
/*//////-- NAVBAR --//////*/
/*/////-- Content --//////*/
#slogan1 {
background-color: rgba(0,120,215,0.2);
}
/* footer */
#footer {
color: grey;
height: 63px;
background-color: #608A0C;
}
#footer h1 {
font-size: 1em;
padding-left: 20px;
}
#footer3 {
padding-top: 11px;
}
#footer2 {
font-size: 1.5em;
color: white;
background-color: #87C316;
height : 60px;
background-image: url(../img/shadow.png);
background-size: cover;
}
.border-nav2 {
border-left: 1px dotted grey;
}
.joueur{
position: absolute;
width: 10%;
}
.vide {
position: absolute;
width: 10%;
}
/* ==========================================================================
Helper classes
========================================================================== */
/*
* Hide visually and from screen readers:
*/
.hidden {
display: none !important;
}
/*
* Hide only visually, but have it available for screen readers:
* http://snook.ca/archives/html_and_css/hiding-content-for-accessibility
*/
.visuallyhidden {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
/*
* Extends the .visuallyhidden class to allow the element
* to be focusable when navigated to via the keyboard:
* https://www.drupal.org/node/897638
*/
.visuallyhidden.focusable:active,
.visuallyhidden.focusable:focus {
clip: auto;
height: auto;
margin: 0;
overflow: visible;
position: static;
width: auto;
}
/*
* Hide visually and from screen readers, but maintain layout
*/
.invisible {
visibility: hidden;
}
/*
* Clearfix: contain floats
*
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* `contenteditable` attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that receive the `clearfix` class.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
*/
.clearfix:before,
.clearfix:after {
content: " "; /* 1 */
display: table; /* 2 */
}
.clearfix:after {
clear: both;
}
/* ==========================================================================
EXAMPLE Media Queries for Responsive Design.
These examples override the primary ('mobile first') styles.
Modify as content requires.
========================================================================== */
@media only screen and (min-width: 35em) {
/* Style adjustments for viewports that meet the condition */
}
@media print,
(-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 1.25dppx),
(min-resolution: 120dpi) {
/* Style adjustments for high resolution devices */
}
/* ==========================================================================
Print styles.
Inlined to avoid the additional HTTP request:
http://www.phpied.com/delay-loading-your-print-css/
========================================================================== */
@media print {
*,
*:before,
*:after {
background: transparent !important;
color: #000 !important; /* Black prints faster:
http://www.sanbeiji.com/archives/953 */
box-shadow: none !important;
text-shadow: none !important;
}
a,
a:visited {
text-decoration: underline;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
/*
* Don't show links that are fragment identifiers,
* or use the `javascript:` pseudo protocol
*/
a[href^="#"]:after,
a[href^="javascript:"]:after {
content: "";
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
/*
* Printing Tables:
* http://css-discuss.incutio.com/wiki/Printing_Tables
*/
thead {
display: table-header-group;
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
h2,
h3 {
page-break-after: avoid;
}
}
| Simplon-Roubaix/ChallengeDimTeam | css/main.css | CSS | mit | 7,136 |
#!/bin/bash
SCRIPT_PATH="${BASH_SOURCE[0]}";
if ([ -h "${SCRIPT_PATH}" ]) then
while([ -h "${SCRIPT_PATH}" ]) do SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`; done
fi
pushd . > /dev/null
cd `dirname ${SCRIPT_PATH}` > /dev/null
SCRIPT_PATH=`pwd`;
popd > /dev/null
if ! [ -f $SCRIPT_PATH/.nuget/nuget.exe ]
then
wget "https://www.nuget.org/nuget.exe" -P $SCRIPT_PATH/.nuget/
fi
mono $SCRIPT_PATH/.nuget/nuget.exe update -self
SCRIPT_PATH="${BASH_SOURCE[0]}";
if ([ -h "${SCRIPT_PATH}" ]) then
while([ -h "${SCRIPT_PATH}" ]) do SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`; done
fi
pushd . > /dev/null
cd `dirname ${SCRIPT_PATH}` > /dev/null
SCRIPT_PATH=`pwd`;
popd > /dev/null
mono $SCRIPT_PATH/.nuget/NuGet.exe update -self
mono $SCRIPT_PATH/.nuget/NuGet.exe install FAKE -OutputDirectory $SCRIPT_PATH/packages -ExcludeVersion -Version 4.16.1
mono $SCRIPT_PATH/.nuget/NuGet.exe install xunit.runner.console -OutputDirectory $SCRIPT_PATH/packages/FAKE -ExcludeVersion -Version 2.0.0
mono $SCRIPT_PATH/.nuget/NuGet.exe install NUnit.Console -OutputDirectory $SCRIPT_PATH/packages/FAKE -ExcludeVersion -Version 3.2.1
mono $SCRIPT_PATH/.nuget/NuGet.exe install NBench.Runner -OutputDirectory $SCRIPT_PATH/packages -ExcludeVersion -Version 0.3.1
if ! [ -e $SCRIPT_PATH/packages/SourceLink.Fake/tools/SourceLink.fsx ] ; then
mono $SCRIPT_PATH/.nuget/NuGet.exe install SourceLink.Fake -OutputDirectory $SCRIPT_PATH/packages -ExcludeVersion
fi
export encoding=utf-8
mono $SCRIPT_PATH/packages/FAKE/tools/FAKE.exe build.fsx "$@"
| Horusiath/Hyperion | build.sh | Shell | mit | 1,543 |
#include <assert.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h>
#include <video/gl.h>
#include <xxhash.h>
#include <memtrack.h>
#include "base/stack.h"
#include "core/common.h"
#include "base/math_ext.h"
#include "core/asset.h"
#include "core/configs.h"
#include "core/frame.h"
#include "core/logerr.h"
#include <core/application.h>
#include "core/video.h"
#include "video/resources_detail.h"
#include <core/audio.h>
static int running = 1;
static STACK *states_stack;
static APP_STATE *allstates;
static size_t states_num;
NEON_API void
application_next_state(unsigned int state) {
if (state > states_num) {
LOG_ERROR("State(%d) out of range", state);
exit(EXIT_FAILURE);
}
push_stack(states_stack, &allstates[state]);
((APP_STATE*)top_stack(states_stack))->on_init();
frame_flush();
}
NEON_API void
application_back_state(void) {
((APP_STATE*)pop_stack(states_stack))->on_cleanup();
frame_flush();
}
static void
application_cleanup(void) {
configs_cleanup();
asset_close();
audio_cleanup();
video_cleanup();
while (!is_stack_empty(states_stack))
application_back_state();
delete_stack(states_stack);
}
#ifdef OPENAL_BACKEND
#define SDL_INIT_FLAGS (SDL_INIT_VIDEO | SDL_INIT_TIMER)
#else
#define SDL_INIT_FLAGS (SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER)
#endif
NEON_API int
application_exec(const char *title, APP_STATE *states, size_t states_n) {
allstates = states;
states_num = states_n;
if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
LOG_ERROR("%s\n", SDL_GetError());
return EXIT_FAILURE;
}
atexit(SDL_Quit);
if (TTF_Init() < 0) {
LOG_ERROR("%s\n", TTF_GetError());
return EXIT_FAILURE;
}
atexit(TTF_Quit);
if ((states_stack = new_stack(sizeof(APP_STATE), states_n + 1)) == NULL) {
LOG_ERROR("%s\n", "Can\'t create game states stack");
return EXIT_FAILURE;
}
LOG("%s launched...\n", title);
LOG("Platform: %s\n", SDL_GetPlatform());
video_init(title);
audio_init();
atexit(application_cleanup);
application_next_state(0);
if (is_stack_empty(states_stack)) {
LOG_CRITICAL("%s\n", "No game states");
exit(EXIT_FAILURE);
}
SDL_Event event;
Uint64 current = 0;
Uint64 last = 0;
float accumulator = 0.0f;
while(running) {
frame_begin();
while(SDL_PollEvent(&event)) {
((APP_STATE*)top_stack(states_stack))->on_event(&event);
}
asset_process();
resources_process();
last = current;
current = SDL_GetPerformanceCounter();
Uint64 freq = SDL_GetPerformanceFrequency();
float delta = (double)(current - last) / (double)freq;
accumulator += CLAMP(delta, 0.f, 0.2f);
while(accumulator >= TIMESTEP) {
accumulator -= TIMESTEP;
((APP_STATE*)top_stack(states_stack))->on_update(TIMESTEP);
}
((APP_STATE*)top_stack(states_stack))->on_present(screen.width, screen.height, accumulator / TIMESTEP);
video_swap_buffers();
frame_end();
SDL_Delay(1);
}
return EXIT_SUCCESS;
}
NEON_API void
application_quit(void) {
running = 0;
}
| m1nuz/neon-core | neon/src/core/application.c | C | mit | 3,306 |
# Scrapy settings for helloscrapy project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'helloscrapy'
SPIDER_MODULES = ['helloscrapy.spiders']
NEWSPIDER_MODULE = 'helloscrapy.spiders'
# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = 'helloscrapy (+http://www.yourdomain.com)'
DOWNLOAD_DELAY = 3
ROBOTSTXT_OBEY = True
| orangain/helloscrapy | helloscrapy/settings.py | Python | mit | 525 |
"""
Django settings for djangoApp project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'r&j)3lay4i$rm44n%h)bsv_q(9ysqhl@7@aibjm2b=1)0fag9n'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'djangoApp.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'djangoApp.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL = '/static/'
| reggieroby/devpack | frameworks/djangoApp/djangoApp/settings.py | Python | mit | 3,105 |
---
layout: page
title: Sub Aerospace Executive Retreat
date: 2016-05-24
author: Matthew Cole
tags: weekly links, java
status: published
summary: Class aptent taciti sociosqu ad.
banner: images/banner/leisure-03.jpg
booking:
startDate: 06/25/2018
endDate: 06/29/2018
ctyhocn: TOIALHX
groupCode: SAER
published: true
---
Nulla suscipit arcu id laoreet facilisis. Maecenas elementum finibus turpis, nec consectetur est fermentum et. Nullam eu ipsum eget justo lobortis molestie. Nulla facilisi. Morbi pulvinar nisi non sapien gravida, at auctor est hendrerit. Nam posuere eros eget arcu elementum tincidunt. Maecenas dignissim ex venenatis quam molestie efficitur at hendrerit augue. Suspendisse feugiat in ligula sit amet elementum. Duis et consectetur est. Duis hendrerit, nunc a feugiat elementum, nisl purus hendrerit mauris, ac venenatis est enim aliquet ex. Aliquam in massa tempus, tincidunt velit at, varius lorem. Mauris ligula augue, dapibus non egestas a, tristique in ipsum. Nullam vel orci non eros dictum laoreet lacinia nec velit. In hac habitasse platea dictumst. Maecenas ornare est enim.
Proin porttitor lacus ut dui vehicula, at maximus mauris eleifend. Aenean faucibus viverra mi, sed pharetra turpis sagittis sit amet. Curabitur luctus ultrices risus nec mattis. Aenean accumsan purus et fringilla suscipit. Mauris hendrerit lobortis urna, eget porta velit ultricies a. Donec vestibulum sagittis est ac bibendum. Suspendisse potenti. Maecenas porttitor, odio eu maximus tempus, nibh sapien lobortis eros, quis interdum felis purus in nisi. Donec quis quam hendrerit, eleifend magna sed, euismod est. Nulla luctus dignissim diam id aliquam. Sed sagittis eu libero ullamcorper molestie.
* In nec mi ut eros cursus volutpat
* Aenean nec nibh venenatis, dignissim nisl eget, auctor ipsum
* Etiam faucibus elit eu leo egestas porta
* Duis ac mi vel lectus gravida vulputate.
Nunc dapibus est eget justo mollis sagittis nec at augue. Nulla ultricies mattis orci maximus tristique. Praesent hendrerit scelerisque ligula quis commodo. Fusce porta arcu vel lacus elementum, pharetra finibus eros tempus. Etiam aliquet mauris sed posuere sodales. Curabitur elit sapien, consequat tempus elementum ac, ultrices ac massa. Fusce tincidunt nibh nec tempor tempus. Suspendisse convallis, quam at malesuada vulputate, enim elit tempus urna, sit amet laoreet arcu nisl id neque. Cras gravida et dolor non faucibus. Proin risus lorem, facilisis non ligula sollicitudin, finibus accumsan erat. Vivamus nec rutrum turpis.
Nam justo eros, bibendum quis semper vitae, euismod eget mi. Donec porta euismod dolor ac porttitor. Maecenas consequat mauris convallis interdum vestibulum. Vestibulum congue ipsum est, eget cursus sapien varius id. Aliquam ut arcu justo. Quisque eu sodales leo. Suspendisse mattis enim vitae fermentum tempus. Etiam eu ex viverra, euismod mi id, facilisis massa. Praesent a quam sit amet odio vestibulum lobortis sit amet et ligula. Etiam nec diam et ante eleifend tincidunt. Sed rutrum luctus diam, et hendrerit diam elementum sed. Fusce quis sapien ex. Vivamus scelerisque fringilla libero. Praesent dapibus tempor tempor. Nam quis dui sit amet nunc rhoncus congue.
| KlishGroup/prose-pogs | pogs/T/TOIALHX/SAER/index.md | Markdown | mit | 3,201 |
---
layout: page
title: Pearl Group Dinner
date: 2016-05-24
author: Margaret Norris
tags: weekly links, java
status: published
summary: Pellentesque in hendrerit tortor. Quisque sollicitudin urna id.
banner: images/banner/leisure-04.jpg
booking:
startDate: 08/14/2018
endDate: 08/18/2018
ctyhocn: NYCEMHX
groupCode: PGD
published: true
---
Nam fermentum enim a dui venenatis accumsan. Vestibulum nec ultricies nisl, nec viverra quam. Donec et massa eget libero lobortis posuere. Vestibulum lobortis odio sed lorem laoreet suscipit. Duis nibh ligula, viverra vitae pulvinar et, tristique eget dui. Fusce fermentum mi eget vehicula tincidunt. Nulla non commodo nulla. Morbi id tincidunt ex. Ut ornare eget enim a efficitur.
In ullamcorper lacus eu faucibus mollis. Proin a sollicitudin elit, ut ultricies risus. Praesent ut ornare nulla. Pellentesque porta augue ex, vitae facilisis elit iaculis vel. Aliquam facilisis egestas urna vitae varius. Mauris metus enim, molestie non facilisis a, varius non nibh. Aliquam tristique odio interdum elit posuere commodo eu nec metus. Fusce maximus luctus tortor a congue. Nunc volutpat tempor lacus, dignissim rhoncus risus vehicula in. Cras viverra rutrum convallis. Aliquam quis neque vel lectus ultrices tempor quis vitae ligula. In nec suscipit lacus. Quisque iaculis pulvinar cursus.
* Donec fringilla magna a neque bibendum efficitur
* Vestibulum porttitor nulla eget turpis malesuada porttitor
* Curabitur ac risus at orci vestibulum feugiat et laoreet nulla.
Quisque nec cursus nisl, vel sodales turpis. Maecenas vel tristique erat, in sollicitudin turpis. Ut suscipit ipsum ac lectus posuere scelerisque. Integer risus diam, ultrices ac elit sed, luctus tempus magna. Nam et maximus est. Etiam vulputate, dolor et luctus accumsan, nunc nulla pulvinar mauris, ut convallis orci est nec libero. Praesent egestas ac sem laoreet vulputate. Vivamus eleifend ante a neque viverra fermentum. Proin pharetra mollis faucibus. Nunc non volutpat arcu. Etiam luctus neque lectus, a vulputate magna interdum non. Nam ac hendrerit sem. Pellentesque elementum in mauris vulputate tincidunt.
| KlishGroup/prose-pogs | pogs/N/NYCEMHX/PGD/index.md | Markdown | mit | 2,134 |
---
layout: page
title: Warren Guardian Company Conference
date: 2016-05-24
author: Emily Harmon
tags: weekly links, java
status: published
summary: Pellentesque porttitor arcu velit, in facilisis tellus volutpat non. Nulla.
banner: images/banner/leisure-02.jpg
booking:
startDate: 12/20/2018
endDate: 12/23/2018
ctyhocn: NBFELHX
groupCode: WGCC
published: true
---
Maecenas ultrices enim id sapien semper, non auctor sapien varius. Nulla a commodo sem. Interdum et malesuada fames ac ante ipsum primis in faucibus. Cras laoreet, dolor consectetur convallis aliquet, ipsum risus feugiat justo, vitae laoreet tellus diam at quam. Quisque ut lectus in sapien consectetur posuere. Sed rutrum ultricies odio, non porttitor lectus cursus quis. Etiam auctor ullamcorper dolor, non semper sapien feugiat ac.
* Ut nec nulla molestie, pretium erat vitae, feugiat turpis
* Mauris vitae enim ut magna malesuada lobortis
* Sed id felis vestibulum, elementum turpis id, luctus mauris
* Sed eu augue at mi congue viverra
* Integer elementum lectus quis scelerisque mollis.
Morbi ullamcorper diam nec urna sodales egestas. Nam commodo tellus ut convallis feugiat. Fusce aliquam nisl ut libero pharetra, a convallis felis dapibus. Sed ut mi fermentum, laoreet nulla quis, sollicitudin orci. Praesent id tempus quam. Maecenas elementum varius iaculis. Suspendisse in leo sit amet tellus finibus luctus sit amet sed ipsum. Quisque faucibus, ante non consectetur porttitor, mauris velit volutpat massa, quis hendrerit odio dolor eu massa. Nam mattis malesuada egestas. Sed auctor lobortis orci vel iaculis. Aenean non ligula ultricies, cursus purus in, pharetra quam. Maecenas egestas efficitur nisi, nec iaculis erat rutrum efficitur. Aenean in congue neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec nec purus quis lectus facilisis malesuada. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
| KlishGroup/prose-pogs | pogs/N/NBFELHX/WGCC/index.md | Markdown | mit | 1,951 |
namespace Engine.Contracts
{
public interface IAct
{
/// <summary>
/// Makes an act (or try) and returns how much time it takes
/// </summary>
/// <param name="scene">Scene on which act plays</param>
/// <returns>Time passed</returns>
ActResult Do(IScene scene);
string Name { get; set; }
bool CanDo(IActor actor, IScene scene);
}
public class ActResult
{
public int TimePassed;
public string Message;
}
}
| sheix/GameEngine | Engine/Contracts/IAct.cs | C# | mit | 482 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.