answer
stringlengths 15
1.25M
|
|---|
package edu.mum.ea.mb;
import edu.mum.ea.ejb.ProjectEJB;
import edu.mum.ea.ejb.ReleaseBacklogEJB;
import edu.mum.ea.ejb.SprintEJB;
import edu.mum.ea.ejb.TaskEJB;
import edu.mum.ea.entity.Project;
import edu.mum.ea.entity.ReleaseBacklog;
import edu.mum.ea.entity.Sprint;
import edu.mum.ea.entity.Task;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
/**
*
* @author Syed
*/
@ManagedBean
@RequestScoped
public class SprintMB {
private Sprint sprint;
@EJB
private SprintEJB sprintEJB;
@EJB
private ProjectEJB projectEJB;
@EJB
private ReleaseBacklogEJB releaseBacklogEJB;
@EJB
private TaskEJB taskEJB;
@ManagedProperty(value = "#{sessionMB}")
private SessionMB sessionMB;
private List<Task> taskList = new ArrayList<Task>();
private List<ReleaseBacklog> releaseBacklogList = new ArrayList<ReleaseBacklog>();
private long relBacklogId;
private List<String> selectedTasks = new ArrayList<String>();
private List<Sprint> sprintList;
/**
* Creates a new instance of ProjectMB
*/
public SprintMB() {
sprint = new Sprint();
sprintList = new ArrayList<Sprint>();
}
@PostConstruct
public void init() {
//Map<String, Object> sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
//Project project = projectEJB.find(sessionMB.<API key>().getId());
releaseBacklogList = releaseBacklogEJB.<API key>(sessionMB.<API key>().getId());//project.<API key>();
}
public SessionMB getSessionMB() {
return sessionMB;
}
public void setSessionMB(SessionMB sessionMB) {
this.sessionMB = sessionMB;
}
public Sprint getSprint() {
return sprint;
}
public void setSprint(Sprint sprint) {
this.sprint = sprint;
}
public List<Sprint> getSprintList() {
sprintList = sprintEJB.<API key>(sessionMB.<API key>().getId());//sprintEJB.findAll();
return sprintList;
}
public void setSprintList(List<Sprint> sprintList) {
this.sprintList = sprintList;
}
public List<ReleaseBacklog> <API key>() {
return releaseBacklogList;
}
public void <API key>(List<ReleaseBacklog> releaseBacklogList) {
this.releaseBacklogList = releaseBacklogList;
}
public long getRelBacklogId() {
return relBacklogId;
}
public void setRelBacklogId(long relBacklogId) {
this.relBacklogId = relBacklogId;
}
public List<Task> getTaskList() {
return taskList;
}
public void setTaskList(List<Task> taskList) {
this.taskList = taskList;
}
public List<String> getSelectedTasks() {
return selectedTasks;
}
public void setSelectedTasks(List<String> selectedTasks) {
this.selectedTasks = selectedTasks;
}
public String createSprint() {
sprint.setReleaseBacklog(releaseBacklogEJB.find(getRelBacklogId()));
sprintEJB.save(sprint);
return "sprint-list";
}
public String gotoUpdatePage(Long id){
sprint = sprintEJB.find(id);
try {
setRelBacklogId(sprint.getReleaseBacklog().getId());
} catch(Exception e) {
}
return "sprint-update";
}
public String updateSprint(){
try {
sprint.setReleaseBacklog(releaseBacklogEJB.find(getRelBacklogId()));
} catch (Exception e) {
}
sprintEJB.edit(sprint);
return "sprint-list";
}
public String deleteSprint(Long sprintId){
sprintEJB.delete(sprintId);
return "sprint-list";
}
public String sprintDetail(Long id) {
sprint = sprintEJB.find(id);
taskList = taskEJB.findAll();
for (Task t : sprint.getTasks()) {
selectedTasks.add(t.getId().toString());
}
return "sprint-view";
}
public String addTaskToSprint() {
long sprintId = sprint.getId();
sprint = sprintEJB.find(sprintId);
taskList = sprint.getTasks();
int size = taskList.size();
for (int i = 0; i < size; i++) {
taskList.remove(taskList.get(i));
size
--i;
}
for (String taskId : selectedTasks) {
if (!taskList.contains(taskEJB.find(Long.parseLong(taskId)))) {
sprint.getTasks().add(taskEJB.find(Long.parseLong(taskId)));
}
}
sprintEJB.edit(sprint);
return "/sprint/sprint-list";
}
}
|
#include <pjsua2/account.hpp>
#include <pjsua2/endpoint.hpp>
#include <pjsua2/presence.hpp>
#include <pj/ctype.h>
#include "util.hpp"
using namespace pj;
using namespace std;
#define THIS_FILE "account.cpp"
void RtcpFbCap::fromPj(const pjmedia_rtcp_fb_cap &prm)
{
this->codecId = pj2Str(prm.codec_id);
this->type = prm.type;
this->typeName = pj2Str(prm.type_name);
this->param = pj2Str(prm.param);
}
pjmedia_rtcp_fb_cap RtcpFbCap::toPj() const
{
pjmedia_rtcp_fb_cap cap;
pj_bzero(&cap, sizeof(cap));
cap.codec_id = str2Pj(this->codecId);
cap.type = this->type;
cap.type_name = str2Pj(this->typeName);
cap.param = str2Pj(this->param);
return cap;
}
RtcpFbConfig::RtcpFbConfig()
{
<API key> setting;
<API key>(&setting);
fromPj(setting);
}
void RtcpFbConfig::fromPj(const <API key> &prm)
{
this->dontUseAvpf = PJ2BOOL(prm.dont_use_avpf);
this->caps.clear();
for (unsigned i = 0; i < prm.cap_count; ++i) {
RtcpFbCap cap;
cap.fromPj(prm.caps[i]);
this->caps.push_back(cap);
}
}
<API key> RtcpFbConfig::toPj() const
{
<API key> setting;
pj_bzero(&setting, sizeof(setting));
setting.dont_use_avpf = this->dontUseAvpf;
setting.cap_count = this->caps.size();
for (unsigned i = 0; i < setting.cap_count; ++i) {
setting.caps[i] = this->caps[i].toPj();
}
return setting;
}
void RtcpFbConfig::readObject(const ContainerNode &node) PJSUA2_THROW(Error)
{
ContainerNode this_node = node.readContainer("RtcpFbConfig");
NODE_READ_BOOL (this_node, dontUseAvpf);
ContainerNode cap_node = this_node.readArray("caps");
this->caps.clear();
while (cap_node.hasUnread()) {
RtcpFbCap cap;
NODE_READ_STRING (cap_node, cap.codecId);
NODE_READ_NUM_T (cap_node, <API key>, cap.type);
NODE_READ_STRING (cap_node, cap.typeName);
NODE_READ_STRING (cap_node, cap.param);
this->caps.push_back(cap);
}
}
void RtcpFbConfig::writeObject(ContainerNode &node) const PJSUA2_THROW(Error)
{
ContainerNode this_node = node.writeNewContainer("RtcpFbConfig");
NODE_WRITE_BOOL (this_node, dontUseAvpf);
ContainerNode cap_node = this_node.writeNewArray("caps");
for (unsigned i=0; i<this->caps.size(); ++i) {
NODE_WRITE_STRING (cap_node, this->caps[i].codecId);
NODE_WRITE_NUM_T (cap_node, <API key>,
this->caps[i].type);
NODE_WRITE_STRING (cap_node, this->caps[i].typeName);
NODE_WRITE_STRING (cap_node, this->caps[i].param);
}
}
void SrtpCrypto::fromPj(const pjmedia_srtp_crypto &prm)
{
this->key = pj2Str(prm.key);
this->name = pj2Str(prm.name);
this->flags = prm.flags;
}
pjmedia_srtp_crypto SrtpCrypto::toPj() const
{
pjmedia_srtp_crypto crypto;
crypto.key = str2Pj(this->key);
crypto.name = str2Pj(this->name);
crypto.flags = this->flags;
return crypto;
}
SrtpOpt::SrtpOpt()
{
pjsua_srtp_opt opt;
<API key>(&opt);
fromPj(opt);
}
void SrtpOpt::fromPj(const pjsua_srtp_opt &prm)
{
this->cryptos.clear();
for (unsigned i = 0; i < prm.crypto_count; ++i) {
SrtpCrypto crypto;
crypto.fromPj(prm.crypto[i]);
this->cryptos.push_back(crypto);
}
this->keyings.clear();
for (unsigned i = 0; i < prm.keying_count; ++i) {
this->keyings.push_back(prm.keying[i]);
}
}
pjsua_srtp_opt SrtpOpt::toPj() const
{
pjsua_srtp_opt opt;
pj_bzero(&opt, sizeof(opt));
opt.crypto_count = this->cryptos.size();
for (unsigned i = 0; i < opt.crypto_count; ++i) {
opt.crypto[i] = this->cryptos[i].toPj();
}
opt.keying_count = this->keyings.size();
for (unsigned i = 0; i < opt.keying_count; ++i) {
opt.keying[i] = (<API key>)this->keyings[i];
}
return opt;
}
void SrtpOpt::readObject(const ContainerNode &node) PJSUA2_THROW(Error)
{
ContainerNode this_node = node.readContainer("SrtpOpt");
ContainerNode crypto_node = this_node.readArray("cryptos");
this->cryptos.clear();
while (crypto_node.hasUnread()) {
SrtpCrypto crypto;
NODE_READ_STRING (crypto_node, crypto.key);
NODE_READ_STRING (crypto_node, crypto.name);
NODE_READ_UNSIGNED (crypto_node, crypto.flags);
this->cryptos.push_back(crypto);
}
ContainerNode keying_node = this_node.readArray("keyings");
this->keyings.clear();
while (keying_node.hasUnread()) {
unsigned keying;
NODE_READ_UNSIGNED (keying_node, keying);
this->keyings.push_back(keying);
}
}
void SrtpOpt::writeObject(ContainerNode &node) const PJSUA2_THROW(Error)
{
ContainerNode this_node = node.writeNewContainer("SrtpOpt");
ContainerNode crypto_node = this_node.writeNewArray("cryptos");
for (unsigned i=0; i<this->cryptos.size(); ++i) {
NODE_WRITE_STRING (crypto_node, this->cryptos[i].key);
NODE_WRITE_STRING (crypto_node, this->cryptos[i].name);
NODE_WRITE_UNSIGNED (crypto_node, this->cryptos[i].flags);
}
ContainerNode keying_node = this_node.writeNewArray("keyings");
for (unsigned i=0; i<this->keyings.size(); ++i) {
NODE_WRITE_UNSIGNED (keying_node, this->keyings[i]);
}
}
void AccountRegConfig::readObject(const ContainerNode &node)
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.readContainer("AccountRegConfig");
NODE_READ_STRING (this_node, registrarUri);
NODE_READ_BOOL (this_node, registerOnAdd);
NODE_READ_UNSIGNED (this_node, timeoutSec);
NODE_READ_UNSIGNED (this_node, retryIntervalSec);
NODE_READ_UNSIGNED (this_node, <API key>);
NODE_READ_UNSIGNED (this_node, <API key>);
NODE_READ_UNSIGNED (this_node, <API key>);
NODE_READ_BOOL (this_node, dropCallsOnFail);
NODE_READ_UNSIGNED (this_node, unregWaitMsec);
NODE_READ_UNSIGNED (this_node, proxyUse);
NODE_READ_STRING (this_node, contactParams);
readSipHeaders(this_node, "headers", headers);
}
void AccountRegConfig::writeObject(ContainerNode &node) const
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.writeNewContainer("AccountRegConfig");
NODE_WRITE_STRING (this_node, registrarUri);
NODE_WRITE_BOOL (this_node, registerOnAdd);
NODE_WRITE_UNSIGNED (this_node, timeoutSec);
NODE_WRITE_UNSIGNED (this_node, retryIntervalSec);
NODE_WRITE_UNSIGNED (this_node, <API key>);
NODE_WRITE_UNSIGNED (this_node, <API key>);
NODE_WRITE_UNSIGNED (this_node, <API key>);
NODE_WRITE_BOOL (this_node, dropCallsOnFail);
NODE_WRITE_UNSIGNED (this_node, unregWaitMsec);
NODE_WRITE_UNSIGNED (this_node, proxyUse);
NODE_WRITE_STRING (this_node, contactParams);
writeSipHeaders(this_node, "headers", headers);
}
void AccountSipConfig::readObject(const ContainerNode &node)
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.readContainer("AccountSipConfig");
NODE_READ_STRINGV (this_node, proxies);
NODE_READ_STRING (this_node, contactForced);
NODE_READ_STRING (this_node, contactParams);
NODE_READ_STRING (this_node, contactUriParams);
NODE_READ_BOOL (this_node, authInitialEmpty);
NODE_READ_STRING (this_node, <API key>);
NODE_READ_INT (this_node, transportId);
ContainerNode creds_node = this_node.readArray("authCreds");
authCreds.resize(0);
while (creds_node.hasUnread()) {
AuthCredInfo cred;
cred.readObject(creds_node);
authCreds.push_back(cred);
}
}
void AccountSipConfig::writeObject(ContainerNode &node) const
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.writeNewContainer("AccountSipConfig");
NODE_WRITE_STRINGV (this_node, proxies);
NODE_WRITE_STRING (this_node, contactForced);
NODE_WRITE_STRING (this_node, contactParams);
NODE_WRITE_STRING (this_node, contactUriParams);
NODE_WRITE_BOOL (this_node, authInitialEmpty);
NODE_WRITE_STRING (this_node, <API key>);
NODE_WRITE_INT (this_node, transportId);
ContainerNode creds_node = this_node.writeNewArray("authCreds");
for (unsigned i=0; i<authCreds.size(); ++i) {
authCreds[i].writeObject(creds_node);
}
}
void AccountCallConfig::readObject(const ContainerNode &node)
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.readContainer("AccountCallConfig");
NODE_READ_NUM_T ( this_node, <API key>, holdType);
NODE_READ_NUM_T ( this_node, pjsua_100rel_use, prackUse);
NODE_READ_NUM_T ( this_node, pjsua_sip_timer_use, timerUse);
NODE_READ_UNSIGNED( this_node, timerMinSESec);
NODE_READ_UNSIGNED( this_node, timerSessExpiresSec);
}
void AccountCallConfig::writeObject(ContainerNode &node) const
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.writeNewContainer("AccountCallConfig");
NODE_WRITE_NUM_T ( this_node, <API key>, holdType);
NODE_WRITE_NUM_T ( this_node, pjsua_100rel_use, prackUse);
NODE_WRITE_NUM_T ( this_node, pjsua_sip_timer_use, timerUse);
NODE_WRITE_UNSIGNED( this_node, timerMinSESec);
NODE_WRITE_UNSIGNED( this_node, timerSessExpiresSec);
}
void AccountPresConfig::readObject(const ContainerNode &node)
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.readContainer("AccountPresConfig");
NODE_READ_BOOL ( this_node, publishEnabled);
NODE_READ_BOOL ( this_node, publishQueue);
NODE_READ_UNSIGNED( this_node, <API key>);
NODE_READ_STRING ( this_node, pidfTupleId);
readSipHeaders(this_node, "headers", headers);
}
void AccountPresConfig::writeObject(ContainerNode &node) const
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.writeNewContainer("AccountPresConfig");
NODE_WRITE_BOOL ( this_node, publishEnabled);
NODE_WRITE_BOOL ( this_node, publishQueue);
NODE_WRITE_UNSIGNED( this_node, <API key>);
NODE_WRITE_STRING ( this_node, pidfTupleId);
writeSipHeaders(this_node, "headers", headers);
}
void AccountMwiConfig::readObject(const ContainerNode &node)
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.readContainer("AccountMwiConfig");
NODE_READ_BOOL ( this_node, enabled);
NODE_READ_UNSIGNED( this_node, expirationSec);
}
void AccountMwiConfig::writeObject(ContainerNode &node) const
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.writeNewContainer("AccountMwiConfig");
NODE_WRITE_BOOL ( this_node, enabled);
NODE_WRITE_UNSIGNED( this_node, expirationSec);
}
void AccountNatConfig::readObject(const ContainerNode &node)
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.readContainer("AccountNatConfig");
NODE_READ_NUM_T ( this_node, pjsua_stun_use, sipStunUse);
NODE_READ_NUM_T ( this_node, pjsua_stun_use, mediaStunUse);
NODE_READ_NUM_T ( this_node, pjsua_nat64_opt, nat64Opt);
NODE_READ_BOOL ( this_node, iceEnabled);
NODE_READ_INT ( this_node, iceMaxHostCands);
NODE_READ_BOOL ( this_node, <API key>);
NODE_READ_UNSIGNED( this_node, <API key>);
NODE_READ_INT ( this_node, <API key>);
NODE_READ_BOOL ( this_node, iceNoRtcp);
NODE_READ_BOOL ( this_node, iceAlwaysUpdate);
NODE_READ_BOOL ( this_node, turnEnabled);
NODE_READ_STRING ( this_node, turnServer);
NODE_READ_NUM_T ( this_node, pj_turn_tp_type, turnConnType);
NODE_READ_STRING ( this_node, turnUserName);
NODE_READ_INT ( this_node, turnPasswordType);
NODE_READ_STRING ( this_node, turnPassword);
NODE_READ_INT ( this_node, contactRewriteUse);
NODE_READ_INT ( this_node, <API key>);
NODE_READ_INT ( this_node, viaRewriteUse);
NODE_READ_INT ( this_node, sdpNatRewriteUse);
NODE_READ_INT ( this_node, sipOutboundUse);
NODE_READ_STRING ( this_node, <API key>);
NODE_READ_STRING ( this_node, sipOutboundRegId);
NODE_READ_UNSIGNED( this_node, udpKaIntervalSec);
NODE_READ_STRING ( this_node, udpKaData);
NODE_READ_INT ( this_node, contactUseSrcPort);
}
void AccountNatConfig::writeObject(ContainerNode &node) const
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.writeNewContainer("AccountNatConfig");
NODE_WRITE_NUM_T ( this_node, pjsua_stun_use, sipStunUse);
NODE_WRITE_NUM_T ( this_node, pjsua_stun_use, mediaStunUse);
NODE_WRITE_NUM_T ( this_node, pjsua_nat64_opt, nat64Opt);
NODE_WRITE_BOOL ( this_node, iceEnabled);
NODE_WRITE_INT ( this_node, iceMaxHostCands);
NODE_WRITE_BOOL ( this_node, <API key>);
NODE_WRITE_UNSIGNED( this_node, <API key>);
NODE_WRITE_INT ( this_node, <API key>);
NODE_WRITE_BOOL ( this_node, iceNoRtcp);
NODE_WRITE_BOOL ( this_node, iceAlwaysUpdate);
NODE_WRITE_BOOL ( this_node, turnEnabled);
NODE_WRITE_STRING ( this_node, turnServer);
NODE_WRITE_NUM_T ( this_node, pj_turn_tp_type, turnConnType);
NODE_WRITE_STRING ( this_node, turnUserName);
NODE_WRITE_INT ( this_node, turnPasswordType);
NODE_WRITE_STRING ( this_node, turnPassword);
NODE_WRITE_INT ( this_node, contactRewriteUse);
NODE_WRITE_INT ( this_node, <API key>);
NODE_WRITE_INT ( this_node, viaRewriteUse);
NODE_WRITE_INT ( this_node, sdpNatRewriteUse);
NODE_WRITE_INT ( this_node, sipOutboundUse);
NODE_WRITE_STRING ( this_node, <API key>);
NODE_WRITE_STRING ( this_node, sipOutboundRegId);
NODE_WRITE_UNSIGNED( this_node, udpKaIntervalSec);
NODE_WRITE_STRING ( this_node, udpKaData);
NODE_WRITE_INT ( this_node, contactUseSrcPort);
}
void AccountMediaConfig::readObject(const ContainerNode &node)
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.readContainer("AccountMediaConfig");
NODE_READ_BOOL ( this_node, lockCodecEnabled);
NODE_READ_BOOL ( this_node, streamKaEnabled);
NODE_READ_NUM_T ( this_node, pjmedia_srtp_use, srtpUse);
NODE_READ_INT ( this_node, srtpSecureSignaling);
NODE_READ_OBJ ( this_node, srtpOpt);
NODE_READ_NUM_T ( this_node, pjsua_ipv6_use, ipv6Use);
NODE_READ_OBJ ( this_node, transportConfig);
NODE_READ_BOOL ( this_node, rtcpMuxEnabled);
}
void AccountMediaConfig::writeObject(ContainerNode &node) const
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.writeNewContainer("AccountMediaConfig");
NODE_WRITE_BOOL ( this_node, lockCodecEnabled);
NODE_WRITE_BOOL ( this_node, streamKaEnabled);
NODE_WRITE_NUM_T ( this_node, pjmedia_srtp_use, srtpUse);
NODE_WRITE_INT ( this_node, srtpSecureSignaling);
NODE_WRITE_OBJ ( this_node, srtpOpt);
NODE_WRITE_NUM_T ( this_node, pjsua_ipv6_use, ipv6Use);
NODE_WRITE_OBJ ( this_node, transportConfig);
NODE_WRITE_BOOL ( this_node, rtcpMuxEnabled);
}
void AccountVideoConfig::readObject(const ContainerNode &node)
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.readContainer("AccountVideoConfig");
NODE_READ_BOOL ( this_node, autoShowIncoming);
NODE_READ_BOOL ( this_node, <API key>);
NODE_READ_UNSIGNED( this_node, windowFlags);
NODE_READ_NUM_T ( this_node, <API key>,
<API key>);
NODE_READ_NUM_T ( this_node, <API key>,
defaultRenderDevice);
NODE_READ_NUM_T ( this_node, <API key>,
rateControlMethod);
NODE_READ_UNSIGNED( this_node, <API key>);
NODE_READ_UNSIGNED( this_node, startKeyframeCount);
NODE_READ_UNSIGNED( this_node, <API key>);
}
void AccountVideoConfig::writeObject(ContainerNode &node) const
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.writeNewContainer("AccountVideoConfig");
NODE_WRITE_BOOL ( this_node, autoShowIncoming);
NODE_WRITE_BOOL ( this_node, <API key>);
NODE_WRITE_UNSIGNED( this_node, windowFlags);
NODE_WRITE_NUM_T ( this_node, <API key>,
<API key>);
NODE_WRITE_NUM_T ( this_node, <API key>,
defaultRenderDevice);
NODE_WRITE_NUM_T ( this_node, <API key>,
rateControlMethod);
NODE_WRITE_UNSIGNED( this_node, <API key>);
NODE_WRITE_UNSIGNED( this_node, startKeyframeCount);
NODE_WRITE_UNSIGNED( this_node, <API key>);
}
void <API key>::readObject(const ContainerNode &node)
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.readContainer("<API key>");
NODE_READ_BOOL ( this_node, shutdownTp);
NODE_READ_BOOL ( this_node, hangupCalls);
NODE_READ_UNSIGNED( this_node, reinviteFlags);
}
void <API key>::writeObject(ContainerNode &node) const
PJSUA2_THROW(Error)
{
ContainerNode this_node = node.writeNewContainer("<API key>");
NODE_WRITE_BOOL ( this_node, shutdownTp);
NODE_WRITE_BOOL ( this_node, hangupCalls);
NODE_WRITE_UNSIGNED( this_node, reinviteFlags);
}
AccountConfig::AccountConfig()
{
pjsua_acc_config acc_cfg;
<API key>(&acc_cfg);
pjsua_media_config med_cfg;
<API key>(&med_cfg);
fromPj(acc_cfg, &med_cfg);
}
/* Convert to pjsip. */
void AccountConfig::toPj(pjsua_acc_config &ret) const
{
unsigned i;
<API key>(&ret);
// Global
ret.priority = priority;
ret.id = str2Pj(idUri);
// AccountRegConfig
ret.reg_uri = str2Pj(regConfig.registrarUri);
ret.register_on_acc_add = regConfig.registerOnAdd;
ret.reg_timeout = regConfig.timeoutSec;
ret.reg_retry_interval = regConfig.retryIntervalSec;
ret.<API key>= regConfig.<API key>;
ret.<API key>= regConfig.<API key>;
ret.<API key>= regConfig.<API key>;
ret.<API key> = regConfig.dropCallsOnFail;
ret.unreg_timeout = regConfig.unregWaitMsec;
ret.reg_use_proxy = regConfig.proxyUse;
ret.reg_contact_params = str2Pj(regConfig.contactParams);
for (i=0; i<regConfig.headers.size(); ++i) {
pj_list_push_back(&ret.reg_hdr_list, ®Config.headers[i].toPj());
}
// AccountSipConfig
ret.cred_count = 0;
if (sipConfig.authCreds.size() > PJ_ARRAY_SIZE(ret.cred_info))
PJSUA2_RAISE_ERROR(PJ_ETOOMANY);
for (i=0; i<sipConfig.authCreds.size(); ++i) {
const AuthCredInfo &src = sipConfig.authCreds[i];
pjsip_cred_info *dst = &ret.cred_info[i];
dst->realm = str2Pj(src.realm);
dst->scheme = str2Pj(src.scheme);
dst->username = str2Pj(src.username);
dst->data_type = src.dataType;
dst->data = str2Pj(src.data);
dst->ext.aka.k = str2Pj(src.akaK);
dst->ext.aka.op = str2Pj(src.akaOp);
dst->ext.aka.amf= str2Pj(src.akaAmf);
ret.cred_count++;
}
ret.proxy_cnt = 0;
if (sipConfig.proxies.size() > PJ_ARRAY_SIZE(ret.proxy))
PJSUA2_RAISE_ERROR(PJ_ETOOMANY);
for (i=0; i<sipConfig.proxies.size(); ++i) {
ret.proxy[ret.proxy_cnt++] = str2Pj(sipConfig.proxies[i]);
}
ret.force_contact = str2Pj(sipConfig.contactForced);
ret.contact_params = str2Pj(sipConfig.contactParams);
ret.contact_uri_params = str2Pj(sipConfig.contactUriParams);
ret.auth_pref.initial_auth = sipConfig.authInitialEmpty;
ret.auth_pref.algorithm = str2Pj(sipConfig.<API key>);
ret.transport_id = sipConfig.transportId;
// AccountCallConfig
ret.call_hold_type = callConfig.holdType;
ret.require_100rel = callConfig.prackUse;
ret.use_timer = callConfig.timerUse;
ret.timer_setting.min_se = callConfig.timerMinSESec;
ret.timer_setting.sess_expires = callConfig.timerSessExpiresSec;
// AccountPresConfig
for (i=0; i<presConfig.headers.size(); ++i) {
pj_list_push_back(&ret.sub_hdr_list, &presConfig.headers[i].toPj());
}
ret.publish_enabled = presConfig.publishEnabled;
ret.publish_opt.queue_request= presConfig.publishQueue;
ret.<API key> = presConfig.<API key>;
ret.pidf_tuple_id = str2Pj(presConfig.pidfTupleId);
// AccountMwiConfig
ret.mwi_enabled = mwiConfig.enabled;
ret.mwi_expires = mwiConfig.expirationSec;
// AccountNatConfig
ret.sip_stun_use = natConfig.sipStunUse;
ret.media_stun_use = natConfig.mediaStunUse;
ret.nat64_opt = natConfig.nat64Opt;
ret.ice_cfg_use = <API key>;
ret.ice_cfg.enable_ice = natConfig.iceEnabled;
ret.ice_cfg.ice_max_host_cands = natConfig.iceMaxHostCands;
ret.ice_cfg.ice_opt.aggressive = natConfig.<API key>;
ret.ice_cfg.ice_opt.<API key> =
natConfig.<API key>;
ret.ice_cfg.ice_opt.<API key> =
natConfig.<API key>;
ret.ice_cfg.ice_no_rtcp = natConfig.iceNoRtcp;
ret.ice_cfg.ice_always_update = natConfig.iceAlwaysUpdate;
ret.turn_cfg_use = <API key>;
ret.turn_cfg.enable_turn = natConfig.turnEnabled;
ret.turn_cfg.turn_server = str2Pj(natConfig.turnServer);
ret.turn_cfg.turn_conn_type = natConfig.turnConnType;
ret.turn_cfg.turn_auth_cred.type = <API key>;
ret.turn_cfg.turn_auth_cred.data.static_cred.username =
str2Pj(natConfig.turnUserName);
ret.turn_cfg.turn_auth_cred.data.static_cred.data_type =
(pj_stun_passwd_type)natConfig.turnPasswordType;
ret.turn_cfg.turn_auth_cred.data.static_cred.data =
str2Pj(natConfig.turnPassword);
ret.turn_cfg.turn_auth_cred.data.static_cred.realm = pj_str((char*)"");
ret.turn_cfg.turn_auth_cred.data.static_cred.nonce = pj_str((char*)"");
ret.<API key> = natConfig.contactRewriteUse;
ret.<API key> = natConfig.<API key>;
ret.<API key> = natConfig.contactUseSrcPort;
ret.allow_via_rewrite = natConfig.viaRewriteUse;
ret.<API key> = natConfig.sdpNatRewriteUse;
ret.use_rfc5626 = natConfig.sipOutboundUse;
ret.rfc5626_instance_id = str2Pj(natConfig.<API key>);
ret.rfc5626_reg_id = str2Pj(natConfig.sipOutboundRegId);
ret.ka_interval = natConfig.udpKaIntervalSec;
ret.ka_data = str2Pj(natConfig.udpKaData);
// AccountMediaConfig
ret.rtp_cfg = mediaConfig.transportConfig.toPj();
ret.lock_codec = mediaConfig.lockCodecEnabled;
#if defined(<API key>) && (<API key> != 0)
ret.use_stream_ka = mediaConfig.streamKaEnabled;
#endif
ret.use_srtp = mediaConfig.srtpUse;
ret.<API key> = mediaConfig.srtpSecureSignaling;
ret.srtp_opt = mediaConfig.srtpOpt.toPj();
ret.ipv6_media_use = mediaConfig.ipv6Use;
ret.enable_rtcp_mux = mediaConfig.rtcpMuxEnabled;
ret.rtcp_fb_cfg = mediaConfig.rtcpFbConfig.toPj();
// AccountVideoConfig
ret.vid_in_auto_show = videoConfig.autoShowIncoming;
ret.<API key> = videoConfig.<API key>;
ret.vid_wnd_flags = videoConfig.windowFlags;
ret.vid_cap_dev = videoConfig.<API key>;
ret.vid_rend_dev = videoConfig.defaultRenderDevice;
ret.vid_stream_rc_cfg.method= videoConfig.rateControlMethod;
ret.vid_stream_rc_cfg.bandwidth = videoConfig.<API key>;
ret.vid_stream_sk_cfg.count = videoConfig.startKeyframeCount;
ret.vid_stream_sk_cfg.interval = videoConfig.<API key>;
// <API key>
ret.ip_change_cfg.shutdown_tp = ipChangeConfig.shutdownTp;
ret.ip_change_cfg.hangup_calls = ipChangeConfig.hangupCalls;
ret.ip_change_cfg.reinvite_flags = ipChangeConfig.reinviteFlags;
}
/* Initialize from pjsip. */
void AccountConfig::fromPj(const pjsua_acc_config &prm,
const pjsua_media_config *mcfg)
{
const pjsip_hdr *hdr;
unsigned i;
// Global
priority = prm.priority;
idUri = pj2Str(prm.id);
// AccountRegConfig
regConfig.registrarUri = pj2Str(prm.reg_uri);
regConfig.registerOnAdd = (prm.register_on_acc_add != 0);
regConfig.timeoutSec = prm.reg_timeout;
regConfig.retryIntervalSec = prm.reg_retry_interval;
regConfig.<API key> = prm.<API key>;
regConfig.<API key> = prm.<API key>;
regConfig.<API key> = prm.<API key>;
regConfig.dropCallsOnFail = PJ2BOOL(prm.<API key>);
regConfig.unregWaitMsec = prm.unreg_timeout;
regConfig.proxyUse = prm.reg_use_proxy;
regConfig.contactParams = pj2Str(prm.reg_contact_params);
regConfig.headers.clear();
hdr = prm.reg_hdr_list.next;
while (hdr != &prm.reg_hdr_list) {
SipHeader new_hdr;
new_hdr.fromPj(hdr);
regConfig.headers.push_back(new_hdr);
hdr = hdr->next;
}
// AccountSipConfig
sipConfig.authCreds.clear();
for (i=0; i<prm.cred_count; ++i) {
AuthCredInfo cred;
const pjsip_cred_info &src = prm.cred_info[i];
cred.realm = pj2Str(src.realm);
cred.scheme = pj2Str(src.scheme);
cred.username = pj2Str(src.username);
cred.dataType = src.data_type;
cred.data = pj2Str(src.data);
cred.akaK = pj2Str(src.ext.aka.k);
cred.akaOp = pj2Str(src.ext.aka.op);
cred.akaAmf = pj2Str(src.ext.aka.amf);
sipConfig.authCreds.push_back(cred);
}
sipConfig.proxies.clear();
for (i=0; i<prm.proxy_cnt; ++i) {
sipConfig.proxies.push_back(pj2Str(prm.proxy[i]));
}
sipConfig.contactForced = pj2Str(prm.force_contact);
sipConfig.contactParams = pj2Str(prm.contact_params);
sipConfig.contactUriParams = pj2Str(prm.contact_uri_params);
sipConfig.authInitialEmpty = PJ2BOOL(prm.auth_pref.initial_auth);
sipConfig.<API key> = pj2Str(prm.auth_pref.algorithm);
sipConfig.transportId = prm.transport_id;
// AccountCallConfig
callConfig.holdType = prm.call_hold_type;
callConfig.prackUse = prm.require_100rel;
callConfig.timerUse = prm.use_timer;
callConfig.timerMinSESec = prm.timer_setting.min_se;
callConfig.timerSessExpiresSec = prm.timer_setting.sess_expires;
// AccountPresConfig
presConfig.headers.clear();
hdr = prm.sub_hdr_list.next;
while (hdr != &prm.sub_hdr_list) {
SipHeader new_hdr;
new_hdr.fromPj(hdr);
presConfig.headers.push_back(new_hdr);
hdr = hdr->next;
}
presConfig.publishEnabled = PJ2BOOL(prm.publish_enabled);
presConfig.publishQueue = PJ2BOOL(prm.publish_opt.queue_request);
presConfig.<API key> = prm.<API key>;
presConfig.pidfTupleId = pj2Str(prm.pidf_tuple_id);
// AccountMwiConfig
mwiConfig.enabled = PJ2BOOL(prm.mwi_enabled);
mwiConfig.expirationSec = prm.mwi_expires;
// AccountNatConfig
natConfig.sipStunUse = prm.sip_stun_use;
natConfig.mediaStunUse = prm.media_stun_use;
natConfig.nat64Opt = prm.nat64_opt;
if (prm.ice_cfg_use == <API key>) {
natConfig.iceEnabled = PJ2BOOL(prm.ice_cfg.enable_ice);
natConfig.iceMaxHostCands = prm.ice_cfg.ice_max_host_cands;
natConfig.<API key> =
PJ2BOOL(prm.ice_cfg.ice_opt.aggressive);
natConfig.<API key> =
prm.ice_cfg.ice_opt.<API key>;
natConfig.<API key> =
prm.ice_cfg.ice_opt.<API key>;
natConfig.iceNoRtcp = PJ2BOOL(prm.ice_cfg.ice_no_rtcp);
natConfig.iceAlwaysUpdate = PJ2BOOL(prm.ice_cfg.ice_always_update);
} else {
pjsua_media_config default_mcfg;
if (!mcfg) {
<API key>(&default_mcfg);
mcfg = &default_mcfg;
}
natConfig.iceEnabled = PJ2BOOL(mcfg->enable_ice);
natConfig.iceMaxHostCands= mcfg->ice_max_host_cands;
natConfig.<API key> = PJ2BOOL(mcfg->ice_opt.aggressive);
natConfig.<API key> =
mcfg->ice_opt.<API key>;
natConfig.<API key> =
mcfg->ice_opt.<API key>;
natConfig.iceNoRtcp = PJ2BOOL(mcfg->ice_no_rtcp);
natConfig.iceAlwaysUpdate = PJ2BOOL(mcfg->ice_always_update);
}
if (prm.turn_cfg_use == <API key>) {
natConfig.turnEnabled = PJ2BOOL(prm.turn_cfg.enable_turn);
natConfig.turnServer = pj2Str(prm.turn_cfg.turn_server);
natConfig.turnConnType = prm.turn_cfg.turn_conn_type;
natConfig.turnUserName =
pj2Str(prm.turn_cfg.turn_auth_cred.data.static_cred.username);
natConfig.turnPasswordType =
prm.turn_cfg.turn_auth_cred.data.static_cred.data_type;
natConfig.turnPassword =
pj2Str(prm.turn_cfg.turn_auth_cred.data.static_cred.data);
} else {
pjsua_media_config default_mcfg;
if (!mcfg) {
<API key>(&default_mcfg);
mcfg = &default_mcfg;
}
natConfig.turnEnabled = PJ2BOOL(mcfg->enable_turn);
natConfig.turnServer = pj2Str(mcfg->turn_server);
natConfig.turnConnType = mcfg->turn_conn_type;
natConfig.turnUserName =
pj2Str(mcfg->turn_auth_cred.data.static_cred.username);
natConfig.turnPasswordType =
mcfg->turn_auth_cred.data.static_cred.data_type;
natConfig.turnPassword =
pj2Str(mcfg->turn_auth_cred.data.static_cred.data);
}
natConfig.contactRewriteUse = prm.<API key>;
natConfig.<API key> = prm.<API key>;
natConfig.contactUseSrcPort = prm.<API key>;
natConfig.viaRewriteUse = prm.allow_via_rewrite;
natConfig.sdpNatRewriteUse = prm.<API key>;
natConfig.sipOutboundUse = prm.use_rfc5626;
natConfig.<API key> = pj2Str(prm.rfc5626_instance_id);
natConfig.sipOutboundRegId = pj2Str(prm.rfc5626_reg_id);
natConfig.udpKaIntervalSec = prm.ka_interval;
natConfig.udpKaData = pj2Str(prm.ka_data);
// AccountMediaConfig
mediaConfig.transportConfig.fromPj(prm.rtp_cfg);
mediaConfig.lockCodecEnabled= PJ2BOOL(prm.lock_codec);
#if defined(<API key>) && (<API key> != 0)
mediaConfig.streamKaEnabled = PJ2BOOL(prm.use_stream_ka);
#else
mediaConfig.streamKaEnabled = false;
#endif
mediaConfig.srtpUse = prm.use_srtp;
mediaConfig.srtpSecureSignaling = prm.<API key>;
mediaConfig.srtpOpt.fromPj(prm.srtp_opt);
mediaConfig.ipv6Use = prm.ipv6_media_use;
mediaConfig.rtcpMuxEnabled = PJ2BOOL(prm.enable_rtcp_mux);
mediaConfig.rtcpFbConfig.fromPj(prm.rtcp_fb_cfg);
// AccountVideoConfig
videoConfig.autoShowIncoming = PJ2BOOL(prm.vid_in_auto_show);
videoConfig.<API key> = PJ2BOOL(prm.<API key>);
videoConfig.windowFlags = prm.vid_wnd_flags;
videoConfig.<API key> = prm.vid_cap_dev;
videoConfig.defaultRenderDevice = prm.vid_rend_dev;
videoConfig.rateControlMethod = prm.vid_stream_rc_cfg.method;
videoConfig.<API key> = prm.vid_stream_rc_cfg.bandwidth;
videoConfig.startKeyframeCount = prm.vid_stream_sk_cfg.count;
videoConfig.<API key> = prm.vid_stream_sk_cfg.interval;
// <API key>
ipChangeConfig.shutdownTp = PJ2BOOL(prm.ip_change_cfg.shutdown_tp);
ipChangeConfig.hangupCalls = PJ2BOOL(prm.ip_change_cfg.hangup_calls);
ipChangeConfig.reinviteFlags = prm.ip_change_cfg.reinvite_flags;
}
void AccountConfig::readObject(const ContainerNode &node) PJSUA2_THROW(Error)
{
ContainerNode this_node = node.readContainer("AccountConfig");
NODE_READ_INT ( this_node, priority);
NODE_READ_STRING ( this_node, idUri);
NODE_READ_OBJ ( this_node, regConfig);
NODE_READ_OBJ ( this_node, sipConfig);
NODE_READ_OBJ ( this_node, callConfig);
NODE_READ_OBJ ( this_node, presConfig);
NODE_READ_OBJ ( this_node, mwiConfig);
NODE_READ_OBJ ( this_node, natConfig);
NODE_READ_OBJ ( this_node, mediaConfig);
NODE_READ_OBJ ( this_node, videoConfig);
}
void AccountConfig::writeObject(ContainerNode &node) const PJSUA2_THROW(Error)
{
ContainerNode this_node = node.writeNewContainer("AccountConfig");
NODE_WRITE_INT ( this_node, priority);
NODE_WRITE_STRING ( this_node, idUri);
NODE_WRITE_OBJ ( this_node, regConfig);
NODE_WRITE_OBJ ( this_node, sipConfig);
NODE_WRITE_OBJ ( this_node, callConfig);
NODE_WRITE_OBJ ( this_node, presConfig);
NODE_WRITE_OBJ ( this_node, mwiConfig);
NODE_WRITE_OBJ ( this_node, natConfig);
NODE_WRITE_OBJ ( this_node, mediaConfig);
NODE_WRITE_OBJ ( this_node, videoConfig);
}
void AccountInfo::fromPj(const pjsua_acc_info &pai)
{
id = pai.id;
isDefault = pai.is_default != 0;
uri = pj2Str(pai.acc_uri);
regIsConfigured = pai.has_registration != 0;
regIsActive = pai.has_registration && pai.expires > 0 &&
(pai.status / 100 == 2);
regExpiresSec = pai.expires;
regStatus = pai.status;
regStatusText = pj2Str(pai.status_text);
regLastErr = pai.reg_last_err;
onlineStatus = pai.online_status != 0;
onlineStatusText = pj2Str(pai.online_status_text);
}
Account::Account()
: id(PJSUA_INVALID_ID)
{
}
Account::~Account()
{
/* If this instance is deleted, also delete the corresponding account in
* PJSUA library.
*/
shutdown();
}
void Account::create(const AccountConfig &acc_cfg,
bool make_default) PJSUA2_THROW(Error)
{
pjsua_acc_config pj_acc_cfg;
acc_cfg.toPj(pj_acc_cfg);
pj_acc_cfg.user_data = (void*)this;
PJSUA2_CHECK_EXPR( pjsua_acc_add(&pj_acc_cfg, make_default, &id) );
}
void Account::shutdown()
{
if (isValid() && pjsua_get_state() < PJSUA_STATE_CLOSING) {
// Cleanup buddies in the buddy list
while(buddyList.size() > 0) {
Buddy *b = buddyList[0];
delete b; /* this will remove itself from the list */
}
// This caused error message of "Error: cannot find Account.."
// when Endpoint::on_reg_started() is called for unregistration.
//<API key>(id, NULL);
pjsua_acc_del(id);
}
}
void Account::modify(const AccountConfig &acc_cfg) PJSUA2_THROW(Error)
{
pjsua_acc_config pj_acc_cfg;
acc_cfg.toPj(pj_acc_cfg);
pj_acc_cfg.user_data = (void*)this;
PJSUA2_CHECK_EXPR( pjsua_acc_modify(id, &pj_acc_cfg) );
}
bool Account::isValid() const
{
return pjsua_acc_is_valid(id) != 0;
}
void Account::setDefault() PJSUA2_THROW(Error)
{
PJSUA2_CHECK_EXPR( <API key>(id) );
}
bool Account::isDefault() const
{
return <API key>() == id;
}
int Account::getId() const
{
return id;
}
Account *Account::lookup(int acc_id)
{
return (Account*)<API key>(acc_id);
}
AccountInfo Account::getInfo() const PJSUA2_THROW(Error)
{
pjsua_acc_info pj_ai;
AccountInfo ai;
PJSUA2_CHECK_EXPR( pjsua_acc_get_info(id, &pj_ai) );
ai.fromPj(pj_ai);
return ai;
}
void Account::setRegistration(bool renew) PJSUA2_THROW(Error)
{
PJSUA2_CHECK_EXPR( <API key>(id, renew) );
}
void
Account::setOnlineStatus(const PresenceStatus &pres_st) PJSUA2_THROW(Error)
{
pjrpid_element pj_rpid;
pj_bzero(&pj_rpid, sizeof(pj_rpid));
pj_rpid.type = <API key>;
pj_rpid.activity = pres_st.activity;
pj_rpid.id = str2Pj(pres_st.rpidId);
pj_rpid.note = str2Pj(pres_st.note);
PJSUA2_CHECK_EXPR( <API key>(
id, pres_st.status == <API key>,
&pj_rpid) );
}
void Account::setTransport(TransportId tp_id) PJSUA2_THROW(Error)
{
PJSUA2_CHECK_EXPR( <API key>(id, tp_id) );
}
void Account::presNotify(const PresNotifyParam &prm) PJSUA2_THROW(Error)
{
pj_str_t pj_state_str = str2Pj(prm.stateStr);
pj_str_t pj_reason = str2Pj(prm.reason);
pjsua_msg_data msg_data;
prm.txOption.toPj(msg_data);
PJSUA2_CHECK_EXPR( pjsua_pres_notify(id, (pjsua_srv_pres*)prm.srvPres,
prm.state, &pj_state_str,
&pj_reason, prm.withBody,
&msg_data) );
}
const BuddyVector& Account::enumBuddies() const PJSUA2_THROW(Error)
{
return buddyList;
}
BuddyVector2 Account::enumBuddies2() const PJSUA2_THROW(Error)
{
BuddyVector2 bv2;
pjsua_buddy_id ids[PJSUA_MAX_BUDDIES];
unsigned i, count = PJSUA_MAX_BUDDIES;
PJSUA2_CHECK_EXPR( pjsua_enum_buddies(ids, &count) );
for (i = 0; i < count; ++i) {
bv2.push_back(Buddy(ids[i]));
}
return bv2;
}
Buddy* Account::findBuddy(string uri, FindBuddyMatch *buddy_match) const
PJSUA2_THROW(Error)
{
if (!buddy_match) {
static FindBuddyMatch def_bm;
buddy_match = &def_bm;
}
for (unsigned i = 0; i < buddyList.size(); i++) {
if (buddy_match->match(uri, *buddyList[i]))
return buddyList[i];
}
PJSUA2_RAISE_ERROR(PJ_ENOTFOUND);
}
Buddy Account::findBuddy2(string uri) const PJSUA2_THROW(Error)
{
pj_str_t pj_uri;
pjsua_buddy_id bud_id;
pj_strset2(&pj_uri, (char*)uri.c_str());
bud_id = pjsua_buddy_find(&pj_uri);
if (id == PJSUA_INVALID_ID) {
PJSUA2_RAISE_ERROR(PJ_ENOTFOUND);
}
Buddy buddy(bud_id);
return buddy;
}
void Account::addBuddy(Buddy *buddy)
{
pj_assert(buddy);
buddyList.push_back(buddy);
}
void Account::removeBuddy(Buddy *buddy)
{
pj_assert(buddy);
BuddyVector::iterator it;
for (it = buddyList.begin(); it != buddyList.end(); it++) {
if (*it == buddy) {
buddyList.erase(it);
return;
}
}
pj_assert(!"Bug! Buddy to be removed is not in the buddy list!");
}
|
#define NEWLINE_CANARY \
/* Unix */ \
"1\n" \
/* Windows */ \
"2\r\n" \
/* Mac OS */ \
"3\r" \
/* RISC OS */ \
"4\n\r" \
/* Add another character so the length isn't 0x0a bytes */ \
"5"
#ifdef MALI_SUPPORT
#include "<API key>.h"
#endif
static void marshal_summary(long long timestamp, long long uptime, long long monotonic_delta, const char *uname)
{
unsigned long flags;
int cpu = 0;
char buf[32];
local_irq_save(flags);
<API key>(cpu, SUMMARY_BUF, MESSAGE_SUMMARY);
<API key>(cpu, SUMMARY_BUF, NEWLINE_CANARY);
<API key>(cpu, SUMMARY_BUF, timestamp);
<API key>(cpu, SUMMARY_BUF, uptime);
<API key>(cpu, SUMMARY_BUF, monotonic_delta);
<API key>(cpu, SUMMARY_BUF, "uname");
<API key>(cpu, SUMMARY_BUF, uname);
<API key>(cpu, SUMMARY_BUF, "PAGESIZE");
snprintf(buf, sizeof(buf), "%lu", PAGE_SIZE);
<API key>(cpu, SUMMARY_BUF, buf);
#if GATOR_IKS_SUPPORT
<API key>(cpu, SUMMARY_BUF, "iks");
<API key>(cpu, SUMMARY_BUF, "");
#endif
#ifdef CONFIG_PREEMPT_RTB
<API key>(cpu, SUMMARY_BUF, "preempt_rtb");
<API key>(cpu, SUMMARY_BUF, "");
#endif
#ifdef <API key>
<API key>(cpu, SUMMARY_BUF, "preempt_rt_full");
<API key>(cpu, SUMMARY_BUF, "");
#endif
/* Let Streamline know which GPU is used so that it can label the GPU Activity appropriately. This is a temporary fix, to be improved in a future release. */
#ifdef MALI_SUPPORT
<API key>(cpu, SUMMARY_BUF, "mali_type");
#if (MALI_SUPPORT == MALI_4xx)
<API key>(cpu, SUMMARY_BUF, "4xx");
#elif (MALI_SUPPORT == MALI_MIDGARD)
<API key>(cpu, SUMMARY_BUF, "6xx");
#else
<API key>(cpu, SUMMARY_BUF, "unknown");
#endif
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
<API key>(cpu, SUMMARY_BUF, "nosync");
<API key>(cpu, SUMMARY_BUF, "");
#endif
<API key>(cpu, SUMMARY_BUF, "");
/* Commit the buffer now so it can be one of the first frames read by Streamline */
local_irq_restore(flags);
gator_commit_buffer(cpu, SUMMARY_BUF, gator_get_time());
}
static bool <API key>(const char *text)
{
int cpu = get_physical_cpu();
return buffer_check_space(cpu, NAME_BUF, strlen(text) + 3 * MAXSIZE_PACK32);
}
static void marshal_cookie(int cookie, const char *text)
{
int cpu = get_physical_cpu();
/* buffer_check_space already called by <API key> */
<API key>(cpu, NAME_BUF, MESSAGE_COOKIE);
<API key>(cpu, NAME_BUF, cookie);
<API key>(cpu, NAME_BUF, text);
buffer_check(cpu, NAME_BUF, gator_get_time());
}
static void marshal_thread_name(int pid, char *name)
{
unsigned long flags, cpu;
u64 time;
local_irq_save(flags);
cpu = get_physical_cpu();
time = gator_get_time();
if (buffer_check_space(cpu, NAME_BUF, TASK_COMM_LEN + 3 * MAXSIZE_PACK32 + MAXSIZE_PACK64)) {
<API key>(cpu, NAME_BUF, MESSAGE_THREAD_NAME);
<API key>(cpu, NAME_BUF, time);
<API key>(cpu, NAME_BUF, pid);
<API key>(cpu, NAME_BUF, name);
}
local_irq_restore(flags);
buffer_check(cpu, NAME_BUF, time);
}
static void marshal_link(int cookie, int tgid, int pid)
{
unsigned long cpu = get_physical_cpu(), flags;
u64 time;
local_irq_save(flags);
time = gator_get_time();
if (buffer_check_space(cpu, ACTIVITY_BUF, MAXSIZE_PACK64 + 5 * MAXSIZE_PACK32)) {
<API key>(cpu, ACTIVITY_BUF, MESSAGE_LINK);
<API key>(cpu, ACTIVITY_BUF, time);
<API key>(cpu, ACTIVITY_BUF, cookie);
<API key>(cpu, ACTIVITY_BUF, tgid);
<API key>(cpu, ACTIVITY_BUF, pid);
}
local_irq_restore(flags);
/* Check and commit; commit is set to occur once buffer is 3/4 full */
buffer_check(cpu, ACTIVITY_BUF, time);
}
static bool <API key>(int exec_cookie, int tgid, int pid, u64 time)
{
int cpu = get_physical_cpu();
if (!buffer_check_space(cpu, BACKTRACE_BUF, MAXSIZE_PACK64 + 5 * MAXSIZE_PACK32 + <API key> * 2 * MAXSIZE_PACK32)) {
/* Check and commit; commit is set to occur once buffer is 3/4 full */
buffer_check(cpu, BACKTRACE_BUF, time);
return false;
}
<API key>(cpu, BACKTRACE_BUF, time);
<API key>(cpu, BACKTRACE_BUF, exec_cookie);
<API key>(cpu, BACKTRACE_BUF, tgid);
<API key>(cpu, BACKTRACE_BUF, pid);
return true;
}
static void marshal_backtrace(unsigned long address, int cookie, int in_kernel)
{
int cpu = get_physical_cpu();
if (cookie == 0 && !in_kernel)
cookie = UNRESOLVED_COOKIE;
<API key>(cpu, BACKTRACE_BUF, cookie);
<API key>(cpu, BACKTRACE_BUF, address);
}
static void <API key>(u64 time)
{
int cpu = get_physical_cpu();
<API key>(cpu, BACKTRACE_BUF, <API key>);
/* Check and commit; commit is set to occur once buffer is 3/4 full */
buffer_check(cpu, BACKTRACE_BUF, time);
}
static bool <API key>(u64 time)
{
unsigned long flags, cpu = get_physical_cpu();
bool retval = false;
local_irq_save(flags);
if (buffer_check_space(cpu, BLOCK_COUNTER_BUF, MAXSIZE_PACK32 + MAXSIZE_PACK64)) {
<API key>(cpu, BLOCK_COUNTER_BUF, 0); /* key of zero indicates a timestamp */
<API key>(cpu, BLOCK_COUNTER_BUF, time);
retval = true;
}
local_irq_restore(flags);
return retval;
}
static void marshal_event(int len, int *buffer)
{
unsigned long i, flags, cpu = get_physical_cpu();
if (len <= 0)
return;
/* length must be even since all data is a (key, value) pair */
if (len & 0x1) {
pr_err("gator: invalid counter data detected and discarded\n");
return;
}
/* events must be written in key,value pairs */
local_irq_save(flags);
for (i = 0; i < len; i += 2) {
if (!buffer_check_space(cpu, BLOCK_COUNTER_BUF, 2 * MAXSIZE_PACK32))
break;
<API key>(cpu, BLOCK_COUNTER_BUF, buffer[i]);
<API key>(cpu, BLOCK_COUNTER_BUF, buffer[i + 1]);
}
local_irq_restore(flags);
}
static void marshal_event64(int len, long long *buffer64)
{
unsigned long i, flags, cpu = get_physical_cpu();
if (len <= 0)
return;
/* length must be even since all data is a (key, value) pair */
if (len & 0x1) {
pr_err("gator: invalid counter data detected and discarded\n");
return;
}
/* events must be written in key,value pairs */
local_irq_save(flags);
for (i = 0; i < len; i += 2) {
if (!buffer_check_space(cpu, BLOCK_COUNTER_BUF, 2 * MAXSIZE_PACK64))
break;
<API key>(cpu, BLOCK_COUNTER_BUF, buffer64[i]);
<API key>(cpu, BLOCK_COUNTER_BUF, buffer64[i + 1]);
}
local_irq_restore(flags);
}
static void __maybe_unused <API key>(int core, int key, int value)
{
unsigned long flags, cpu;
u64 time;
local_irq_save(flags);
cpu = get_physical_cpu();
time = gator_get_time();
if (buffer_check_space(cpu, COUNTER_BUF, MAXSIZE_PACK64 + 3 * MAXSIZE_PACK32)) {
<API key>(cpu, COUNTER_BUF, time);
<API key>(cpu, COUNTER_BUF, core);
<API key>(cpu, COUNTER_BUF, key);
<API key>(cpu, COUNTER_BUF, value);
}
local_irq_restore(flags);
/* Check and commit; commit is set to occur once buffer is 3/4 full */
buffer_check(cpu, COUNTER_BUF, time);
}
static void __maybe_unused <API key>(int core, int key, long long value)
{
unsigned long flags, cpu;
u64 time;
local_irq_save(flags);
cpu = get_physical_cpu();
time = gator_get_time();
if (buffer_check_space(cpu, COUNTER_BUF, 2 * MAXSIZE_PACK64 + 2 * MAXSIZE_PACK32)) {
<API key>(cpu, COUNTER_BUF, time);
<API key>(cpu, COUNTER_BUF, core);
<API key>(cpu, COUNTER_BUF, key);
<API key>(cpu, COUNTER_BUF, value);
}
local_irq_restore(flags);
/* Check and commit; commit is set to occur once buffer is 3/4 full */
buffer_check(cpu, COUNTER_BUF, time);
}
static void <API key>(int pid, int state)
{
unsigned long cpu = get_physical_cpu(), flags;
u64 time;
if (!per_cpu(gator_buffer, cpu)[SCHED_TRACE_BUF])
return;
local_irq_save(flags);
time = gator_get_time();
if (buffer_check_space(cpu, SCHED_TRACE_BUF, MAXSIZE_PACK64 + 5 * MAXSIZE_PACK32)) {
<API key>(cpu, SCHED_TRACE_BUF, <API key>);
<API key>(cpu, SCHED_TRACE_BUF, time);
<API key>(cpu, SCHED_TRACE_BUF, pid);
<API key>(cpu, SCHED_TRACE_BUF, state);
}
local_irq_restore(flags);
/* Check and commit; commit is set to occur once buffer is 3/4 full */
buffer_check(cpu, SCHED_TRACE_BUF, time);
}
static void <API key>(int tgid, int pid)
{
unsigned long cpu = get_physical_cpu(), flags;
u64 time;
if (!per_cpu(gator_buffer, cpu)[SCHED_TRACE_BUF])
return;
local_irq_save(flags);
time = gator_get_time();
if (buffer_check_space(cpu, SCHED_TRACE_BUF, MAXSIZE_PACK64 + 2 * MAXSIZE_PACK32)) {
<API key>(cpu, SCHED_TRACE_BUF, MESSAGE_SCHED_EXIT);
<API key>(cpu, SCHED_TRACE_BUF, time);
<API key>(cpu, SCHED_TRACE_BUF, pid);
}
local_irq_restore(flags);
/* Check and commit; commit is set to occur once buffer is 3/4 full */
buffer_check(cpu, SCHED_TRACE_BUF, time);
}
#if <API key>
static void marshal_idle(int core, int state)
{
unsigned long flags, cpu;
u64 time;
local_irq_save(flags);
cpu = get_physical_cpu();
time = gator_get_time();
if (buffer_check_space(cpu, IDLE_BUF, MAXSIZE_PACK64 + 2 * MAXSIZE_PACK32)) {
<API key>(cpu, IDLE_BUF, state);
<API key>(cpu, IDLE_BUF, time);
<API key>(cpu, IDLE_BUF, core);
}
local_irq_restore(flags);
/* Check and commit; commit is set to occur once buffer is 3/4 full */
buffer_check(cpu, IDLE_BUF, time);
}
#endif
#if defined(__arm__) || defined(__aarch64__)
static void marshal_core_name(const int core, const int cpuid, const char *name)
{
int cpu = get_physical_cpu();
unsigned long flags;
local_irq_save(flags);
if (buffer_check_space(cpu, SUMMARY_BUF, MAXSIZE_PACK32 + MAXSIZE_CORE_NAME)) {
<API key>(cpu, SUMMARY_BUF, MESSAGE_CORE_NAME);
<API key>(cpu, SUMMARY_BUF, core);
<API key>(cpu, SUMMARY_BUF, cpuid);
<API key>(cpu, SUMMARY_BUF, name);
}
/* Commit core names now so that they can show up in live */
local_irq_restore(flags);
gator_commit_buffer(cpu, SUMMARY_BUF, gator_get_time());
}
#endif
static void <API key>(int core, int key, int activity, int pid, int state)
{
unsigned long cpu = get_physical_cpu(), flags;
u64 time;
if (!per_cpu(gator_buffer, cpu)[ACTIVITY_BUF])
return;
local_irq_save(flags);
time = gator_get_time();
if (buffer_check_space(cpu, ACTIVITY_BUF, MAXSIZE_PACK64 + 5 * MAXSIZE_PACK32)) {
<API key>(cpu, ACTIVITY_BUF, MESSAGE_SWITCH);
<API key>(cpu, ACTIVITY_BUF, time);
<API key>(cpu, ACTIVITY_BUF, core);
<API key>(cpu, ACTIVITY_BUF, key);
<API key>(cpu, ACTIVITY_BUF, activity);
<API key>(cpu, ACTIVITY_BUF, pid);
<API key>(cpu, ACTIVITY_BUF, state);
}
local_irq_restore(flags);
/* Check and commit; commit is set to occur once buffer is 3/4 full */
buffer_check(cpu, ACTIVITY_BUF, time);
}
void <API key>(int core, int key, int activity, int pid)
{
/* state is reserved for cpu use only */
<API key>(core, key, activity, pid, 0);
}
|
/**
* card_view = new BaristaCardView({el: $("target_selector",
url:"",
title:"",
subtitle:"",
fg_color: "#1b9e77",
image:"",
span_class: "col-lg-12"});
*
* A Backbone View that displays a card of information wrapped in link
* The view is meant to be a top level entry point to other pages
* basic use:
card_view = new BaristaCardView();
* optional arguments:
* @param {string} url the link to navigate to if the card is clicked, defaults to ""
* @param {string} title the title of the card. defaults to "title"
* @param {string} subtitle the subtitle of the card. defaults to "subtitle"
* @param {string} image the link to an image to show as the cards main content. defaults to ""
* @param {string} fg_color the hex color code to use as the foreground color of the view, defaults to
* #1b9e77
* @param {string} span_class a bootstrap span class to size the width of the view, defaults to
* "col-lg-12"
*/
Barista.Views.BaristaCardView = Backbone.View.extend({
/**
* give the view a name to be used throughout the View's functions when it needs to know what its class
* name is
* @type {String}
*/
name: "BaristaCardView",
/**
* supply a base model for the view
* Overide this if you need to use it for dynamic content
* @type {Backbone}
*/
model: new Backbone.Model(),
/**
* overide the view's default initialize method in order to catch options and render a custom template
*/
initialize: function(){
// set up color options. default if not specified
this.fg_color = (this.options.fg_color !== undefined) ? this.options.fg_color : "#1b9e77";
// set up the span size
this.span_class = (this.options.span_class !== undefined) ? this.options.span_class : "col-lg-12";
// set up the url
this.url = (this.options.url !== undefined) ? this.options.url : "";
// set up the title
this.title = (this.options.title !== undefined) ? this.options.title : "Title";
// set up the subtitle
this.subtitle = (this.options.subtitle !== undefined) ? this.options.subtitle : "subtitle";
// set up the image
this.image = (this.options.image !== undefined) ? this.options.image : "";
// bind render to model changes
this.listenTo(this.model,'change', this.update);
// compile the default template for the view
this.compile_template();
},
/**
* use Handlebars to compile the template for the view
*/
compile_template: function(){
var self = this;
this.div_string = 'barista_view' + new Date().getTime();;
this.$el.append(BaristaTemplates.CMapCard({div_string: this.div_string,
span_class: this.span_class,
url: this.url,
title: this.title,
subtitle: this.subtitle,
image: this.image,
fg_color: this.fg_color}));
}
});
|
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href='https://fonts.googleapis.com/css?family=Architects+Daughter' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="/stylesheets/stylesheet.css" media="screen" />
<link rel="stylesheet" type="text/css" href="/stylesheets/pygment_trac.css" media="screen" />
<link rel="stylesheet" type="text/css" href="/stylesheets/print.css" media="print" />
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]
<title>puppix by puppix</title>
</head>
<body>
<a href="https:
<header>
<div class="inner">
<h1><a href="/">puppix</a></h1>
<h2>Puppet for Enterprise Linux</h2>
<a href="https://github.com/puppix" class="button"><small>Follow me on</small>GitHub</a>
</div>
</header>
<div id="content-wrapper">
<div class="inner clearfix">
<section id="main-content">
{{ content }}
</section>
<aside id="sidebar">
<p>
<a href="https://github.com/puppix">./github</a> - GitHub Page<br />
<a href="https://github.com/puppix/puppix.github.io/issues">./issues</a> - Global Tracker<br />
<a href="/codingstyle">./style</a> - Coding Style<br />
</p>
<strong>Blog Posts</strong>
<ul class="posts">
{% for post in site.posts %}
<li>
<a href="{{ post.url }}">{{ post.title }}</a><br />
» <span>{{ post.date | date_to_string }}</span>
</li>
{% endfor %}
</ul>
</aside>
</div>
</div>
</body>
</html>
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ludum2D.Tiles;
using Ludum2D.World;
using Microsoft.Xna.Framework;
namespace Ludum2D.Core {
public class LudumCore {
private static LudumCore instance;
public static LudumCore Instance {
get {
if (instance == null) {
instance = new LudumCore();
}
return instance;
}
}
private LudumCore() {
}
public bool Initialized { get; private set; }
<summary>
Initialize the cores of the engine
</summary>
public void Initialize() {
}
<summary>
Sets the size of a tile
</summary>
<param name="sq">Width and height of a tile; Must be x^2</param>
public void SetTileSize(int sq) {
if (!Initialized) {
throw new Exception("The tile size cannot be modified once the the LudumCore has been initialized");
}
Tile.Width = sq;
}
}
}
|
\section{Laser and Solar Panel}
For this project a laser pointer and four solar panels is made available. The purpose of a laser pointer and solar panels is to show how the system works by pointing on a solar panel with the laser. The solar panels is all equal in size, with the dimensions of 3x3 cm.
\todo[inline]{Some more info on the laser and the solar panel.}
|
<?php
/**
* @group Echo
*/
class <API key> extends MediaWikiTestCase {
public static function provider_updateRow() {
$input = array(
'event_id' => 2,
'event_type' => 'mention',
'event_variant' => null,
'event_agent_id' => 3,
'event_agent_ip' => null,
'event_page_title' => '',
'<API key>' => 0,
'event_page_extra' => null,
'event_extra' => null,
'event_page_id' => null,
);
return array(
array( 'Unrelated row must result in no update', array(), $input ),
array(
'Page title and namespace for non-existant page must move into event_extra',
array( // expected update
'event_extra' => serialize( array(
'page_title' => 'Yabba Dabba Do',
'page_namespace' => NS_MAIN
) ),
),
array( // input row
'event_page_title' => 'Yabba Dabba Do',
'<API key>' => NS_MAIN,
) + $input,
),
array(
'Page title and namespace for existing page must be result in update to event_page_id',
array( // expected update
'event_page_id' => 42,
),
array( // input row
'event_page_title' => 'Mount Rushmore',
'<API key>' => NS_MAIN,
) + $input,
self::attachTitleFor( 42, 'Mount Rushmore', NS_MAIN )
),
array(
'When updating non-existant page must keep old extra data',
array( // expected update
'event_extra' => serialize( array(
'foo' => 'bar',
'page_title' => 'Yabba Dabba Do',
'page_namespace' => NS_MAIN
) ),
),
array( // input row
'event_page_title' => 'Yabba Dabba Do',
'<API key>' => NS_MAIN,
'event_extra' => serialize( array( 'foo' => 'bar' ) ),
) + $input,
),
array(
'Must update link-from-title/namespace to link-from-page-id for page-linked events',
array( // expected update
'event_extra' => serialize( array( 'link-from-page-id' => 99 ) ),
),
array( //input row
'event_type' => 'page-linked',
'event_extra' => serialize( array(
'link-from-title' => 'Horse',
'link-from-namespace' => NS_USER_TALK
) ),
) + $input,
self::attachTitleFor( 99, 'Horse', NS_USER_TALK )
),
array(
'Must perform both generic update and page-linked update at same time',
array( // expected update
'event_extra' => serialize( array( 'link-from-page-id' => 8675309 ) ),
'event_page_id' => 8675309,
),
array( //input row
'event_type' => 'page-linked',
'event_extra' => serialize( array(
'link-from-title' => 'Jenny',
'link-from-namespace' => NS_MAIN,
) ),
'event_page_title' => 'Jenny',
'<API key>' => NS_MAIN,
) + $input,
self::attachTitleFor( 8675309, 'Jenny', NS_MAIN ),
),
);
}
protected static function attachTitleFor( $id, $providedText, $providedNamespace ) {
return function( $test, $gen ) use ( $id, $providedText, $providedNamespace ) {
$title = $test->getMock( 'Title' );
$title->expects( $test->any() )
->method( 'getArticleId' )
->will( $test->returnValue( $id ) );
$titles = array( $providedNamespace => array( $providedText => $title ) );
$gen->setNewTitleFromText( function( $text, $defaultNamespace ) use( $titles ) {
if ( isset( $titles[$defaultNamespace][$text] ) ) {
return $titles[$defaultNamespace][$text];
}
return Title::newFromText( $text, $defaultNamespace );
} );
};
}
/**
* @dataProvider provider_updateRow
*/
public function testUpdateRow( $message, $expected, $input, $callable = null ) {
$gen = new <API key>;
if ( $callable ) {
call_user_func( $callable, $this, $gen );
}
$update = $gen->update( (object) $input );
$this->assertEquals( $expected, $update, $message );
}
}
|
<?php
/* core/themes/classy/templates/navigation/menu-local-task.html.twig */
class <API key> extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
$this->blocks = array(
);
}
protected function doDisplay(array $context, array $blocks = array())
{
$tags = array();
$filters = array();
$functions = array();
try {
$this->env->getExtension('sandbox')->checkSecurity(
array(),
array(),
array()
);
} catch (<API key> $e) {
$e->setTemplateFile($this->getTemplateName());
if ($e instanceof <API key> && isset($tags[$e->getTagName()])) {
$e->setTemplateLine($tags[$e->getTagName()]);
} elseif ($e instanceof <API key> && isset($filters[$e->getFilterName()])) {
$e->setTemplateLine($filters[$e->getFilterName()]);
} elseif ($e instanceof <API key> && isset($functions[$e->getFunctionName()])) {
$e->setTemplateLine($functions[$e->getFunctionName()]);
}
throw $e;
}
// line 17
echo "<li";
echo $this->env->getExtension('sandbox')-><API key>($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute((isset($context["attributes"]) ? $context["attributes"] : null), "addClass", array(0 => (((isset($context["is_active"]) ? $context["is_active"] : null)) ? ("is-active") : (""))), "method"), "html", null, true));
echo ">";
echo $this->env->getExtension('sandbox')-><API key>($this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["link"]) ? $context["link"] : null), "html", null, true));
echo "</li>
";
}
public function getTemplateName()
{
return "core/themes/classy/templates/navigation/menu-local-task.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 43 => 17,);
}
}
/* * @file*/
/* * Theme override for a local task link.*/
/* * Available variables:*/
/* * - attributes: HTML attributes for the wrapper element.*/
/* * - is_active: Whether the task item is an active tab.*/
/* * - link: A rendered link element.*/
/* * Note: This template renders the content for each task item in*/
/* * menu-local-tasks.html.twig.*/
/* * @see <API key>()*/
/* <li{{ attributes.addClass(is_active ? 'is-active') }}>{{ link }}</li>*/
|
#include <graalvm/llvm/polyglot.h>
#include <graalvm/llvm/handles.h>
int main() {
void *p = polyglot_import("object");
void *p1 = create_handle(p);
void *p2 = resolve_handle(p1);
if (p != p2) {
return 1;
}
return 0;
}
|
package mrdev023.opengl;
import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.system.MemoryUtil.*;
import java.awt.*;
import java.nio.*;
import org.lwjgl.*;
import org.lwjgl.glfw.*;
import org.lwjgl.opengl.*;
import mrdev023.exception.*;
public class Display {
private static DisplayMode displayMode;
private static String TITLE = "";
private static long window;
private static boolean hasResized = false;
public static void create(String title,int width,int height){
if ( !glfwInit() )
throw new <API key>("Unable to initialize GLFW");
TITLE = title;
displayMode = new DisplayMode(width,height);
window = glfwCreateWindow(displayMode.getWidth(),displayMode.getHeight(), TITLE, NULL, NULL);
}
public static void create(String title,int width,int height,int major,int minor){
if ( !glfwInit() )
throw new <API key>("Unable to initialize GLFW");
glfwWindowHint(<API key>, major); // Nous voulons OpenGL 3.3
glfwWindowHint(<API key>, minor);
glfwWindowHint(GLFW_OPENGL_PROFILE, <API key>);
TITLE = title;
displayMode = new DisplayMode(width,height);
window = glfwCreateWindow(displayMode.getWidth(),displayMode.getHeight(), TITLE, NULL, NULL);
}
public static void setMouseGrabbed(boolean a){
if(a){
glfwSetInputMode(window, GLFW_CURSOR, <API key>);
}else{
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
}
}
public static void setVSync(boolean a) throws DisplayException{
if(a)glfwSwapInterval(1);
else glfwSwapInterval(0);
}
public static void create(String title,int width,int height,int major,int minor,int sample){
if ( !glfwInit() )
throw new <API key>("Unable to initialize GLFW");
glfwWindowHint(GLFW_SAMPLES, sample); // antialiasing 4x
glfwWindowHint(<API key>, major); // Nous voulons OpenGL 3.3
glfwWindowHint(<API key>, minor);
glfwWindowHint(GLFW_OPENGL_PROFILE, <API key>);
TITLE = title;
displayMode = new DisplayMode(width,height);
window = glfwCreateWindow(displayMode.getWidth(),displayMode.getHeight(), TITLE, NULL, NULL);
}
public static void setSample(int sample){
glfwWindowHint(GLFW_SAMPLES, sample);
}
public static void setResizable(boolean a){
if(a)glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);
else glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
}
public static void setTitle(String title){
TITLE = title;
glfwSetWindowTitle(window, TITLE);
}
public static String getTitle(){
return TITLE;
}
public static boolean wasResized(){
IntBuffer w = BufferUtils.createIntBuffer(1);
IntBuffer h = BufferUtils.createIntBuffer(1);
glfwGetWindowSize(window, w, h);
int width = w.get(0);
int height = h.get(0);
if(Display.getDisplayMode().getWidth() != width || Display.getDisplayMode().getHeight() != height || hasResized){
setDisplayMode(new DisplayMode(width, height));
hasResized = false;
return true;
}else{
return false;
}
}
public static void printMonitorsInfo(){
PointerBuffer monitors = glfwGetMonitors();
GLFWVidMode m;
if(monitors == null){
System.out.println("No monitor detected !");
return;
}
for(int i = 0;i < monitors.capacity();i++){
m = glfwGetVideoMode(monitors.get(i));
System.out.println(glfwGetMonitorName(monitors.get(i)) + "(" + i + ") : " + m.width() + "x" + m.height() + ":" + m.refreshRate() + "Hz");
}
}
public static boolean isCloseRequested(){
return <API key>(window);
}
public static void createContext(){
<API key>(window);
GL.createCapabilities();
}
public static void updateEvent(){
glfwPollEvents();
}
public static void updateFrame(){
glfwSwapBuffers(window);
}
public static DisplayMode getDisplayMode() {
return displayMode;
}
public static void setDisplayMode(DisplayMode displayMode) {
if(Display.displayMode == null || displayMode == null)return;
Display.displayMode.setDisplayMode(displayMode);
hasResized = true;
}
public static void destroy(){
glfwDestroyWindow(window);
glfwTerminate();
}
public static long getWindow() {
return window;
}
}
|
/*
#Date of creation : 9 Jan 2016.
#Aim of program : To print power set of a set of characters.
#Coded by : Rishikesh Agrawani.
*/
package main
import "fmt"
func main() {
var n, r, i, j uint
fmt.Print("Enter the number of binary variables(for which you want the binary combinations): ")
fmt.Scanf("%d", &n)
fmt.Print("\nEnter ", n, " binary variables name( name should be only 1 character long) separated by space: ")
a := make([]string, n)
r = 1
for i = 0; i < n; i++ {
fmt.Scanf("%s", &a[i])
r *= 2
}
fmt.Println("\nColumns => ", n, "\nRows => ", r)
for i = 0; i < r; i++ {
for j = 0; j < n; j++ {
if (i>>j)&1 == 1 {
fmt.Print(a[j], " ")
} else {
fmt.Print("- ")
}
}
fmt.Println()
}
}
/*1st RUN:
Enter the number of binary variables(for which you want the binary combinations): 4
Enter 4 binary variables name( name should be only 1 character long) separated by space: a b c d
Columns => 4
Rows => 16
- - - -
a - - -
- b - -
a b - -
- - c -
a - c -
- b c -
a b c -
- - - d
a - - d
- b - d
a b - d
- - c d
a - c d
- b c d
a b c d
*/
/*2nd RUN:
Enter the number of binary variables(for which you want the binary combinations):
Enter 5 binary variables name( name should be only 1 character long) separated by space:
Columns => 5
Rows => 32
- - - - -
p - - - -
- q - - -
p q - - -
- - r - -
p - r - -
- q r - -
p q r - -
- - - s -
p - - s -
- q - s -
p q - s -
- - r s -
p - r s -
- q r s -
p q r s -
- - - - t
p - - - t
- q - - t
p q - - t
- - r - t
p - r - t
- q r - t
p q r - t
- - - s t
p - - s t
- q - s t
p q - s t
- - r s t
p - r s t
- q r s t
p q r s t
*/
|
#include <tack.h>
MODULE_ID("$Id: menu.c,v 1.1.1.1 2004/03/24 19:53:07 sure Exp $")
/*
Menu control
*/
static void test_byname(struct test_menu *, int *, int *);
struct test_list *augment_test;
char prompt_string[80]; /* menu prompt storage */
/*
** menu_prompt()
**
** Print the menu prompt string.
*/
void
menu_prompt(void)
{
ptext(&prompt_string[1]);
}
/*
** menu_test_loop(test-structure, state, control-character)
**
** This function implements the repeat test function.
*/
static void
menu_test_loop(
struct test_list *test,
int *state,
int *ch)
{
int nch, p;
if ((test->flags & MENU_REP_MASK) && (augment_test != test)) {
/* set the augment variable (first time only) */
p = (test->flags >> 8) & 15;
if ((test->flags & MENU_REP_MASK) == MENU_LM1) {
augment = lines - 1;
} else
if ((test->flags & MENU_ONE_MASK) == MENU_ONE) {
augment = 1;
} else
if ((test->flags & MENU_LC_MASK) == MENU_lines) {
augment = lines * p / 10;
} else
if ((test->flags & MENU_LC_MASK) == MENU_columns) {
augment = columns * p / 10;
} else {
augment = 1;
}
augment_test = test;
set_augment_txt();
}
do {
if ((test->flags | *state) & MENU_CLEAR) {
put_clear();
} else
if (line_count + test->lines_needed >= lines) {
put_clear();
}
nch = 0;
if (test->test_procedure) {
/* The procedure takes precedence so I can pass
the menu entry as an argument.
*/
can_test(test->caps_done, FLAG_TESTED);
can_test(test->caps_tested, FLAG_TESTED);
test->test_procedure(test, state, &nch);
} else
if (test->sub_menu) {
/* nested menu's */
menu_display(test->sub_menu, &nch);
*state = 0;
if (nch == 'q' || nch == 's') {
/* Quit and skip are killed here */
nch = '?';
}
} else {
break; /* cya */
}
if (nch == '\r' || nch == '\n' || nch == 'n') {
nch = 0;
break;
}
} while (nch == 'r');
*ch = nch;
}
/*
** menu_display(menu-structure, flags)
**
** This function implements menu control.
*/
void
menu_display(
struct test_menu *menu,
int *last_ch)
{
int test_state = 0, run_standard_tests;
int hot_topic, ch = 0, nch = 0;
struct test_list *mt;
struct test_list *repeat_tests = 0;
int repeat_state = 0;
int prompt_length;
prompt_length = strlen(prompt_string);
if (menu->ident) {
sprintf(&prompt_string[prompt_length], "/%s", menu->ident);
}
hot_topic = menu->default_action;
run_standard_tests = menu->standard_tests ?
menu->standard_tests[0] : -1;
if (!last_ch) {
last_ch = &ch;
}
while (1) {
if (ch == 0) {
/* Display the menu */
put_crlf();
if (menu->menu_function) {
/*
this function may be used to restrict menu
entries. If used it must print the title.
*/
menu->menu_function(menu);
} else
if (menu->menu_title) {
ptextln(menu->menu_title);
}
for (mt = menu->tests; (mt->flags & MENU_LAST) == 0; mt++) {
if (mt->menu_entry) {
ptext(" ");
ptextln(mt->menu_entry);
}
}
if (menu->standard_tests) {
ptext(" ");
ptextln(menu->standard_tests);
ptextln(" r) repeat test");
ptextln(" s) skip to next test");
}
ptextln(" q) quit");
ptextln(" ?) help");
}
if (ch == 0 || ch == REQUEST_PROMPT) {
put_crlf();
ptext(&prompt_string[1]);
if (hot_topic) {
ptext(" [");
putchp(hot_topic);
ptext("]");
}
ptext(" > ");
/* read a character */
ch = wait_here();
}
if (ch == '\r' || ch == '\n') {
ch = hot_topic;
}
if (ch == 'q') {
break;
}
if (ch == '?') {
ch = 0;
continue;
}
nch = ch;
ch = 0;
/* Run one of the standard tests (by request) */
for (mt = menu->tests; (mt->flags & MENU_LAST) == 0; mt++) {
if (mt->menu_entry && (nch == mt->menu_entry[0])) {
if (mt->flags & MENU_MENU) {
test_byname(menu, &test_state, &nch);
} else {
menu_test_loop(mt, &test_state, &nch);
}
ch = nch;
if ((mt->flags & MENU_COMPLETE) && ch == 0) {
/* top level */
hot_topic = 'q';
ch = '?';
}
}
}
if (menu->standard_tests && nch == 'r') {
menu->resume_tests = repeat_tests;
test_state = repeat_state;
nch = run_standard_tests;
}
if (nch == run_standard_tests) {
if (!(mt = menu->resume_tests)) {
mt = menu->tests;
}
if (mt->flags & MENU_LAST) {
mt = menu->tests;
}
/* Run the standard test suite */
for ( ; (mt->flags & MENU_LAST) == 0; ) {
if ((mt->flags & MENU_NEXT) == MENU_NEXT) {
repeat_tests = mt;
repeat_state = test_state;
nch = run_standard_tests;
menu_test_loop(mt, &test_state, &nch);
if (nch != 0 && nch != 'n') {
ch = nch;
break;
}
if (test_state & MENU_STOP) {
break;
}
}
mt++;
}
if (ch == 0) {
ch = hot_topic;
}
menu->resume_tests = mt;
menu->resume_state = test_state;
menu->resume_char = ch;
if (ch == run_standard_tests) {
/* pop up a level */
break;
}
}
}
*last_ch = ch;
prompt_string[prompt_length] = '\0';
}
/*
** <API key>(test_list)
**
** Print the Done message and request input.
*/
void
<API key>(
struct test_list *test,
int *state,
int *ch)
{
char done_message[128];
if (test->caps_done) {
sprintf(done_message, "(%s) Done ", test->caps_done);
ptext(done_message);
} else {
ptext("Done ");
}
*ch = wait_here();
if (*ch == '\r' || *ch == '\n' || *ch == 'n') {
*ch = 0;
}
if (*ch == 's') {
*state |= MENU_STOP;
*ch = 0;
}
}
/*
** menu_clear_screen(test, state, ch)
**
** Just clear the screen.
*/
void
menu_clear_screen(
struct test_list *test GCC_UNUSED,
int *state GCC_UNUSED,
int *ch GCC_UNUSED)
{
put_clear();
}
/*
** menu_reset_init(test, state, ch)
**
** Send the reset and init strings.
*/
void
menu_reset_init(
struct test_list *test GCC_UNUSED,
int *state GCC_UNUSED,
int *ch GCC_UNUSED)
{
reset_init();
put_crlf();
}
/*
** subtest_menu(test, state, ch)
**
** Scan the menu looking for something to execute
** Return TRUE if we found anything.
*/
int
subtest_menu(
struct test_list *test,
int *state,
int *ch)
{
struct test_list *mt;
if (*ch) {
for (mt = test; (mt->flags & MENU_LAST) == 0; mt++) {
if (mt->menu_entry && (*ch == mt->menu_entry[0])) {
*ch = 0;
menu_test_loop(mt, state, ch);
return TRUE;
}
}
}
return FALSE;
}
/*
** menu_can_scan(menu-structure)
**
** Recursively scan the menu tree and find which cap names can be tested.
*/
void
menu_can_scan(
const struct test_menu *menu)
{
struct test_list *mt;
for (mt = menu->tests; (mt->flags & MENU_LAST) == 0; mt++) {
can_test(mt->caps_done, FLAG_CAN_TEST);
can_test(mt->caps_tested, FLAG_CAN_TEST);
if (!(mt->test_procedure)) {
if (mt->sub_menu) {
menu_can_scan(mt->sub_menu);
}
}
}
}
/*
** menu_search(menu-structure, cap)
**
** Recursively search the menu tree and execute any tests that use cap.
*/
static void
menu_search(
struct test_menu *menu,
int *state,
int *ch,
char *cap)
{
struct test_list *mt;
int nch;
for (mt = menu->tests; (mt->flags & MENU_LAST) == 0; mt++) {
nch = 0;
if (cap_match(mt->caps_done, cap)
|| cap_match(mt->caps_tested, cap)) {
menu_test_loop(mt, state, &nch);
}
if (!(mt->test_procedure)) {
if (mt->sub_menu) {
menu_search(mt->sub_menu, state, &nch, cap);
}
}
if (*state & MENU_STOP) {
break;
}
if (nch != 0 && nch != 'n') {
*ch = nch;
break;
}
}
}
/*
** test_byname(menu, state, ch)
**
** Get a cap name then run all tests that use that cap.
*/
static void
test_byname(
struct test_menu *menu,
int *state GCC_UNUSED,
int *ch)
{
int test_state = 0;
char cap[32];
if (tty_can_sync == SYNC_NOT_TESTED) {
verify_time();
}
ptext("enter name: ");
read_string(cap, sizeof(cap));
if (cap[0]) {
menu_search(menu, &test_state, ch, cap);
}
*ch = '?';
}
|
#ifndef <API key>
#define <API key>
#include "Feature.hpp"
#include <lv2/uri-map.lv2/uri-map.h>
namespace Lv2 {
namespace Internal {
class UriMap;
class UriMapFeature : public Feature
{
public:
UriMapFeature (UriMap* uriMap);
LV2_Feature* lv2Feature ();
void initialize (LV2_Feature*, const Lv2Plugin&) const {};
void cleanup (LV2_Feature*) const {};
private:
static uint32_t uriToId (<API key> cbData, const char* map, const char* uri);
LV2_Feature m_feature;
LV2_URI_Map_Feature m_data;
UriMap* m_uriMap;
};
} // Internal
} // Lv2
#endif
// vim: tw=90 ts=8 sw=2 sts=2 et sta noai
|
<div class="wide form">
<?php $form=$this->beginWidget('CActiveForm', array(
'action'=>Yii::app()->createUrl($this->route),
'method'=>'get',
)); ?>
<div class="row">
<?php echo $form->label($model,'id'); ?>
<?php echo $form->textField($model,'id',array('size'=>20,'maxlength'=>20)); ?>
</div>
<div class="row">
<?php echo $form->label($model,'executed_at'); ?>
<?php echo $form->textField($model,'executed_at'); ?>
</div>
<div class="row">
<?php echo $form->label($model,'class'); ?>
<?php echo $form->textField($model,'class',array('size'=>8,'maxlength'=>8)); ?>
</div>
<div class="row">
<?php echo $form->label($model,'amount'); ?>
<?php echo $form->textField($model,'amount',array('size'=>20,'maxlength'=>20)); ?>
</div>
<div class="row">
<?php echo $form->label($model,'charge_account'); ?>
<?php echo $form->textField($model,'charge_account',array('size'=>10,'maxlength'=>10)); ?>
</div>
<div class="row">
<?php echo $form->label($model,'deposit_account'); ?>
<?php echo $form->textField($model,'deposit_account',array('size'=>10,'maxlength'=>10)); ?>
</div>
<div class="row">
<?php echo $form->label($model,'charge_user'); ?>
<?php echo $form->textField($model,'charge_user',array('size'=>10,'maxlength'=>10)); ?>
</div>
<div class="row">
<?php echo $form->label($model,'deposit_user'); ?>
<?php echo $form->textField($model,'deposit_user',array('size'=>10,'maxlength'=>10)); ?>
</div>
<div class="row">
<?php echo $form->label($model,'subject'); ?>
<?php echo $form->textField($model,'subject',array('size'=>60,'maxlength'=>255)); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton('Search'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- search-form -->
|
import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
self.__root.title(param['title'])
self.__root.geometry('%sx%s+%s+%s' % (param['w'],
param['h'],
param['x'],
param['y']
))
else:
# inside
self.__root = root
self.bd = param['bd']
if main_frame is None:
# standalone
main_f = tkinter.Frame(master=self.__root, bg='black', bd=self.bd)
main_f.pack(fill='both', expand=True)
else:
# inside
main_f = main_frame
self.make_widgets(main_f)
@property
def root(self):
return self.__root
def close(self):
self.__root.destroy()
self.__root.quit()
# Override
def make_widgets(self, main_frame):
pass
# Override
def params(self):
param = {
'x': 0,
'y': 0,
'w': 500,
'h': 500,
'title': '% Type Prog Title Here %',
}
return param
def mk_scrollable_area(obj, obj_frame, sbars):
obj.grid(row=0, column=0, sticky='NSWE')
if 'y' in sbars:
y_scrollbar = tkinter.ttk.Scrollbar(obj_frame)
y_scrollbar.grid(row=0, column=1, sticky='NS')
y_scrollbar['command'] = obj.yview
obj['yscrollcommand'] = y_scrollbar.set
if 'x' in sbars:
x_scrollbar = tkinter.ttk.Scrollbar(obj_frame, orient='horizontal')
x_scrollbar.grid(row=1, column=0, sticky='WE')
x_scrollbar['command'] = obj.xview
obj['xscrollcommand'] = x_scrollbar.set
obj_frame.columnconfigure(1, 'minsize')
obj_frame.columnconfigure(0, weight=1)
obj_frame.rowconfigure(1, 'minsize')
obj_frame.rowconfigure(0, weight=1)
def mk_listbox(frame, side='top', sbars='y', sel_mode=tkinter.EXTENDED):
BORDER = 0
COLOR = 'grey'
listbox_frame = tkinter.Frame(frame, bg=COLOR, bd=BORDER)
listbox_frame.pack(side=side, fill='both', expand=True)
listbox = tkinter.Listbox(listbox_frame, selectmode=sel_mode)
mk_scrollable_area(listbox, listbox_frame, sbars)
return listbox
def mk_treeview(frame, side='top', sbars='y'):
BORDER = 0
COLOR = 'grey'
treeview_frame = tkinter.Frame(frame, bg=COLOR, bd=BORDER)
treeview_frame.pack(side=side, fill='both', expand=True)
treeview = tkinter.ttk.Treeview(treeview_frame)
mk_scrollable_area(treeview, treeview_frame, sbars)
return treeview
|
// This program is free software; you can redistribute it and/or
// This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Contact: info@doctor-doc.com
package ch.dbs.actions.bestellung;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.<API key>;
import javax.xml.parsers.<API key>;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.<API key>;
import javax.xml.xpath.XPathFactory;
import org.apache.commons.lang.StringEscapeUtils;
import org.jsoup.Jsoup;
import org.jsoup.safety.Whitelist;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import util.CodeUrl;
import util.Http;
import ch.dbs.form.JournalDetails;
import enums.Connect;
/**
* This class reads answers from the normal EZB UI searched with the parameter
* xmloutput=1 to get XML.
*/
public class EZBXML {
private static final Logger LOG = LoggerFactory.getLogger(EZBXML.class);
public List<JournalDetails> searchByTitle(final String jtitle, final String bibid) {
final Http http = new Http();
final CodeUrl coder = new CodeUrl();
final StringBuffer link = new StringBuffer(
"http://ezb.uni-regensburg.de/ezeit/searchres.phtml?xmloutput=1&colors=7&lang=de&jq_type1=KT&jq_bool2=AND&jq_not2=+&jq_type2=KS&jq_term2=&jq_bool3=AND&jq_not3=+&jq_type3=PU&jq_term3=&offset=-1&hits_per_page=30&search_journal=Suche+starten&Notations%5B%5D=all&selected_colors%5B%5D=1&selected_colors%5B%5D=2&selected_colors%5B%5D=4&bibid=");
link.append(bibid);
link.append("&jq_term1=");
link.append(coder.encode(jtitle, "ISO-8859-1"));
String content = http.getContent(link.toString(), Connect.TIMEOUT_2.getValue(), Connect.TRIES_2.getValue(),
null);
// if we have > 30 hits, try a more concise search using: &jq_type1=KS (title starts with) instead of &jq_type1=KT (words in title)
if (content != null && content.contains("<search_count>")) {
final int x = Integer.parseInt(content.substring(content.indexOf("<search_count>") + 14,
content.indexOf("</search_count>")));
if (x > 30) {
final StringBuffer link2 = new StringBuffer(
"http://ezb.uni-regensburg.de/ezeit/searchres.phtml?xmloutput=1&colors=7&lang=de&jq_type1=KS&jq_bool2=AND&jq_not2=+&jq_type2=KS&jq_term2=&jq_bool3=AND&jq_not3=+&jq_type3=PU&jq_term3=&offset=-1&hits_per_page=30&search_journal=Suche+starten&Notations%5B%5D=all&selected_colors%5B%5D=1&selected_colors%5B%5D=2&selected_colors%5B%5D=4&bibid=");
link2.append(bibid);
link2.append("&jq_term1=");
link2.append(coder.encode(jtitle, "ISO-8859-1"));
content = http.getContent(link2.toString(), Connect.TIMEOUT_2.getValue(), Connect.TRIES_2.getValue(),
null);
}
}
final List<String> jourids = getJourids(content);
return searchByJourids(jourids, bibid);
}
public List<JournalDetails> searchByIssn(final String issn, final String bibid) {
final Http http = new Http();
final StringBuffer link = new StringBuffer(
"http://ezb.uni-regensburg.de/ezeit/searchres.phtml?xmloutput=1&colors=5&lang=de&jq_type1=KT&jq_term1=&jq_bool2=AND&jq_not2=+&jq_type2=KS&jq_term2=&jq_bool3=AND&jq_not3=+&jq_type3=PU&jq_term3=&jq_bool4=AND&jq_not4=+&jq_type4=IS&offset=-1&hits_per_page=50&search_journal=Suche+starten&Notations%5B%5D=all&selected_colors%5B%5D=1&selected_colors%5B%5D=2&selected_colors%5B%5D=4&bibid=");
link.append(bibid);
link.append("&jq_term4=");
link.append(issn);
final String content = http.getContent(link.toString(), Connect.TIMEOUT_2.getValue(),
Connect.TRIES_2.getValue(), null);
final List<String> jourids = getJourids(content);
return searchByJourids(jourids, bibid);
}
public List<JournalDetails> searchByJourids(final List<String> jourids, final String bibid) {
final List<JournalDetails> list = new ArrayList<JournalDetails>();
final Http http = new Http();
final StringBuffer link = new StringBuffer(
"http://rzblx1.uni-regensburg.de/ezeit/detail.phtml?xmloutput=1&colors=7&lang=de&bibid=");
link.append(bibid);
link.append("&jour_id=");
final StringBuffer infoLink = new StringBuffer(
"http://ezb.uni-regensburg.de/ezeit/detail.phtml?colors=7&lang=de&bibid=");
infoLink.append(bibid);
infoLink.append("&jour_id=");
try {
for (final String jourid : jourids) {
final JournalDetails jd = new JournalDetails();
final String content = http.getContent(link.toString() + jourid, Connect.TIMEOUT_1.getValue(),
Connect.TRIES_1.getValue(), null);
if (content != null) {
final <API key> domFactory = <API key>.newInstance();
domFactory.setNamespaceAware(true);
final DocumentBuilder builder = domFactory.newDocumentBuilder();
final Document doc = builder.parse(new InputSource(new StringReader(content)));
final XPathFactory factory = XPathFactory.newInstance();
final XPath xpath = factory.newXPath();
final XPathExpression exprJournal = xpath.compile("//journal");
final XPathExpression exprPissns = xpath.compile("//journal/detail/P_ISSNs");
final XPathExpression exprEissns = xpath.compile("//journal/detail/E_ISSNs");
final NodeList resultJournal = (NodeList) exprJournal.evaluate(doc, XPathConstants.NODESET);
for (int i = 0; i < resultJournal.getLength(); i++) {
final Node firstResultNode = resultJournal.item(i);
final Element journal = (Element) firstResultNode;
// Title
String title = getValue(journal.<API key>("title"));
if (title != null) {
title = Jsoup.clean(title, Whitelist.none());
title = Jsoup.parse(title).text();
}
jd.<API key>(title);
// P-ISSNs
final NodeList resultPissns = (NodeList) exprPissns.evaluate(doc, XPathConstants.NODESET);
// get first pissn
for (int z = 0; z < resultPissns.getLength(); z++) {
final Node firstPissnsNode = resultPissns.item(i);
final Element pissnElement = (Element) firstPissnsNode;
final String pissn = getValue(pissnElement.<API key>("P_ISSN"));
jd.setIssn(pissn);
}
// try to get Eissn if we have no Pissn
if (jd.getIssn() == null) {
// E-ISSNs
final NodeList resultEissns = (NodeList) exprEissns.evaluate(doc, XPathConstants.NODESET);
// get first eissn
for (int z = 0; z < resultEissns.getLength(); z++) {
final Node firstEissnsNode = resultEissns.item(i);
final Element eissnElement = (Element) firstEissnsNode;
final String eissn = getValue(eissnElement.<API key>("E_ISSN"));
jd.setIssn(eissn);
}
}
// add info link
jd.setLink(infoLink.toString() + jourid);
list.add(jd);
}
}
}
} catch (final <API key> e) {
LOG.error(e.toString());
} catch (final SAXParseException e) {
LOG.error(e.toString());
} catch (final SAXException e) {
LOG.error(e.toString());
} catch (final IOException e) {
LOG.error(e.toString());
} catch (final <API key> e) {
LOG.error(e.toString());
} catch (final Exception e) {
LOG.error(e.toString());
}
return list;
}
private List<String> getJourids(final String content) {
final List<String> result = new ArrayList<String>();
try {
if (content != null) {
final <API key> domFactory = <API key>.newInstance();
domFactory.setNamespaceAware(true);
final DocumentBuilder builder = domFactory.newDocumentBuilder();
final Document doc = builder.parse(new InputSource(new StringReader(content)));
final XPathFactory factory = XPathFactory.newInstance();
final XPath xpath = factory.newXPath();
final XPathExpression exprJournals = xpath.compile("//journals/journal");
final NodeList journals = (NodeList) exprJournals.evaluate(doc, XPathConstants.NODESET);
for (int i = 0; i < journals.getLength(); i++) {
final Node firstResultNode = journals.item(i);
final Element journal = (Element) firstResultNode;
final String id = journal.getAttribute("jourid");
if (id != null) {
result.add(id);
}
}
}
} catch (final <API key> e) {
LOG.error(e.toString());
} catch (final SAXParseException e) {
LOG.error(e.toString());
} catch (final SAXException e) {
LOG.error(e.toString());
} catch (final IOException e) {
LOG.error(e.toString());
} catch (final <API key> e) {
LOG.error(e.toString());
} catch (final Exception e) {
LOG.error(e.toString());
}
return result;
}
private String getValue(final NodeList list) {
String result = null;
final Element listElement = (Element) list.item(0);
if (listElement != null) {
final NodeList textList = listElement.getChildNodes();
if (textList.getLength() > 0) {
result = StringEscapeUtils.unescapeXml(textList.item(0).getNodeValue());
}
}
return result;
}
}
|
# Puluc
language: C. Game: Puluc
I don't know if it is working well but if you have time, you can modify it.
|
#ifndef Podd_THaVDCPoint_h_
#define Podd_THaVDCPoint_h_
// THaVDCPoint //
// A pair of one U and one V VDC cluster in a given VDC chamber //
#include "THaCluster.h"
#include "THaVDCCluster.h"
class THaVDCChamber;
class THaTrack;
class THaVDCPoint : public THaCluster {
public:
THaVDCPoint( THaVDCCluster* u_cl, THaVDCCluster* v_cl,
THaVDCChamber* chamber );
virtual ~THaVDCPoint() {}
void CalcDetCoords();
// Get and Set Functions
THaVDCCluster* GetUCluster() const { return fUClust; }
THaVDCCluster* GetVCluster() const { return fVClust; }
THaVDCChamber* GetChamber() const { return fChamber; }
THaVDCPoint* GetPartner() const { return fPartner; }
THaTrack* GetTrack() const { return fTrack; }
Double_t GetU() const;
Double_t GetV() const;
Double_t GetX() const { return fX; }
Double_t GetY() const { return fY; }
Double_t GetTheta() const { return fTheta; }
Double_t GetPhi() const { return fPhi; }
Int_t GetTrackIndex() const;
Double_t GetZU() const;
Double_t GetZV() const;
Double_t GetZ() const { return GetZU(); }
Bool_t HasPartner() const { return (fPartner != 0); }
void CalcChisquare(Double_t &chi2, Int_t &nhits) const;
void SetTrack( THaTrack* track);
void SetPartner( THaVDCPoint* partner) { fPartner = partner;}
void SetSlopes( Double_t mu, Double_t mv );
protected:
THaVDCCluster* fUClust; // Cluster in the U plane
THaVDCCluster* fVClust; // Cluster in the V plane
THaVDCChamber* fChamber; // Chamber of this cluster pair
THaTrack* fTrack; // Track that this point is associated with
THaVDCPoint* fPartner; // Point associated with this one in
// the other chamber
// Detector system coordinates derived from fUClust and fVClust
// at the U plane (z = GetZ()). X,Y in m; theta, phi in tan(angle)
Double_t fX; // X position of point in U wire plane
Double_t fY; // Y position of point in U wire plane
Double_t fTheta; // tan(angle between z-axis and track proj onto xz plane)
Double_t fPhi; // tan(angle between z-axis and track proj onto yz plane)
void Set( Double_t x, Double_t y, Double_t theta, Double_t phi )
{ fX = x; fY = y; fTheta = theta; fPhi = phi; }
private:
// Hide copy ctor and op=
THaVDCPoint( const THaVDCPoint& );
THaVDCPoint& operator=( const THaVDCPoint& );
ClassDef(THaVDCPoint,0) // Pair of one U and one V cluster in a VDC chamber
};
inline
Double_t THaVDCPoint::GetU() const
{
// Return intercept of u cluster
return fUClust->GetIntercept();
}
//<API key>
inline
Double_t THaVDCPoint::GetV() const
{
// Return intercept of v cluster
return fVClust->GetIntercept();
}
#endif
|
import os, socket, sys, urllib
from wx.lib.embeddedimage import PyEmbeddedImage
ldc_name = "Live Debian Creator"
ldc_cli_version = "1.4.0"
ldc_gui_version = "1.11.0"
if (sys.platform == "win32"):
slash = "\\"
if os.path.isfile(sys.path[0]): #fix for compiled binaries
homepath = os.path.dirname(sys.path[0]) + slash
else:
homepath = sys.path[0] + slash
else:
slash = "/"
#socket.setdefaulttimeout(10)
def defineBrowserAgent(uiname, uiversion):
class AppURLopener(urllib.FancyURLopener):
version = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
#version = uiname + " " + uiversion + " / " + sys.platform
urllib._urlopener = AppURLopener()
bookico = PyEmbeddedImage(
"<API key>"
"REFUWIWtl09sFFUcxz/iYN+<API key>"
"<API key>/f7"
"+ztv4CGPqamp9A/<API key>+7K+10S/tJ9OpBBPASCdnH/k/wFNTU+nzc/+M"
"2v925a2N21Sq1yKJg/<API key>+e/6yw6gT60+72iK7AVJJSBoCBihD"
"AVC6WK7O3bx3+thFyY30ycSH7+w5FNXXcQgymUzaei49+vHMX/kq/SqpYGiDRbYHlBFoigMu"
"<API key>+<API key>+BgVaqIhi"
"<API key>"
"<API key>/<API key>"
"dKBFQu+AdjsnsG/AOpzc+<API key>+<API key>"
"ZYbg+<API key>"
"PQmN6P4qBNAgGlw/jqJp9vKKBtVILrA4nA+<API key>+sLKr"
"<API key>+<API key>"
"z8n8559kdmzbYW/evLnalgAGmLr+<API key>+Fs5"
"<API key>"
"<API key>+DAdY6"
"<API key>/eA+<API key>"
"<API key>+<API key>"
"Y29tQcBonG4Ta6k/<API key>+AB+0rTt4hov/lpQ0lrKDT/F66y3IjLN9rmh"
"<API key>"
"jdzOmjxwotbVf656+/<API key>/WXRIFpwXVhebgxCkwdu"
"/33b/kXY94VD/<API key>+vd2jbx6cCIt19Gf0"
"<API key>+<API key>"
"3fGvmW3bauyzE/<API key>+<API key>"
"/<API key>+/+<API key>=")
getbookicoIcon = bookico.GetIcon
|
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http:
<head>
<title>schrodinger.application.desmond.enhsamp.Series</title>
<link rel="stylesheet" href="epydoc.css" type="text/css" />
<script type="text/javascript" src="epydoc.js"></script>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
alink="#204080">
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th> <a
href="schrodinger-module.html">Home</a> </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
>Suite 2012 Schrodinger Python API</th>
</tr></table></th>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="100%">
<span class="breadcrumbs">
<a href="schrodinger-module.html">Package schrodinger</a> ::
<a href="schrodinger.application-module.html">Package application</a> ::
<a href="schrodinger.application.desmond-module.html">Package desmond</a> ::
<a href="schrodinger.application.desmond.enhsamp-module.html">Module enhsamp</a> ::
Class Series
</span>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<!-- hide/show private -->
<tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
onclick="toggle_private();">hide private</a>]</span></td></tr>
<tr><td align="right"><span class="options"
>[<a href="frames.html" target="_top">frames</a
>] | <a href="schrodinger.application.desmond.enhsamp.Series-class.html"
target="_top">no frames</a>]</span></td></tr>
</table>
</td>
</tr>
</table>
<h1 class="epydoc">Class Series</h1><p class="nomargin-top"></p>
<pre class="base-tree">
object
|
<a href="schrodinger.application.desmond.enhsamp.Node-class.html">Node</a>
|
<strong class="uidshort">Series</strong>
</pre>
<hr />
<a name="<API key>"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Instance Methods</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#<API key>"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="schrodinger.application.desmond.enhsamp.Series-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">env</span>,
<span class="summary-sig-arg">iters</span>,
<span class="summary-sig-arg">value</span>)</span><br />
x.__init__(...) initializes x; see help(type(x)) for signature</td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="schrodinger.application.desmond.enhsamp.Series-class.html#get_type" class="summary-sig-name">get_type</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">env</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="schrodinger.application.desmond.enhsamp.Series-class.html#__str__" class="summary-sig-name">__str__</a>(<span class="summary-sig-arg">self</span>)</span><br />
str(x)</td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" class="summary">
<p class="<API key>"><b>Inherited from <code><a href="schrodinger.application.desmond.enhsamp.Node-class.html">Node</a></code></b>:
<code><a href="schrodinger.application.desmond.enhsamp.Node-class.html#constant_fold">constant_fold</a></code>,
<code><a href="schrodinger.application.desmond.enhsamp.Node-class.html#resolve_atomsel">resolve_atomsel</a></code>
</p>
<p class="<API key>"><b>Inherited from <code>object</code></b>:
<code>__delattr__</code>,
<code>__format__</code>,
<code>__getattribute__</code>,
<code>__hash__</code>,
<code>__new__</code>,
<code>__reduce__</code>,
<code>__reduce_ex__</code>,
<code>__repr__</code>,
<code>__setattr__</code>,
<code>__sizeof__</code>,
<code>__subclasshook__</code>
</p>
</td>
</tr>
</table>
<a name="section-Properties"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Properties</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-Properties"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" class="summary">
<p class="<API key>"><b>Inherited from <code>object</code></b>:
<code>__class__</code>
</p>
</td>
</tr>
</table>
<a name="<API key>"></a>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Method Details</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#<API key>"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
</table>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">env</span>,
<span class="sig-arg">iters</span>,
<span class="sig-arg">value</span>)</span>
<br /><em class="fname">(Constructor)</em>
</h3>
</td><td align="right" valign="top"
>
</td>
</tr></table>
<p>x.__init__(...) initializes x; see help(type(x)) for signature</p>
<dl class="fields">
<dt>Overrides:
object.__init__
<dd><em class="note">(inherited documentation)</em></dd>
</dt>
</dl>
</td></tr></table>
</div>
<a name="get_type"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">get_type</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">env</span>)</span>
</h3>
</td><td align="right" valign="top"
>
</td>
</tr></table>
<dl class="fields">
<dt>Overrides:
<a href="schrodinger.application.desmond.enhsamp.Node-class.html#get_type">Node.get_type</a>
</dt>
</dl>
</td></tr></table>
</div>
<a name="__str__"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">__str__</span>(<span class="sig-arg">self</span>)</span>
<br /><em class="fname">(Informal representation operator)</em>
</h3>
</td><td align="right" valign="top"
>
</td>
</tr></table>
<p>str(x)</p>
<dl class="fields">
<dt>Overrides:
object.__str__
<dd><em class="note">(inherited documentation)</em></dd>
</dt>
</dl>
</td></tr></table>
</div>
<br />
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th> <a
href="schrodinger-module.html">Home</a> </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
>Suite 2012 Schrodinger Python API</th>
</tr></table></th>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Tue Sep 25 02:22:59 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
>http://epydoc.sourceforge.net</a>
</td>
</tr>
</table>
<script type="text/javascript">
<!
// Private objects are initially displayed (because if
// javascript is turned off then we want them to be
// visible); but by default, we want to hide them. So hide
// them unless we have a cookie that says to show them.
checkCookie();
</script>
</body>
</html>
|
#include "phpdocsconfig.h"
#include <KLocalizedString>
#include <KPluginFactory>
#include <KPluginLoader>
#include <KConfigGroup>
#include <KUrlRequester>
#include <KAboutData>
#include <KFile>
#include <ksettings/Dispatcher>
#include "phpdocssettings.h"
#include "ui_phpdocsconfig.h"
<API key>(<API key>, "kcm_kdevphpdocs.json", registerPlugin<PhpDocsConfig>();)
PhpDocsConfig::PhpDocsConfig(QWidget *parent, const QVariantList &args)
: KCModule(KAboutData::pluginData(QStringLiteral("kcm_kdevphpdocs")), parent, args)
{
QVBoxLayout * l = new QVBoxLayout( this );
QWidget* w = new QWidget;
m_configWidget = new Ui::PhpDocsConfigUI;
m_configWidget->setupUi( w );
m_configWidget->kcfg_phpDocLocation->setMode( KFile::Directory | KFile::ExistingOnly );
l->addWidget( w );
addConfig( PhpDocsSettings::self(), w );
load();
}
void PhpDocsConfig::save()
{
KCModule::save();
// looks like we have to force a write so readConfig() can get the new values
PhpDocsSettings::self()->save();
KSettings::Dispatcher::<API key>( componentData().componentName() );
}
PhpDocsConfig::~PhpDocsConfig()
{
delete m_configWidget;
}
#include "phpdocsconfig.moc"
|
<?php $st_buttons_p = ot_get_option('st_buttons_p'); ?>
<?php $sidebar_checkbox = get_post_meta($post->ID, 'sidebar_checkbox', true);?>
<?php $full_width = get_post_meta($post->ID, '<API key>', true);?>
<?php $details = get_post_meta($post->ID, '<API key>', true); if($details){$details = array_filter($details);};?>
<?php $terms = get_the_terms($post->ID, 'portfolio_tags' ); ?>
<?php $share = get_post_meta($post->ID, '<API key>', true);?>
<?php get_header(); ?>
<?php //get_template_part('includes/title-breadcrumb' ) ?>
<div id="main" class="inner-page <?php if ($sidebar_checkbox){?><API key><?php }?>">
<div class="container">
<div class="row">
<div class="<?php if ($full_width){?>col-md-12<?php }else{?>col-md-9<?php }?> page-content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php get_template_part('includes/<API key>' );?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.', GETTEXT_DOMAIN) ?></p>
<?php endif; ?>
</div>
<?php if (!$full_width){?>
<div class="col-md-3">
<?php if ( is_active_sidebar(4)||!empty($details) || $terms || !$share ){?>
<div class="sidebar">
<?php if ( !empty($details) || $terms || !$share ){?>
<div class="widget <API key>">
<ul>
<?php if($details){ ?>
<?php $separator = "%%";
$output = '';
foreach ($details as $item) {
if($item){
list($item_text1, $item_text2) = explode($separator, trim($item));
$output .= '<li><strong>' . $item_text1 . ':</strong> ' . do_shortcode($item_text2) . '</li>';
}
}
echo $output;?>
<?php } ?>
<?php if($terms){?>
<li class="tags">
<?php if($terms) : foreach ($terms as $term) { ?>
<?php echo '<a title="'.$term->name.'" href="'.get_term_link($term->slug, 'portfolio_tags').'">'.$term->name.'</a>'?>
<?php } endif;?>
<div class="clearfix"></div>
</li>
<?php }?>
<?php if(!$share&&$st_buttons_p){?>
<li class="st-share-portfolio"><strong><?php _e( 'Share', GETTEXT_DOMAIN);?>:</strong>
<?php echo $st_buttons_p;?>
</li>
<?php }?>
</ul>
</div>
<?php }?>
<?php if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Portfolio Post Sidebar') ) ?>
</div>
<?php } ?>
</div>
<?php }?>
</div>
</div>
</div>
<?php get_footer(); ?>
|
#ifndef XTENSA_RELAX_H
#define XTENSA_RELAX_H
#include "xtensa-isa.h"
/* Data structures for the table-driven relaxations for Xtensa processors.
See xtensa-relax.c for details. */
typedef struct transition_list TransitionList;
typedef struct transition_table TransitionTable;
typedef struct transition_rule TransitionRule;
typedef struct precondition_list PreconditionList;
typedef struct precondition Precondition;
typedef struct req_or_option_list ReqOrOptionList;
typedef struct req_or_option_list ReqOrOption;
typedef struct req_option_list ReqOptionList;
typedef struct req_option_list ReqOption;
struct transition_table
{
int num_opcodes;
TransitionList **table; /* Possible transitions for each opcode. */
};
struct transition_list
{
TransitionRule *rule;
TransitionList *next;
};
struct precondition_list
{
Precondition *precond;
PreconditionList *next;
};
/* The required options for a rule are represented with a two-level
structure, with leaf expressions combined by logical ORs at the
lower level, and the results then combined by logical ANDs at the
top level. The AND terms are linked in a list, and each one can
contain a reference to a list of OR terms. The leaf expressions,
i.e., the OR options, can be negated by setting the is_true field
to FALSE. There are two classes of leaf expressions: (1) those
that are properties of the Xtensa configuration and can be
evaluated once when building the tables, and (2) those that depend
of the state of directives or other settings that may vary during
the assembly. The following expressions may be used in group (1):
IsaUse*: Xtensa configuration settings.
realnop: TRUE if the instruction set includes a NOP instruction.
There are currently no expressions in group (2), but they are still
supported since there is a good chance they'll be needed again for
something. */
struct req_option_list
{
ReqOrOptionList *or_option_terms;
ReqOptionList *next;
};
struct req_or_option_list
{
char *option_name;
bfd_boolean is_true;
ReqOrOptionList *next;
};
/* Operand types and constraints on operands: */
typedef enum op_type OpType;
typedef enum cmp_op CmpOp;
enum op_type
{
OP_CONSTANT,
OP_OPERAND,
OP_OPERAND_LOW8, /* Sign-extended low 8 bits of immed. */
OP_OPERAND_HI24S, /* High 24 bits of immed,
plus 0x100 if low 8 bits are signed. */
OP_OPERAND_F32MINUS, /* 32 - immed. */
OP_OPERAND_LOW16U, /* Low 16 bits of immed. */
OP_OPERAND_HI16U, /* High 16 bits of immed. */
OP_LITERAL,
OP_LABEL
};
enum cmp_op
{
OP_EQUAL,
OP_NOTEQUAL,
};
struct precondition
{
CmpOp cmp;
int op_num;
OpType typ; /* CONSTANT: op_data is a constant.
OPERAND: operand op_num must equal op_data.
Cannot be LITERAL or LABEL. */
int op_data;
};
typedef struct build_op BuildOp;
struct build_op
{
int op_num;
OpType typ;
unsigned op_data; /* CONSTANT: op_data is the value to encode.
OPERAND: op_data is the field in the
source instruction to take the value from
and encode in the op_num field here.
LITERAL or LABEL: op_data is the ordinal
that identifies the appropriate one, i.e.,
there can be more than one literal or
label in an expansion. */
BuildOp *next;
};
typedef struct build_instr BuildInstr;
typedef enum instr_type InstrType;
enum instr_type
{
INSTR_INSTR,
INSTR_LITERAL_DEF,
INSTR_LABEL_DEF
};
struct build_instr
{
InstrType typ;
unsigned id; /* LITERAL_DEF or LABEL_DEF: an ordinal to
identify which one. */
xtensa_opcode opcode; /* Unused for LITERAL_DEF or LABEL_DEF. */
BuildOp *ops;
BuildInstr *next;
};
struct transition_rule
{
xtensa_opcode opcode;
PreconditionList *conditions;
ReqOptionList *options;
BuildInstr *to_instr;
};
typedef int (*transition_cmp_fn) (const TransitionRule *,
const TransitionRule *);
extern TransitionTable *<API key> (transition_cmp_fn);
extern TransitionTable *<API key> (transition_cmp_fn);
extern bfd_boolean <API key> (OpType);
extern long <API key> (OpType, long);
#endif /* !XTENSA_RELAX_H */
|
<?php
/**
* template_lite upper modifier plugin
*
* Type: modifier
* Name: upper
* Purpose: Wrapper for the PHP 'strtoupper' function
*/
function tpl_modifier_upper($string) {
return strtoupper($string);
}
?>
|
.<API key> {
/*disable text selection*/
}
.<API key> .switch-options {
min-height: 30px;
margin-right: 10px;
}
.<API key> .switch-options label {
cursor: pointer;
}
.<API key> .switch-options input {
display: none;
}
.<API key> .cb-enable span,
.<API key> .cb-disable span {
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
-ms-user-select: none;
user-select: none;
}
.<API key> .cb-enable,
.<API key> .cb-disable,
.<API key> .cb-enable span,
.<API key> .cb-disable span {
display: block;
float: left;
}
.<API key> .cb-enable span,
.<API key> .cb-disable span {
line-height: 30px;
display: block;
font-weight: 700;
}
.<API key> .cb-enable,
.<API key> .cb-disable {
padding: 0 10px;
border-width: 1px;
border-style: solid;
-webkit-appearance: none;
professional-space: nowrap;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.<API key> .cb-enable {
border-right: 0;
border-radius: 3px 0px 0px 3px;
-moz-border-radius: 3px 0px 0px 3px;
-<API key>: 3px 0px 0px 3px;
}
.<API key> .cb-disable {
border-left: 0;
border-radius: 0px 3px 3px 0px;
-moz-border-radius: 0px 3px 3px 0px;
-<API key>: 0px 3px 3px 0px;
}
.<API key> .cb-disable.selected {
color: #fff;
}
.<API key> .cb-enable.selected {
color: #fff;
}
|
# encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python3/dist-packages/PyKDE4/kdeui.<API key>.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtGui as __PyQt4_QtGui
import PyQt4.QtSvg as __PyQt4_QtSvg
class <API key>(__PyQt4_QtCore.QObject, __PyKDE4_kdecore.KMessageHandler):
# no doc
def message(self, *args, **kwargs): # real signature unknown
pass
def __init__(self, *args, **kwargs): # real signature unknown
pass
|
#ifndef _NAND_H
#define _NAND_H
#define NAND_PAGE_DEF 2048
#define NAND_OOB_DEF 64
#define NAND_CHECK_ENTRIES 1
#define DEBUG_DEF 0
#define DEBUG_PROG 5
#define pr_info(...) printf(__VA_ARGS__)
#define pr_err(...) fprintf(stderr, __VA_ARGS__)
enum errors {
NO_ERROR = 0,
ERROR_ARGS,
ERROR_PTR,
ERROR_FILE,
ERROR_SEEK,
ERROR_READ,
ERROR_WRITE,
ERROR_ENTRIES
};
int nand_clean_oob(int debug, int ifd, int ofd, ssize_t size, int nand_page, int nand_oob, int nand_entries);
void nand_tools_version(void);
#endif /* _NAND_H */
|
#include <ace/Message_Block.h>
#include <ace/OS_NS_string.h>
#include <ace/OS_NS_unistd.h>
#include <ace/os_include/arpa/os_inet.h>
#include <ace/os_include/netinet/os_tcp.h>
#include <ace/os_include/sys/os_types.h>
#include <ace/os_include/sys/os_socket.h>
#include <ace/OS_NS_string.h>
#include <ace/Reactor.h>
#include <ace/Auto_Ptr.h>
#include "WorldSocket.h"
#include "Common.h"
#include "Player.h"
#include "Util.h"
#include "World.h"
#include "WorldPacket.h"
#include "SharedDefines.h"
#include "ByteBuffer.h"
#include "Opcodes.h"
#include "DatabaseEnv.h"
#include "BigNumber.h"
#include "SHA1.h"
#include "WorldSession.h"
#include "WorldSocketMgr.h"
#include "Log.h"
#include "PacketLog.h"
#include "ScriptMgr.h"
#include "AccountMgr.h"
#if defined(__GNUC__)
#pragma pack(1)
#else
#pragma pack(push, 1)
#endif
struct ServerPktHeader
{
ServerPktHeader(uint32 size, uint32 cmd, AuthCrypt* _authCrypt) : size(size)
{
if (_authCrypt->IsInitialized())
{
uint32 data = (size << 13) | cmd & MAX_OPCODE;
memcpy(&header[0], &data, 4);
_authCrypt->EncryptSend((uint8*)&header[0], getHeaderLength());
}
else
{
// Dynamic header size is not needed anymore, we are using not encrypted part for only the first few packets
memcpy(&header[0], &size, 2);
memcpy(&header[2], &cmd, 2);
}
}
uint8 getHeaderLength()
{
return 4;
}
const uint32 size;
uint8 header[4];
};
struct AuthClientPktHeader
{
uint16 size;
uint32 cmd;
};
struct <API key>
{
uint16 size;
uint16 cmd;
};
#if defined(__GNUC__)
#pragma pack()
#else
#pragma pack(pop)
#endif
WorldSocket::WorldSocket (void): WorldHandler(),
m_LastPingTime(ACE_Time_Value::zero), m_OverSpeedPings(0), m_Session(0),
m_RecvWPct(0), m_RecvPct(), m_Header(sizeof(AuthClientPktHeader)),
m_WorldHeader(sizeof(<API key>)), m_OutBuffer(0),
m_OutBufferSize(65536), m_OutActive(false),
m_Seed(static_cast<uint32> (rand32()))
{
<API key>().value (ACE_Event_Handler::<API key>::ENABLED);
msg_queue()->high_water_mark(8 * 1024 * 1024);
msg_queue()->low_water_mark(8 * 1024 * 1024);
}
WorldSocket::~WorldSocket (void)
{
delete m_RecvWPct;
if (m_OutBuffer)
m_OutBuffer->release();
closing_ = true;
peer().close();
}
bool WorldSocket::IsClosed (void) const
{
return closing_;
}
void WorldSocket::CloseSocket (void)
{
{
ACE_GUARD (LockType, Guard, m_OutBufferLock);
if (closing_)
return;
closing_ = true;
peer().close_writer();
}
{
ACE_GUARD (LockType, Guard, m_SessionLock);
m_Session = NULL;
}
}
const std::string& WorldSocket::GetRemoteAddress (void) const
{
return m_Address;
}
int WorldSocket::SendPacket(WorldPacket const& pct)
{
ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1);
if (closing_)
return -1;
// Dump outgoing packet
if (sPacketLog->CanLogPacket())
sPacketLog->LogPacket(pct, SERVER_TO_CLIENT);
WorldPacket const* pkt = &pct;
// Empty buffer used in case packet should be compressed
// Disable compression for now :)
/* WorldPacket buff;
if (m_Session && pkt->size() > 0x400)
{
buff.Compress(m_Session-><API key>(), pkt);
pkt = &buff;
}*/
uint16 opcodeNumber = serveurOpcodeTable[pkt->GetOpcode()]->OpcodeNumber;
if (m_Session)
TC_LOG_TRACE("network.opcode", "S->C: %s %s", m_Session->GetPlayerInfo().c_str(), <API key>(pkt->GetOpcode(), true).c_str());
sScriptMgr->OnPacketSend(this, *pkt);
ServerPktHeader header(!m_Crypt.IsInitialized() ? pkt->size() + 2 : pct.size(), opcodeNumber, &m_Crypt);
if (m_OutBuffer->space() >= pkt->size() + header.getHeaderLength() && msg_queue()->is_empty())
{
// Put the packet on the buffer.
if (m_OutBuffer->copy((char*) header.header, header.getHeaderLength()) == -1)
ACE_ASSERT (false);
if (!pkt->empty())
if (m_OutBuffer->copy((char*) pkt->contents(), pkt->size()) == -1)
ACE_ASSERT (false);
}
else
{
// Enqueue the packet.
ACE_Message_Block* mb;
ACE_NEW_RETURN(mb, ACE_Message_Block(pkt->size() + header.getHeaderLength()), -1);
mb->copy((char*) header.header, header.getHeaderLength());
if (!pkt->empty())
mb->copy((const char*)pkt->contents(), pkt->size());
if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
{
TC_LOG_ERROR("network", "WorldSocket::SendPacket enqueue_tail failed");
mb->release();
return -1;
}
}
return 0;
}
long WorldSocket::AddReference (void)
{
return static_cast<long> (add_reference());
}
long WorldSocket::RemoveReference (void)
{
return static_cast<long> (remove_reference());
}
int WorldSocket::open (void *a)
{
ACE_UNUSED_ARG (a);
// Prevent double call to this func.
if (m_OutBuffer)
return -1;
// This will also prevent the socket from being Updated
// while we are initializing it.
m_OutActive = true;
// Hook for the manager.
if (sWorldSocketMgr->OnSocketOpen(this) == -1)
return -1;
// Allocate the buffer.
ACE_NEW_RETURN (m_OutBuffer, ACE_Message_Block (m_OutBufferSize), -1);
// Store peer address.
ACE_INET_Addr remote_addr;
if (peer().get_remote_addr(remote_addr) == -1)
{
TC_LOG_ERROR("network", "WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno));
return -1;
}
m_Address = remote_addr.get_host_addr();
// not an opcode. this packet sends raw string WORLD OF WARCRAFT CONNECTION - SERVER TO CLIENT"
// because of our implementation, bytes "WO" become the opcode
WorldPacket packet(<API key>);
packet << std::string("RLD OF WARCRAFT CONNECTION - SERVER TO CLIENT");
if (SendPacket(packet) == -1)
return -1;
// Register with ACE Reactor
if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1)
{
TC_LOG_ERROR("network", "WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno));
return -1;
}
// reactor takes care of the socket from now on
remove_reference();
return 0;
}
int WorldSocket::close (u_long)
{
shutdown();
closing_ = true;
remove_reference();
return 0;
}
int WorldSocket::handle_input (ACE_HANDLE)
{
if (closing_)
return -1;
switch (<API key>())
{
case -1 :
{
if ((errno == EWOULDBLOCK) ||
(errno == EAGAIN))
{
return Update(); // interesting line, isn't it ?
}
TC_LOG_DEBUG("network", "WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
errno = ECONNRESET;
return -1;
}
case 0:
{
TC_LOG_DEBUG("network", "WorldSocket::handle_input: Peer has closed connection");
errno = ECONNRESET;
return -1;
}
case 1:
return 1;
default:
return Update(); // another interesting line ;)
}
ACE_NOTREACHED(return -1);
}
int WorldSocket::handle_output (ACE_HANDLE)
{
ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1);
if (closing_)
return -1;
size_t send_len = m_OutBuffer->length();
if (send_len == 0)
return handle_output_queue(Guard);
#ifdef MSG_NOSIGNAL
ssize_t n = peer().send (m_OutBuffer->rd_ptr(), send_len, MSG_NOSIGNAL);
#else
ssize_t n = peer().send (m_OutBuffer->rd_ptr(), send_len);
#endif // MSG_NOSIGNAL
if (n == 0)
return -1;
else if (n == -1)
{
if (errno == EWOULDBLOCK || errno == EAGAIN)
return <API key> (Guard);
return -1;
}
else if (n < (ssize_t)send_len) //now n > 0
{
m_OutBuffer->rd_ptr (static_cast<size_t> (n));
// move the data to the base of the buffer
m_OutBuffer->crunch();
return <API key> (Guard);
}
else //now n == send_len
{
m_OutBuffer->reset();
return handle_output_queue (Guard);
}
ACE_NOTREACHED (return 0);
}
int WorldSocket::handle_output_queue (GuardType& g)
{
if (msg_queue()->is_empty())
return <API key>(g);
ACE_Message_Block* mblk;
if (msg_queue()->dequeue_head(mblk, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
{
TC_LOG_ERROR("network", "WorldSocket::handle_output_queue dequeue_head");
return -1;
}
const size_t send_len = mblk->length();
#ifdef MSG_NOSIGNAL
ssize_t n = peer().send(mblk->rd_ptr(), send_len, MSG_NOSIGNAL);
#else
ssize_t n = peer().send(mblk->rd_ptr(), send_len);
#endif // MSG_NOSIGNAL
if (n == 0)
{
mblk->release();
return -1;
}
else if (n == -1)
{
if (errno == EWOULDBLOCK || errno == EAGAIN)
{
msg_queue()->enqueue_head(mblk, (ACE_Time_Value*) &ACE_Time_Value::zero);
return <API key> (g);
}
mblk->release();
return -1;
}
else if (n < (ssize_t)send_len) //now n > 0
{
mblk->rd_ptr(static_cast<size_t> (n));
if (msg_queue()->enqueue_head(mblk, (ACE_Time_Value*) &ACE_Time_Value::zero) == -1)
{
TC_LOG_ERROR("network", "WorldSocket::handle_output_queue enqueue_head");
mblk->release();
return -1;
}
return <API key> (g);
}
else //now n == send_len
{
mblk->release();
return msg_queue()->is_empty() ? <API key>(g) : ACE_Event_Handler::WRITE_MASK;
}
ACE_NOTREACHED(return -1);
}
int WorldSocket::handle_close (ACE_HANDLE h, ACE_Reactor_Mask)
{
// Critical section
{
ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1);
closing_ = true;
if (h == ACE_INVALID_HANDLE)
peer().close_writer();
}
// Critical section
{
ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1);
m_Session = NULL;
}
reactor()->remove_handler(this, ACE_Event_Handler::DONT_CALL | ACE_Event_Handler::ALL_EVENTS_MASK);
return 0;
}
int WorldSocket::Update (void)
{
if (closing_)
return -1;
if (m_OutActive)
return 0;
{
ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, 0);
if (m_OutBuffer->length() == 0 && msg_queue()->is_empty())
return 0;
}
int ret;
do
ret = handle_output(get_handle());
while (ret > 0);
return ret;
}
int WorldSocket::handle_input_header (void)
{
ACE_ASSERT(m_RecvWPct == NULL);
if (m_Crypt.IsInitialized())
{
ACE_ASSERT(m_WorldHeader.length() == sizeof(<API key>));
uint8* uintHeader = (uint8*)m_WorldHeader.rd_ptr();
m_Crypt.DecryptRecv(uintHeader, sizeof(<API key>));
<API key>& header = *(<API key>*)uintHeader;
uint32 value = *(uint32*)uintHeader;
header.cmd = value & 0x1FFF;
header.size = ((value & ~(uint32)0x1FFF) >> 13);
if (header.size > 10236)
{
Player* _player = m_Session ? m_Session->GetPlayer() : NULL;
TC_LOG_ERROR("network", "WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)",
m_Session ? m_Session->GetAccountId() : 0,
_player ? _player->GetGUIDLow() : 0,
_player ? _player->GetName().c_str() : "<none>",
header.size, header.cmd);
errno = EINVAL;
return -1;
}
uint16 opcodeNumber = PacketFilter::DropHighBytes(header.cmd);
ACE_NEW_RETURN(m_RecvWPct, WorldPacket(clientOpcodeTable.GetOpcodeByNumber(opcodeNumber), header.size), -1);
m_RecvWPct->SetReceivedOpcode(opcodeNumber);
if (header.size > 0)
{
m_RecvWPct->resize(header.size);
m_RecvPct.base ((char*) m_RecvWPct->contents(), m_RecvWPct->size());
}
else
ACE_ASSERT(m_RecvPct.space() == 0);
}
else
{
ACE_ASSERT(m_Header.length() == sizeof(AuthClientPktHeader));
uint8* uintHeader = (uint8*)m_Header.rd_ptr();
AuthClientPktHeader& header = *((AuthClientPktHeader*)uintHeader);
if ((header.size < 4) || (header.size > 10240))
{
Player* _player = m_Session ? m_Session->GetPlayer() : NULL;
TC_LOG_ERROR("network", "WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)",
m_Session ? m_Session->GetAccountId() : 0,
_player ? _player->GetGUIDLow() : 0,
_player ? _player->GetName().c_str() : "<none>",
header.size, header.cmd);
errno = EINVAL;
return -1;
}
header.size -= 4;
uint16 opcodeNumber = PacketFilter::DropHighBytes(header.cmd);
ACE_NEW_RETURN(m_RecvWPct, WorldPacket(clientOpcodeTable.GetOpcodeByNumber(opcodeNumber), header.size), -1);
m_RecvWPct->SetReceivedOpcode(opcodeNumber);
if (header.size > 0)
{
m_RecvWPct->resize(header.size);
m_RecvPct.base ((char*) m_RecvWPct->contents(), m_RecvWPct->size());
}
else
ACE_ASSERT(m_RecvPct.space() == 0);
}
return 0;
}
int WorldSocket::<API key> (void)
{
// set errno properly here on error !!!
// now have a header and payload
if (m_Crypt.IsInitialized())
{
ACE_ASSERT (m_RecvPct.space() == 0);
ACE_ASSERT (m_WorldHeader.space() == 0);
ACE_ASSERT (m_RecvWPct != NULL);
const int ret = ProcessIncoming (m_RecvWPct);
m_RecvPct.base (NULL, 0);
m_RecvPct.reset();
m_RecvWPct = NULL;
m_WorldHeader.reset();
if (ret == -1)
errno = EINVAL;
return ret;
}
else
{
ACE_ASSERT(m_RecvPct.space() == 0);
ACE_ASSERT(m_Header.space() == 0);
ACE_ASSERT(m_RecvWPct != NULL);
const int ret = ProcessIncoming(m_RecvWPct);
m_RecvPct.base(NULL, 0);
m_RecvPct.reset();
m_RecvWPct = NULL;
m_Header.reset();
if (ret == -1)
errno = EINVAL;
return ret;
}
}
int WorldSocket::<API key> (void)
{
char buf [4096];
ACE_Data_Block db (sizeof (buf),
ACE_Message_Block::MB_DATA,
buf,
0,
0,
ACE_Message_Block::DONT_DELETE,
0);
ACE_Message_Block message_block(&db,
ACE_Message_Block::DONT_DELETE,
0);
const size_t recv_size = message_block.space();
const ssize_t n = peer().recv (message_block.wr_ptr(),
recv_size);
if (n <= 0)
return int(n);
message_block.wr_ptr (n);
while (message_block.length() > 0)
{
if (m_Crypt.IsInitialized())
{
if (m_WorldHeader.space() > 0)
{
//need to receive the header
const size_t to_header = (message_block.length() > m_WorldHeader.space() ? m_WorldHeader.space() : message_block.length());
m_WorldHeader.copy (message_block.rd_ptr(), to_header);
message_block.rd_ptr (to_header);
if (m_WorldHeader.space() > 0)
{
// Couldn't receive the whole header this time.
ACE_ASSERT (message_block.length() == 0);
errno = EWOULDBLOCK;
return -1;
}
// We just received nice new header
if (handle_input_header() == -1)
{
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
return -1;
}
}
}
else
{
if (m_Header.space() > 0)
{
//need to receive the header
const size_t to_header = (message_block.length() > m_Header.space() ? m_Header.space() : message_block.length());
m_Header.copy (message_block.rd_ptr(), to_header);
message_block.rd_ptr (to_header);
if (m_Header.space() > 0)
{
// Couldn't receive the whole header this time.
ACE_ASSERT (message_block.length() == 0);
errno = EWOULDBLOCK;
return -1;
}
// We just received nice new header
if (handle_input_header() == -1)
{
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
return -1;
}
}
}
// Its possible on some error situations that this happens
// for example on closing when epoll receives more chunked data and stuff
// hope this is not hack, as proper m_RecvWPct is asserted around
if (!m_RecvWPct)
{
TC_LOG_ERROR("network", "Forcing close on input m_RecvWPct = NULL");
errno = EINVAL;
return -1;
}
// We have full read header, now check the data payload
if (m_RecvPct.space() > 0)
{
//need more data in the payload
const size_t to_data = (message_block.length() > m_RecvPct.space() ? m_RecvPct.space() : message_block.length());
m_RecvPct.copy (message_block.rd_ptr(), to_data);
message_block.rd_ptr (to_data);
if (m_RecvPct.space() > 0)
{
// Couldn't receive the whole data this time.
ACE_ASSERT (message_block.length() == 0);
errno = EWOULDBLOCK;
return -1;
}
}
//just received fresh new payload
if (<API key>() == -1)
{
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
return -1;
}
}
return size_t(n) == recv_size ? 1 : 2;
}
int WorldSocket::<API key> (GuardType& g)
{
if (!m_OutActive)
return 0;
m_OutActive = false;
g.release();
if (reactor()->cancel_wakeup
(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
// would be good to store errno from reactor with errno guard
TC_LOG_ERROR("network", "WorldSocket::<API key>");
return -1;
}
return 0;
}
int WorldSocket::<API key> (GuardType& g)
{
if (m_OutActive)
return 0;
m_OutActive = true;
g.release();
if (reactor()->schedule_wakeup
(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
TC_LOG_ERROR("network", "WorldSocket::<API key>");
return -1;
}
return 0;
}
int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
{
ACE_ASSERT (new_pct);
// manage memory ;)
ACE_Auto_Ptr<WorldPacket> aptr(new_pct);
Opcodes opcode = new_pct->GetOpcode();
if (closing_)
return -1;
// Dump received packet.
if (sPacketLog->CanLogPacket())
sPacketLog->LogPacket(*new_pct, CLIENT_TO_SERVER);
std::string opcodeName = <API key>(opcode, false);
if (m_Session)
TC_LOG_TRACE("network.opcode", "C->S: %s %s", m_Session->GetPlayerInfo().c_str(), opcodeName.c_str());
try
{
switch (opcode)
{
case CMSG_PING:
return HandlePing(*new_pct);
case CMSG_AUTH_SESSION:
if (m_Session)
{
TC_LOG_ERROR("network", "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", m_Session->GetPlayerInfo().c_str());
return -1;
}
sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct));
return HandleAuthSession(*new_pct);
//case CMSG_KEEP_ALIVE:
// sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct));
// return 0;
case CMSG_LOG_DISCONNECT:
new_pct->rfinish(); // contains uint32 disconnectReason;
sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct));
return 0;
// not an opcode, client sends string "WORLD OF WARCRAFT CONNECTION - CLIENT TO SERVER" without opcode
// first 4 bytes become the opcode (2 dropped)
case <API key>:
{
sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct));
std::string str;
*new_pct >> str;
if (str != "D OF WARCRAFT CONNECTION - CLIENT TO SERVER")
return -1;
return <API key>();
}
/*case CMSG_ENABLE_NAGLE:
{
TC_LOG_DEBUG("network", "%s", opcodeName.c_str());
sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct));
return m_Session ? m_Session-><API key>() : -1;
}*/
default:
{
ACE_GUARD_RETURN(LockType, Guard, m_SessionLock, -1);
if (!m_Session)
{
TC_LOG_ERROR("network.opcode", "ProcessIncoming: Client not authed opcode = %u", uint32(opcode));
return -1;
}
// prevent invalid memory access/crash with custom opcodes
if (opcode >= NUM_OPCODES)
return 0;
OpcodeHandler const* handler = clientOpcodeTable[opcode];
if (!handler || handler->Status == STATUS_UNHANDLED)
{
TC_LOG_ERROR("network.opcode", "No defined handler for opcode %s sent by %s", <API key>(new_pct->GetOpcode(), false, new_pct->GetReceivedOpcode()).c_str(), m_Session->GetPlayerInfo().c_str());
return 0;
}
// Our Idle timer will reset on any non PING opcodes.
// Catches people idling on the login screen and any lingering ingame connections.
m_Session->ResetTimeOutTime();
// OK, give the packet to WorldSession
aptr.release();
// WARNING here we call it with locks held.
// Its possible to cause deadlock if QueuePacket calls back
m_Session->QueuePacket(new_pct);
return 0;
}
}
}
catch (ByteBufferException &)
{
TC_LOG_ERROR("network", "WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet %s from client %s, accountid=%i. Disconnected client.",
opcodeName.c_str(), GetRemoteAddress().c_str(), m_Session ? int32(m_Session->GetAccountId()) : -1);
new_pct->hexlike();
return -1;
}
ACE_NOTREACHED (return 0);
}
int WorldSocket::<API key>()
{
WorldPacket packet(SMSG_AUTH_CHALLENGE, 37);
packet << uint16(0);
for (int i = 0; i < 8; i++)
packet << uint32(0);
packet << uint8(1);
packet << uint32(m_Seed);
return SendPacket(packet);
}
int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
{
uint8 digest[20];
uint32 clientSeed;
uint8 security;
uint16 clientBuild;
uint32 id;
uint32 addonSize;
LocaleConstant locale;
std::string account;
SHA1Hash sha;
BigNumber k;
WorldPacket addonsData;
recvPacket.read_skip<uint32>();
recvPacket.read_skip<uint32>();
recvPacket >> digest[18];
recvPacket >> digest[14];
recvPacket >> digest[3];
recvPacket >> digest[4];
recvPacket >> digest[0];
recvPacket.read_skip<uint32>();
recvPacket >> digest[11];
recvPacket >> clientSeed;
recvPacket >> digest[19];
recvPacket.read_skip<uint8>();
recvPacket.read_skip<uint8>();
recvPacket >> digest[2];
recvPacket >> digest[9];
recvPacket >> digest[12];
recvPacket.read_skip<uint64>();
recvPacket.read_skip<uint32>();
recvPacket >> digest[16];
recvPacket >> digest[5];
recvPacket >> digest[6];
recvPacket >> digest[8];
recvPacket >> clientBuild;
recvPacket >> digest[17];
recvPacket >> digest[7];
recvPacket >> digest[13];
recvPacket >> digest[15];
recvPacket >> digest[1];
recvPacket >> digest[10];
recvPacket >> addonSize;
addonsData.resize(addonSize);
recvPacket.read((uint8*)addonsData.contents(), addonSize);
recvPacket.ReadBit();
uint32 accountNameLength = recvPacket.ReadBits(11);
account = recvPacket.ReadString(accountNameLength);
if (sWorld->IsClosed())
{
<API key>(AUTH_REJECT);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str());
return -1;
}
// Get the account information from the realmd database
// 0 1 2 3 4 5 6 7 8
// SELECT id, sessionkey, last_ip, locked, expansion, mutetime, locale, recruiter, os FROM account WHERE username = ?
PreparedStatement* stmt = LoginDatabase.<API key>(<API key>);
stmt->setString(0, account);
PreparedQueryResult result = LoginDatabase.Query(stmt);
// Stop if the account is not found
if (!result)
{
<API key>(<API key>);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account).");
return -1;
}
Field* fields = result->Fetch();
uint8 expansion = fields[4].GetUInt8();
uint32 world_expansion = sWorld->getIntConfig(CONFIG_EXPANSION);
if (expansion > world_expansion)
expansion = world_expansion;
- Re-check ip locking (same check as in realmd).
if (fields[3].GetUInt8() == 1) // if ip is locked
{
if (strcmp (fields[2].GetCString(), GetRemoteAddress().c_str()))
{
<API key>(AUTH_FAILED);
TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs).");
return -1;
}
}
id = fields[0].GetUInt32();
k.SetHexStr(fields[1].GetCString());
int64 mutetime = fields[5].GetInt64();
//! Negative mutetime indicates amount of seconds to be muted effective on next login - which is now.
if (mutetime < 0)
{
mutetime = time(NULL) + llabs(mutetime);
PreparedStatement* stmt = LoginDatabase.<API key>(<API key>);
stmt->setInt64(0, mutetime);
stmt->setUInt32(1, id);
LoginDatabase.Execute(stmt);
}
locale = LocaleConstant (fields[6].GetUInt8());
if (locale >= TOTAL_LOCALES)
locale = LOCALE_enUS;
uint32 recruiter = fields[7].GetUInt32();
std::string os = fields[8].GetString();
// Must be done before WorldSession is created
if (sWorld->getBoolConfig(<API key>) && os != "Win" && os != "OSX")
{
<API key>(AUTH_REJECT);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Client %s attempted to log in using invalid client OS (%s).", GetRemoteAddress().c_str(), os.c_str());
return -1;
}
// Checks gmlevel per Realm
stmt = LoginDatabase.<API key>(<API key>);
stmt->setUInt32(0, id);
stmt->setInt32(1, int32(realmID));
result = LoginDatabase.Query(stmt);
if (!result)
security = 0;
else
{
fields = result->Fetch();
security = fields[0].GetUInt8();
}
// Re-check account ban (same check as in realmd)
stmt = LoginDatabase.<API key>(LOGIN_SEL_BANS);
stmt->setUInt32(0, id);
stmt->setString(1, GetRemoteAddress());
PreparedQueryResult banresult = LoginDatabase.Query(stmt);
if (banresult) // if account banned
{
<API key>(AUTH_BANNED);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
return -1;
}
// Check locked state for serveur
AccountTypes allowedAccountType = sWorld-><API key>();
TC_LOG_DEBUG("network", "Allowed Level: %u Player Level %u", allowedAccountType, AccountTypes(security));
if (allowedAccountType > SEC_PLAYER && AccountTypes(security) < allowedAccountType)
{
<API key>(AUTH_UNAVAILABLE);
TC_LOG_INFO("network", "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
return -1;
}
// Check that Key and account name are the same on client and serveur
uint32 t = 0;
uint32 seed = m_Seed;
sha.UpdateData(account);
sha.UpdateData((uint8*)&t, 4);
sha.UpdateData((uint8*)&clientSeed, 4);
sha.UpdateData((uint8*)&seed, 4);
sha.UpdateBigNumbers(&k, NULL);
sha.Finalize();
std::string address = GetRemoteAddress();
if (memcmp(sha.GetDigest(), digest, 20))
{
<API key>(AUTH_FAILED);
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str());
return -1;
}
TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.",
account.c_str(),
address.c_str());
// Check if this user is by any chance a recruiter
stmt = LoginDatabase.<API key>(<API key>);
stmt->setUInt32(0, id);
result = LoginDatabase.Query(stmt);
bool isRecruiter = false;
if (result)
isRecruiter = true;
// Update the last_ip in the database
stmt = LoginDatabase.<API key>(LOGIN_UPD_LAST_IP);
stmt->setString(0, address);
stmt->setString(1, account);
LoginDatabase.Execute(stmt);
// NOTE ATM the socket is single-threaded, have this in mind ...
ACE_NEW_RETURN(m_Session, WorldSession(id, this, AccountTypes(security), expansion, mutetime, locale, recruiter, isRecruiter), -1);
m_Crypt.Init(&k);
m_Session-><API key>();
m_Session->LoadTutorialsData();
m_Session->ReadAddonsInfo(addonsData);
m_Session->LoadPermissions();
// Initialize Warden system only if it is enabled by config
if (sWorld->getBoolConfig(<API key>))
m_Session->InitWarden(&k, os);
// Sleep this Network thread for
uint32 sleepTime = sWorld->getIntConfig(<API key>);
ACE_OS::sleep(ACE_Time_Value(0, sleepTime));
sWorld->AddSession(m_Session);
return 0;
}
int WorldSocket::HandlePing (WorldPacket& recvPacket)
{
uint32 ping;
uint32 latency;
// Get the ping packet content
recvPacket >> latency;
recvPacket >> ping;
if (m_LastPingTime == ACE_Time_Value::zero)
m_LastPingTime = ACE_OS::gettimeofday(); // for 1st ping
else
{
ACE_Time_Value cur_time = ACE_OS::gettimeofday();
ACE_Time_Value diff_time (cur_time);
diff_time -= m_LastPingTime;
m_LastPingTime = cur_time;
if (diff_time < ACE_Time_Value (27))
{
++m_OverSpeedPings;
uint32 max_count = sWorld->getIntConfig (<API key>);
if (max_count && m_OverSpeedPings > max_count)
{
ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1);
if (m_Session && !m_Session->HasPermission(rbac::<API key>))
{
TC_LOG_ERROR("network", "WorldSocket::HandlePing: %s kicked for over-speed pings (address: %s)",
m_Session->GetPlayerInfo().c_str(), GetRemoteAddress().c_str());
return -1;
}
}
}
else
m_OverSpeedPings = 0;
}
// critical section
{
ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1);
if (m_Session)
{
m_Session->SetLatency (latency);
m_Session-><API key>();
}
else
{
TC_LOG_ERROR("network", "WorldSocket::HandlePing: peer sent CMSG_PING, "
"but is not authenticated or got recently kicked, "
" address = %s",
GetRemoteAddress().c_str());
return -1;
}
}
WorldPacket packet(SMSG_PONG, 4);
packet << ping;
return SendPacket(packet);
}
void WorldSocket::<API key>(uint8 code)
{
WorldPacket packet(SMSG_AUTH_RESPONSE, 1);
packet.WriteBit(0); // has account info
packet.WriteBit(0); // has queue info
packet << uint8(code);
SendPacket(packet);
}
|
<HTML> <HEAD> <TITLE>Jan Kerouac Biography</TITLE> </HEAD>
<BODY BACKGROUND="" BGCOLOR="#e7e7ff" TEXT="#000000"
LINK="#004fcf" ALINK="#ffff00" VLINK="#006faf">
<H3><IMG ALIGN=MIDDLE SRC="images/jan.jpg">About Jan Kerouac </H3>
Jan Kerouac, daughter of Beat Generation novelist Jack Kerouac,
was born in 1952 in Albany, New York. Raised on the Lower East
Side of New York, she traveled extensively in Mexico and South
America in her teenage years and early twenties. Returning to
live with her mother Joan Haverty Stuart in Washington State in
the late 1970's, she completed her first novel BABY DRIVER, which
was published in 1981 by St. Martin's.
<P>
Her second novel TRAIN SONG was published by Henry Holt in 1988.
She has also published and read her poetry at a wide variety
of places, and she has taken part in a number of the symposiums
on the Beat writers, including the Amsterdam Poetry Festival in
1983, the ON THE ROAD celebration at the Naropa Institute in 1982
and the dedication of the Jack Kerouac Memorial in Lowell in 1988.
She was a featured speaker at the international Beat Generation
conference at NYU in May, 1994, and she continues to speak out,
despite her bad health, about the need to preserve her father's
entire archive in a library or a museum.
<P>
She is currently working on her third novel, PARROT FEVER. A
I 10,000-word excerpt is available as a collector's chapbook, signed
and numbered, in an edition of 135, for $50 each plus $3 postage
and handling. Make checks payable to Jan Kerouac Benefit Fund,
11 Palm Ave., Corte Madera, CA 94925.<P>
<A HREF="../LitKicks.html">Literary Kicks</A><BR>
<I><A HREF="../IKL/IKL.html">Inside the Kerouac Legacy</A></I><BR>
A Special Section Maintained by
<A HREF="../IKL/RalphVirgo.html">Ralph Virgo</A> = rvirgo@ix.netcom.com<P>
</BODY></HTML>
|
// <auto-generated>
// This code was generated from a template.
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
namespace CompanyDirectoryDF.Models
{
using System;
using System.Collections.Generic;
public partial class Directory
{
public Directory()
{
this.Addresses = new HashSet<Address>();
this.Departments = new HashSet<Department>();
this.DirectoryEmployees = new HashSet<DirectoryEmployee>();
this.PhoneLists = new HashSet<PhoneList>();
this.WebURLWebLocations = new HashSet<WebURLWebLocation>();
}
public int ID { get; set; }
public string Name { get; set; }
public virtual ICollection<Address> Addresses { get; set; }
public virtual ICollection<Department> Departments { get; set; }
public virtual ICollection<DirectoryEmployee> DirectoryEmployees { get; set; }
public virtual ICollection<PhoneList> PhoneLists { get; set; }
public virtual ICollection<WebURLWebLocation> WebURLWebLocations { get; set; }
}
}
|
<?php
/**
* The admin-specific functionality of the plugin.
*
* @link kjhuer.com
* @since 1.0.0
*
* @package Za_Collect
* @subpackage Za_Collect/admin
*/
/**
* The admin-specific functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the admin-specific stylesheet and JavaScript.
*
* @package Za_Collect
* @subpackage Za_Collect/admin
* @author Kevin J Huer <kjhuer@gmail.com>
*/
class Za_Collect_Admin {
/**
* The ID of this plugin.
*
* @since 1.0.0
* @access private
* @var string $plugin_name The ID of this plugin.
*/
private $plugin_name;
/**
* The version of this plugin.
*
* @since 1.0.0
* @access private
* @var string $version The current version of this plugin.
*/
private $version;
/**
* Initialize the class and set its properties.
*
* @since 1.0.0
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $plugin_name, $version ) {
$this->plugin_name = $plugin_name;
$this->version = $version;
}
/**
* Register the stylesheets for the admin area.
*
* @since 1.0.0
*/
public function enqueue_styles() {
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/za-collect-admin.css', array(), $this->version, 'all' );
}
/**
* Register the JavaScript for the admin area.
*
* @since 1.0.0
*/
public function enqueue_scripts() {
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/za-collect-admin.js', array( 'jquery' ), $this->version, false );
}
/**
* Add options page for zaCollect
*
* @since 1.0.0
*/
public function <API key>(){
add_options_page('zaCollect','zaCollect','manage_options',$this->plugin_name,array($this,'<API key>'));
}
public function add_action_links( $links ) {
$settings_link = array(
'<a href="' . admin_url( 'options-general.php?page=' . $this->plugin_name ) . '">' . __('Settings', $this->plugin_name) . '</a>',
);
return array_merge( $settings_link, $links );
}
/**
* Render the settings page for this plugin.
*
* @since 1.0.0
*/
public function <API key>() {
include_once( 'partials/<API key>.php' );
}
public function options_update() {
register_setting($this->plugin_name, $this->plugin_name, array($this, 'validate'));
}
public function validate( $input ){
$valid = array();
$valid['referral_id'] = (isset($input['referral_id']) && !empty($input['referral_id']) && preg_match( '/^[0-9]{18}$/', $input['referral_id'] ) ) ? sanitize_text_field($input['referral_id']) : '';
if ( empty($valid['referral_id']) && !empty($input['referral_id']) ) {
add_settings_error(
'referral_id', // Setting title
'<API key>', // Error ID
'Please enter a valid referral ID (18 numbers, no spaces or extra characters)', // Error message
'error' // Type of message
);
}
$valid['buy_button_text'] =(isset($input['buy_button_text']) && !empty($input['buy_button_text'])) ? sanitize_text_field($input['buy_button_text']) : '';
$valid['accent_color'] = (isset($input['accent_color']) && !empty($input['accent_color'])) ? sanitize_text_field($input['accent_color']) : '';
if ( !empty($valid['accent_color']) && !preg_match( '/^#[a-f0-9]{6}$/i', $valid['accent_color'] ) ) { // if user insert a HEX color with #
add_settings_error(
'accent_color', // Setting title
'<API key>', // Error ID
'Please enter a valid hex value color for accent color', // Error message
'error' // Type of message
);
}
$valid['accent_text_color'] = (isset($input['accent_text_color']) && !empty($input['accent_text_color'])) ? sanitize_text_field($input['accent_text_color']) : '';
if ( !empty($valid['accent_text_color']) && !preg_match( '/^#[a-f0-9]{6}$/i', $valid['accent_text_color'] ) ) { // if user insert a HEX color with #
add_settings_error(
'accent_text_color', // Setting title
'<API key>', // Error ID
'Please enter a valid hex value color for accent text color', // Error message
'error' // Type of message
);
}
$valid['new_window'] = (isset($input['new_window']) && !empty($input['new_window'])) ? 1 : 0;
return $valid;
}
}
|
#include <linux/modem/m6718_spi/modem_driver.h>
#include "modem_statemachine.h"
#include "modem_util.h"
#include "modem_netlink.h"
#include "modem_debug.h"
#include "modem_queue.h"
#include "modem_protocol.h"
#ifdef <API key>
#include "modem_state.h"
#endif
#define CMD_BOOTREQ (1)
#define CMD_BOOTRESP (2)
#define CMD_WRITE (3)
#define CMD_READ (4)
static u8 sm_init_enter(u8 event, struct ipc_link_context *context)
{
#ifdef <API key>
/* if modem is off un-configure the IPC GPIO pins for low-power */
if (<API key>() == MODEM_STATE_OFF) {
dev_info(&context->sdev->dev,
"link %d: modem is off, un-configuring GPIO\n",
context->link->id);
<API key>(context);
}
#endif
/* nothing more to do until an event happens */
return IPC_SM_RUN_NONE;
}
static const struct ipc_sm_state *sm_init_exit(u8 event,
struct ipc_link_context *context)
{
bool int_active = false;
/*
* For reset event just re-enter init in case the modem has
* powered off - we need to reconfigure our GPIO pins
*/
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_INIT);
/* re-sample link INT pin */
int_active = <API key>(context);
atomic_set(&context->state_int, int_active);
dev_info(&context->sdev->dev,
"link %d: link initialised; SS:INACTIVE(%d) INT:%s(%d)\n",
context->link->id,
<API key>(context),
int_active ? "ACTIVE" : "INACTIVE",
int_active ? <API key>(context) :
<API key>(context));
/* handshake is only on link 0 */
if (context->link->id == 0) {
if (!int_active) {
dev_info(&context->sdev->dev,
"link %d: slave INT signal is inactive\n",
context->link->id);
/* start boot handshake */
return ipc_sm_state(<API key>);
} else {
/* wait for slave INT signal to stabilise inactive */
return ipc_sm_state(<API key>);
}
} else {
dev_info(&context->sdev->dev,
"link %d: boot sync not needed, going idle\n",
context->link->id);
return ipc_sm_state(IPC_SM_IDL);
}
}
static const struct ipc_sm_state *sm_init_aud_exit(u8 event,
struct ipc_link_context *context)
{
bool int_active = false;
/*
* For reset event just re-enter init in case the modem has
* powered off - we need to reconfigure our GPIO pins
*/
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_INIT_AUD);
/* re-sample link INT pin */
int_active = <API key>(context);
atomic_set(&context->state_int, int_active);
dev_info(&context->sdev->dev,
"link %d: link initialised; SS:INACTIVE(%d) INT:%s(%d)\n",
context->link->id,
<API key>(context),
int_active ? "ACTIVE" : "INACTIVE",
int_active ? <API key>(context) :
<API key>(context));
dev_info(&context->sdev->dev,
"link %d: boot sync not needed, going idle\n",
context->link->id);
return ipc_sm_state(IPC_SM_IDL_AUD);
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
static unsigned long printk_warn_time;
if (<API key>(&printk_warn_time, 60 * 1000))
dev_info(&context->sdev->dev,
"link %d: waiting for stable inactive slave INT\n",
context->link->id);
<API key>(context);
return IPC_SM_RUN_NONE;
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
if (!<API key>(context)) {
dev_info(&context->sdev->dev,
"link %d: slave INT signal is stable inactive\n",
context->link->id);
return ipc_sm_state(<API key>);
} else {
return ipc_sm_state(<API key>);
}
}
static u8 <API key>(u8 event,
struct ipc_link_context *context)
{
dev_info(&context->sdev->dev,
"link %d: waiting for stable inactive slave INT\n",
context->link->id);
<API key>(context);
return IPC_SM_RUN_NONE;
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
int i;
if (!<API key>(context)) {
dev_info(&context->sdev->dev,
"link %d: slave INT signal is inactive, going idle\n",
context->link->id);
/* modem sync is done */
atomic_inc(&l1_context.boot_sync_done);
<API key>(context);
/*
* Kick the state machine for any initialised links - skip link0
* since this link has just completed handshake
*/
for (i = 1; i < <API key>; i++)
if (l1_context.device_context[i].state != NULL) {
dev_dbg(&context->sdev->dev,
"link %d has already been probed, "
"kicking state machine\n", i);
ipc_sm_kick(IPC_SM_RUN_INIT,
&l1_context.device_context[i]);
}
return ipc_sm_state(IPC_SM_IDL);
} else {
return ipc_sm_state(<API key>);
}
}
static u8 sm_idl_enter(u8 event, struct ipc_link_context *context)
{
<API key>(context);
ipc_dbg_enter_idle(context);
/* check if tx queue contains items */
if (atomic_read(&context->tx_q_count) > 0) {
dev_dbg(&context->sdev->dev,
"link %d: tx queue contains items\n",
context->link->id);
return IPC_SM_RUN_TX_REQ;
}
/* check if modem has already requested transaction start */
if (atomic_read(&context->state_int)) {
dev_dbg(&context->sdev->dev,
"link %d: slave has already signalled ready\n",
context->link->id);
return <API key>;
}
dev_dbg(&context->sdev->dev,
"link %d: going idle\n", context->link->id);
return IPC_SM_RUN_NONE;
}
static const struct ipc_sm_state *sm_idl_exit(u8 event,
struct ipc_link_context *context)
{
ipc_dbg_exit_idle(context);
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_RESET);
else if (event == IPC_SM_RUN_TX_REQ)
return ipc_sm_state(<API key>);
else if (event == <API key>)
return ipc_sm_state(<API key>);
else
return ipc_sm_state(IPC_SM_HALT);
}
static const struct ipc_sm_state *sm_idl_aud_exit(u8 event,
struct ipc_link_context *context)
{
ipc_dbg_exit_idle(context);
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_RESET_AUD);
/* always transmit data first */
return ipc_sm_state(<API key>);
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
struct ipc_tx_queue *frame;
/* get the frame from the head of the tx queue */
if (ipc_queue_is_empty(context)) {
dev_err(&context->sdev->dev,
"link %d error: tx queue is empty!\n",
context->link->id);
return IPC_SM_RUN_ABORT;
}
frame = ipc_queue_get_frame(context);
ipc_dbg_dump_frame(&context->sdev->dev, context->link->id, frame, true);
context->cmd = <API key>(CMD_WRITE, frame->counter,
frame->len);
dev_dbg(&context->sdev->dev,
"link %d: TX FRAME cmd %08x (type %d counter %d len %d)\n",
context->link->id,
context->cmd,
ipc_util_get_l1_cmd(context->cmd),
<API key>(context->cmd),
<API key>(context->cmd));
<API key>(context, &context->cmd,
NULL, IPC_L1_HDR_SIZE);
context->frame = frame;
/* slave might already have signalled ready to transmit */
if (atomic_read(&context->state_int)) {
dev_dbg(&context->sdev->dev,
"link %d: slave has already signalled ready\n",
context->link->id);
<API key>(context);
return <API key>;
} else {
<API key>(context);
return IPC_SM_RUN_NONE;
}
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_RESET);
else if (event == <API key>)
return ipc_sm_state(IPC_SM_HALT);
else
return ipc_sm_state(<API key>);
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
int err;
/* slave is ready - start the spi transfer */
dev_dbg(&context->sdev->dev,
"link %d: starting spi tfr\n", context->link->id);
err = spi_async(context->sdev, &context->spi_message);
if (err < 0) {
dev_err(&context->sdev->dev,
"link %d error: spi tfr start failed, error %d\n",
context->link->id, err);
return IPC_SM_RUN_ABORT;
}
return IPC_SM_RUN_NONE;
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_RESET);
else
return ipc_sm_state(<API key>);
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
/* prepare to transfer the frame tx data */
<API key>(context, context->frame->data,
NULL, context->frame->len);
/* slave might already have signalled ready to transmit */
if (atomic_read(&context->state_int)) {
dev_dbg(&context->sdev->dev,
"link %d: slave has already signalled ready\n",
context->link->id);
<API key>(context);
return <API key>;
} else {
<API key>(context);
return IPC_SM_RUN_NONE;
}
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
struct ipc_tx_queue *frame = NULL;
/* check if there is a frame to be sent */
if (!ipc_queue_is_empty(context)) {
frame = ipc_queue_get_frame(context);
} else {
/* no frame to send, create an empty one */
dev_dbg(&context->sdev->dev,
"link %d: no frame to send, allocating dummy\n",
context->link->id);
frame = ipc_queue_new_frame(context, 0);
if (frame == NULL)
return IPC_SM_RUN_ABORT;
}
ipc_dbg_dump_frame(&context->sdev->dev, context->link->id, frame, true);
/* prepare to transfer the frame tx data */
context->frame = frame;
<API key>(context, context->frame->data,
NULL, context->frame->len);
/* slave might already have signalled ready to transmit */
if (event == <API key> || atomic_read(&context->state_int)) {
dev_dbg(&context->sdev->dev,
"link %d: slave has already signalled ready\n",
context->link->id);
<API key>(context);
return <API key>;
} else {
<API key>(context);
return IPC_SM_RUN_NONE;
}
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_RESET);
else if (event == <API key>)
return ipc_sm_state(IPC_SM_HALT);
else
return ipc_sm_state(<API key>);
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_RESET_AUD);
else if (event == <API key>)
return ipc_sm_state(IPC_SM_HALT_AUD);
else
return ipc_sm_state(<API key>);
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
int err;
/* slave is ready - start the spi transfer */
dev_dbg(&context->sdev->dev,
"link %d: starting spi tfr\n", context->link->id);
err = spi_async(context->sdev, &context->spi_message);
if (err < 0) {
dev_err(&context->sdev->dev,
"link %d error: spi tfr start failed, error %d\n",
context->link->id, err);
return IPC_SM_RUN_ABORT;
}
return IPC_SM_RUN_NONE;
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_RESET);
#ifdef <API key>
/* frame is sent, increment link tx counter */
context->tx_bytes += context->frame->actual_len;
#endif
#ifdef <API key>
{
u8 channel;
channel = <API key>(*(u32 *)context->frame->data);
if (<API key>(channel)) {
context->last_frame = context->frame;
} else {
<API key>(context->frame);
context->frame = NULL;
}
}
#else
/* free the sent frame */
<API key>(context->frame);
context->frame = NULL;
#endif
return ipc_sm_state(<API key>);
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_RESET_AUD);
#ifdef <API key>
/* frame is sent, increment link tx counter */
context->tx_bytes += context->frame->actual_len;
#endif
#ifdef <API key>
{
u8 channel;
channel = <API key>(*(u32 *)context->frame->data);
if (<API key>(channel)) {
/* create a copy of the frame */
context->last_frame = ipc_queue_new_frame(context,
context->frame->actual_len);
memcpy(context->last_frame->data,
context->frame->data,
context->frame->actual_len);
}
}
#endif
return ipc_sm_state(<API key>);
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
context->cmd = <API key>(CMD_READ, 0, 0);
dev_dbg(&context->sdev->dev,
"link %d: cmd %08x (type %d)\n",
context->link->id,
context->cmd,
ipc_util_get_l1_cmd(context->cmd));
/* prepare the spi message to transfer */
<API key>(context, &context->cmd,
NULL, IPC_L1_HDR_SIZE);
/* check if the slave requested this transaction */
if (event == <API key>) {
dev_dbg(&context->sdev->dev,
"link %d: slave initiated transaction, continue\n",
context->link->id);
<API key>(context);
return <API key>;
} else {
/* slave might already have signalled ready to transmit */
if (atomic_read(&context->state_int)) {
dev_dbg(&context->sdev->dev,
"link %d: slave has already signalled ready\n",
context->link->id);
<API key>(context);
return <API key>;
} else {
<API key>(context);
return IPC_SM_RUN_NONE;
}
}
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_RESET);
else if (event == <API key>)
return ipc_sm_state(IPC_SM_HALT);
else
return ipc_sm_state(<API key>);
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
int err;
/* slave is ready - start the spi transfer */
dev_dbg(&context->sdev->dev,
"link %d: starting spi tfr\n", context->link->id);
err = spi_async(context->sdev, &context->spi_message);
if (err < 0) {
dev_err(&context->sdev->dev,
"link %d error: spi tfr start failed, error %d\n",
context->link->id, err);
return IPC_SM_RUN_ABORT;
}
return IPC_SM_RUN_NONE;
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_RESET);
else
return ipc_sm_state(<API key>);
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
/* prepare to receive MESSAGE WRITE frame header */
<API key>(context, NULL,
&context->cmd, IPC_L1_HDR_SIZE);
/* slave might already have signalled ready to transmit */
if (atomic_read(&context->state_int)) {
dev_dbg(&context->sdev->dev,
"link %d: slave has already signalled ready\n",
context->link->id);
<API key>(context);
return <API key>;
} else {
<API key>(context);
return IPC_SM_RUN_NONE;
}
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_RESET);
else if (event == <API key>)
return ipc_sm_state(IPC_SM_HALT);
else
return ipc_sm_state(<API key>);
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
int err;
/* slave is ready - start the spi transfer */
dev_dbg(&context->sdev->dev,
"link %d: starting spi tfr\n", context->link->id);
err = spi_async(context->sdev, &context->spi_message);
if (err < 0) {
dev_err(&context->sdev->dev,
"link %d error: spi tfr start failed, error %d\n",
context->link->id, err);
return IPC_SM_RUN_ABORT;
}
return IPC_SM_RUN_NONE;
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
u8 cmd_type = ipc_util_get_l1_cmd(context->cmd);
int counter = <API key>(context->cmd);
int length = <API key>(context->cmd);
dev_dbg(&context->sdev->dev,
"link %d: RX HEADER %08x (type %d counter %d length %d)\n",
context->link->id,
context->cmd,
cmd_type,
counter,
length);
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_RESET);
if (cmd_type == CMD_WRITE) {
/* slave has data to send - allocate a frame to hold it */
context->frame = ipc_queue_new_frame(context, length);
if (context->frame == NULL)
return ipc_sm_state(IPC_SM_IDL);
context->frame->counter = counter;
<API key>(context, NULL,
context->frame->data, context->frame->len);
return ipc_sm_state(<API key>);
} else {
if (cmd_type != 0)
dev_err(&context->sdev->dev,
"link %d error: received invalid frame type %x "
"(%08x)! assuming TRANSACTION_END...\n",
context->link->id,
cmd_type,
context->cmd);
/* slave has no data to send */
dev_dbg(&context->sdev->dev,
"link %d: slave has no data to send\n",
context->link->id);
return ipc_sm_state(IPC_SM_IDL);
}
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
/*
* We're using the same frame buffer we just sent, so no need for a
* new allocation here, just prepare the spi message
*/
<API key>(context, NULL,
context->frame->data, context->frame->len);
/* slave might already have signalled ready to transmit */
if (atomic_read(&context->state_int)) {
dev_dbg(&context->sdev->dev,
"link %d: slave has already signalled ready\n",
context->link->id);
<API key>(context);
return <API key>;
} else {
<API key>(context);
return IPC_SM_RUN_NONE;
}
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_RESET_AUD);
else if (event == <API key>)
return ipc_sm_state(IPC_SM_HALT_AUD);
else
return ipc_sm_state(<API key>);
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
int err;
/* assume slave is still ready - prepare and start the spi transfer */
<API key>(context, NULL,
context->frame->data, context->frame->len);
dev_dbg(&context->sdev->dev,
"link %d: starting spi tfr\n", context->link->id);
err = spi_async(context->sdev, &context->spi_message);
if (err < 0) {
dev_err(&context->sdev->dev,
"link %d error: spi tfr start failed, error %d\n",
context->link->id, err);
return IPC_SM_RUN_ABORT;
}
return IPC_SM_RUN_NONE;
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
int err;
dev_dbg(&context->sdev->dev,
"link %d: starting spi tfr\n", context->link->id);
err = spi_async(context->sdev, &context->spi_message);
if (err < 0) {
dev_err(&context->sdev->dev,
"link %d error: spi tfr start failed, error %d\n",
context->link->id, err);
return IPC_SM_RUN_ABORT;
}
return IPC_SM_RUN_NONE;
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
u32 frame_hdr;
unsigned char l2_header;
unsigned int l2_length;
u8 *l2_data;
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_RESET);
dev_dbg(&context->sdev->dev,
"link %d: RX PAYLOAD %d bytes\n",
context->link->id, context->frame->len);
#ifdef <API key>
/* frame is received, increment link rx counter */
context->rx_bytes += context->frame->len;
#endif
/* decode L2 header */
frame_hdr = *(u32 *)context->frame->data;
l2_header = <API key>(frame_hdr);
l2_length = <API key>(frame_hdr);
l2_data = (u8 *)context->frame->data + IPC_L2_HDR_SIZE;
context->frame->actual_len = l2_length + IPC_L2_HDR_SIZE;
ipc_dbg_dump_frame(&context->sdev->dev, context->link->id,
context->frame, false);
if (l2_length > (context->frame->len - 4)) {
dev_err(&context->sdev->dev,
"link %d: suspicious frame: L1 len %d L2 len %d\n",
context->link->id, context->frame->len, l2_length);
}
dev_dbg(&context->sdev->dev,
"link %d: L2 PDU decode: header 0x%08x channel %d length %d "
"data[%02x%02x%02x...]\n",
context->link->id, frame_hdr, l2_header, l2_length,
l2_data[0], l2_data[1], l2_data[2]);
if (<API key>(l2_header))
<API key>(context);
/* pass received frame up to L2mux layer */
if (!<API key>(l2_header)) {
dev_err(&context->sdev->dev,
"link %d error: received frame on invalid channel %d, "
"frame discarded\n",
context->link->id, l2_header);
} else {
#ifdef <API key>
/*
* Discard loopback frames if we are taking throughput
* measurements - we'll be loading the links and so will likely
* overload the buffers.
*/
if (!<API key>(l2_header))
#endif
<API key>(context->sdev,
l2_header, l2_length, l2_data);
}
/* data is copied by L2mux so free the frame here */
<API key>(context->frame);
context->frame = NULL;
/* check tx queue for content */
if (!ipc_queue_is_empty(context)) {
dev_dbg(&context->sdev->dev,
"link %d: tx queue not empty\n", context->link->id);
return ipc_sm_state(<API key>);
} else {
dev_dbg(&context->sdev->dev,
"link %d: tx queue empty\n", context->link->id);
return ipc_sm_state(<API key>);
}
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
u32 frame_hdr;
unsigned char l2_header;
unsigned int l2_length;
u8 *l2_data;
if (event == IPC_SM_RUN_RESET)
return ipc_sm_state(IPC_SM_RESET_AUD);
dev_dbg(&context->sdev->dev,
"link %d: RX PAYLOAD %d bytes\n",
context->link->id, context->frame->len);
/* decode L2 header */
frame_hdr = *(u32 *)context->frame->data;
l2_header = <API key>(frame_hdr);
l2_length = <API key>(frame_hdr);
l2_data = (u8 *)context->frame->data + IPC_L2_HDR_SIZE;
#ifdef <API key>
/* frame is received, increment link rx counter */
context->rx_bytes += l2_length;
#endif
if (frame_hdr != 0)
context->frame->actual_len = l2_length + IPC_L2_HDR_SIZE;
else
context->frame->actual_len = 0;
ipc_dbg_dump_frame(&context->sdev->dev, context->link->id,
context->frame, false);
if (l2_length > (context->frame->len - 4))
dev_err(&context->sdev->dev,
"link %d: suspicious frame: L1 len %d L2 len %d\n",
context->link->id, context->frame->len, l2_length);
dev_dbg(&context->sdev->dev,
"link %d: L2 PDU decode: header 0x%08x channel %d length %d "
"data[%02x%02x%02x...]\n",
context->link->id, frame_hdr, l2_header, l2_length,
l2_data[0], l2_data[1], l2_data[2]);
if (<API key>(l2_header))
<API key>(context);
/* did the slave actually have anything to send? */
if (frame_hdr != 0) {
/* pass received frame up to L2mux layer */
if (!<API key>(l2_header)) {
dev_err(&context->sdev->dev,
"link %d error: received frame on invalid "
"channel %d, frame discarded\n",
context->link->id, l2_header);
} else {
#ifdef <API key>
/*
* Discard loopback frames if we are taking throughput
* measurements - we'll be loading the links and so will
* likely overload the buffers.
*/
if (!<API key>(l2_header))
#endif
<API key>(context->sdev,
l2_header, l2_length, l2_data);
}
} else {
dev_dbg(&context->sdev->dev,
"link %d: received dummy frame, discarding\n",
context->link->id);
}
/* data is copied by L2mux so free the frame here */
<API key>(context->frame);
context->frame = NULL;
/* audio link goes idle ready for next transaction */
return ipc_sm_state(IPC_SM_IDL_AUD);
}
static u8 sm_halt_enter(u8 event, struct ipc_link_context *context)
{
dev_err(&context->sdev->dev,
"link %d error: HALTED\n", context->link->id);
#ifdef <API key>
/*
* Force modem reset, this will cause a reset event from the modemstate
* driver which will reset the links. If debugfs is enabled then there
* is a userspace file which controls whether MSR is enabled or not.
*/
#ifdef CONFIG_DEBUG_FS
if (l1_context.msr_disable) {
dev_info(&context->sdev->dev,
"link %d: MSR is disabled by user, "
"not requesting modem reset\n", context->link->id);
return IPC_SM_RUN_RESET;
}
#endif
<API key>();
#endif
return IPC_SM_RUN_RESET;
}
static const struct ipc_sm_state *sm_halt_exit(u8 event,
struct ipc_link_context *context)
{
return ipc_sm_state(IPC_SM_RESET);
}
static const struct ipc_sm_state *sm_halt_aud_exit(u8 event,
struct ipc_link_context *context)
{
return ipc_sm_state(IPC_SM_RESET_AUD);
}
static u8 sm_reset_enter(u8 event, struct ipc_link_context *context)
{
dev_err(&context->sdev->dev,
"link %d resetting\n", context->link->id);
if (context->link->id == 0)
<API key>(context);
<API key>(context);
ipc_queue_reset(context);
if (context->frame != NULL) {
<API key>(context->frame);
context->frame = NULL;
}
#ifdef <API key>
if (context->last_frame != NULL) {
<API key>(context->last_frame);
context->last_frame = NULL;
}
#endif
dev_dbg(&context->sdev->dev,
"link %d reset completed\n", context->link->id);
return IPC_SM_RUN_RESET;
}
static const struct ipc_sm_state *sm_reset_exit(u8 event,
struct ipc_link_context *context)
{
return ipc_sm_state(IPC_SM_INIT);
}
static const struct ipc_sm_state *sm_reset_aud_exit(u8 event,
struct ipc_link_context *context)
{
return ipc_sm_state(IPC_SM_INIT_AUD);
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
dev_info(&context->sdev->dev,
"link %d: waiting for boot sync\n", context->link->id);
<API key>(context);
context->cmd = <API key>(CMD_BOOTREQ, 0,
IPC_DRIVER_VERSION);
dev_dbg(&context->sdev->dev,
"link %d: TX HEADER cmd %08x (type %x)\n",
context->link->id,
context->cmd,
ipc_util_get_l1_cmd(context->cmd));
<API key>(context, &context->cmd,
NULL, IPC_L1_HDR_SIZE);
/* wait now for the slave to indicate ready... */
return IPC_SM_RUN_NONE;
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
return ipc_sm_state(<API key>);
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
int err;
/* slave is ready - start the spi transfer */
dev_dbg(&context->sdev->dev,
"link %d: starting spi tfr\n", context->link->id);
err = spi_async(context->sdev, &context->spi_message);
if (err < 0) {
dev_err(&context->sdev->dev,
"link %d error: spi tfr start failed, error %d\n",
context->link->id, err);
return IPC_SM_RUN_ABORT;
}
return IPC_SM_RUN_NONE;
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
return ipc_sm_state(<API key>);
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
/* prepare to receive BOOTRESP frame header */
<API key>(context, NULL,
&context->cmd, IPC_L1_HDR_SIZE);
/* slave might already have signalled ready to transmit */
if (atomic_read(&context->state_int)) {
dev_dbg(&context->sdev->dev,
"link %d: slave has already signalled ready\n",
context->link->id);
<API key>(context);
return <API key>;
} else {
<API key>(context);
return IPC_SM_RUN_NONE;
}
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
if (event == <API key>) {
/*
* Modem timeout: was it really ready or just noise?
* Revert to waiting for handshake to start.
*/
<API key>(context);
return ipc_sm_state(<API key>);
} else {
return ipc_sm_state(<API key>);
}
}
static u8 <API key>(u8 event, struct ipc_link_context *context)
{
int err;
/* slave is ready - start the spi transfer */
dev_dbg(&context->sdev->dev,
"link %d: starting spi tfr\n", context->link->id);
err = spi_async(context->sdev, &context->spi_message);
if (err < 0) {
dev_err(&context->sdev->dev,
"link %d error: spi tfr start failed, error %d\n",
context->link->id, err);
return IPC_SM_RUN_ABORT;
}
return IPC_SM_RUN_NONE;
}
static const struct ipc_sm_state *<API key>(u8 event,
struct ipc_link_context *context)
{
u8 cmd_type = ipc_util_get_l1_cmd(context->cmd);
u8 modem_ver;
dev_dbg(&context->sdev->dev,
"link %d: RX HEADER %08x (type %d)\n",
context->link->id, context->cmd, cmd_type);
if (cmd_type == CMD_BOOTRESP) {
modem_ver = <API key>(context->cmd);
dev_info(&context->sdev->dev,
"link %d: boot sync done; "
"APE version %02x, MODEM version %02x\n",
context->link->id, IPC_DRIVER_VERSION, modem_ver);
/* check for minimum required modem version */
if (modem_ver < <API key>) {
dev_warn(&context->sdev->dev,
"link %d warning: modem version mismatch! "
"minimum required version is %02x\n",
context->link->id,
<API key>);
}
return ipc_sm_state(<API key>);
} else {
/* invalid response... this is not our slave */
dev_err(&context->sdev->dev,
"link %d error: expected %x (BOOTRESP), received %x.\n",
context->link->id,
CMD_BOOTRESP,
cmd_type);
return ipc_sm_state(IPC_SM_HALT);
}
}
/* the driver protocol state machine */
static const struct ipc_sm_state state_machine[IPC_SM_STATE_ID_NBR] = {
[IPC_SM_INIT] = {
.id = IPC_SM_INIT,
.enter = sm_init_enter,
.exit = sm_init_exit,
.events = IPC_SM_RUN_INIT | IPC_SM_RUN_RESET
},
[IPC_SM_HALT] = {
.id = IPC_SM_HALT,
.enter = sm_halt_enter,
.exit = sm_halt_exit,
.events = IPC_SM_RUN_RESET
},
[IPC_SM_RESET] = {
.id = IPC_SM_RESET,
.enter = sm_reset_enter,
.exit = sm_reset_exit,
.events = IPC_SM_RUN_RESET
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key>
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key>
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key>
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key>
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key> | <API key>
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key>
},
[IPC_SM_IDL] = {
.id = IPC_SM_IDL,
.enter = sm_idl_enter,
.exit = sm_idl_exit,
.events = <API key> | IPC_SM_RUN_TX_REQ |
IPC_SM_RUN_RESET
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key> | <API key> |
IPC_SM_RUN_RESET
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key> | IPC_SM_RUN_RESET
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key> | <API key> |
IPC_SM_RUN_RESET
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key> | IPC_SM_RUN_RESET
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key> | <API key> |
IPC_SM_RUN_RESET
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key> | IPC_SM_RUN_RESET
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key> | <API key> |
IPC_SM_RUN_RESET
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key> | IPC_SM_RUN_RESET
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key> | IPC_SM_RUN_RESET
},
/* audio link states below */
[IPC_SM_INIT_AUD] = {
.id = IPC_SM_INIT_AUD,
.enter = sm_init_enter,
.exit = sm_init_aud_exit,
.events = IPC_SM_RUN_INIT | IPC_SM_RUN_RESET
},
[IPC_SM_HALT_AUD] = {
.id = IPC_SM_HALT_AUD,
.enter = sm_halt_enter,
.exit = sm_halt_aud_exit,
.events = IPC_SM_RUN_RESET
},
[IPC_SM_RESET_AUD] = {
.id = IPC_SM_RESET_AUD,
.enter = sm_reset_enter,
.exit = sm_reset_aud_exit,
.events = IPC_SM_RUN_RESET
},
[IPC_SM_IDL_AUD] = {
.id = IPC_SM_IDL_AUD,
.enter = sm_idl_enter,
.exit = sm_idl_aud_exit,
.events = <API key> | IPC_SM_RUN_TX_REQ |
IPC_SM_RUN_RESET
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key> | <API key> |
IPC_SM_RUN_RESET
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key> | IPC_SM_RUN_RESET
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key> | <API key> |
IPC_SM_RUN_RESET
},
[<API key>] = {
.id = <API key>,
.enter = <API key>,
.exit = <API key>,
.events = <API key> | IPC_SM_RUN_RESET
}
};
const struct ipc_sm_state *ipc_sm_idle_state(struct ipc_link_context *context)
{
if (context->link->id == IPC_LINK_AUDIO)
return ipc_sm_state(IPC_SM_IDL_AUD);
else
return ipc_sm_state(IPC_SM_IDL);
}
const struct ipc_sm_state *ipc_sm_init_state(struct ipc_link_context *context)
{
if (context->link->id == IPC_LINK_AUDIO)
return ipc_sm_state(IPC_SM_INIT_AUD);
else
return ipc_sm_state(IPC_SM_INIT);
}
const struct ipc_sm_state *ipc_sm_state(u8 id)
{
BUG_ON(id >= IPC_SM_STATE_ID_NBR);
return &state_machine[id];
}
bool <API key>(u8 event, const struct ipc_sm_state *state)
{
return (state->events & event) == event;
}
static void state_machine_run(struct ipc_link_context *context, u8 event)
{
struct <API key> *link = context->link;
struct spi_device *sdev = context->sdev;
const struct ipc_sm_state *cur_state = context->state;
/* some sanity checking */
if (context == NULL || link == NULL || cur_state == NULL) {
pr_err("M6718 IPC protocol error: "
"inconsistent driver state, ignoring event\n");
return;
}
dev_dbg(&sdev->dev, "link %d: RUNNING in %s (%s)\n", link->id,
ipc_dbg_state_id(cur_state), ipc_dbg_event(event));
/* valid trigger event for current state? */
if (!<API key>(event, cur_state)) {
dev_dbg(&sdev->dev,
"link %d: ignoring invalid event\n", link->id);
<API key>(context, event);
return;
}
<API key>(context, event);
/* run machine while state entry functions trigger new changes */
do {
if (event == <API key> &&
!<API key>(context)) {
dev_err(&sdev->dev,
"link %d error: slave is not ready! (%s)",
link->id,
ipc_dbg_state_id(cur_state));
}
if (event == IPC_SM_RUN_ABORT) {
dev_err(&sdev->dev,
"link %d error: abort event\n", link->id);
/* reset state to idle */
context->state = ipc_sm_idle_state(context);
break;
} else {
/* exit current state */
dev_dbg(&sdev->dev, "link %d: exit %s (%s)\n",
link->id, ipc_dbg_state_id(cur_state),
ipc_dbg_event(event));
cur_state = cur_state->exit(event, context);
context->state = cur_state;
}
/* reset state of slave irq to prepare for next event */
if (event == <API key>)
atomic_set(&context->state_int, 0);
/* enter new state */
dev_dbg(&sdev->dev, "link %d: enter %s (%s)\n", link->id,
ipc_dbg_state_id(cur_state), ipc_dbg_event(event));
event = context->state->enter(event, context);
<API key>(context);
} while (event != IPC_SM_RUN_NONE);
dev_dbg(&sdev->dev, "link %d: STOPPED in %s\n", link->id,
ipc_dbg_state_id(cur_state));
}
void ipc_sm_kick(u8 event, struct ipc_link_context *context)
{
unsigned long flags;
struct <API key> *link = context->link;
struct spi_device *sdev = context->sdev;
struct spi_message *msg = &context->spi_message;
u8 i;
spin_lock_irqsave(&context->sm_lock, flags);
switch (event) {
case <API key>:
dev_dbg(&sdev->dev,
"link %d EVENT: slave-ready irq\n", link->id);
del_timer(&context->comms_timer);
atomic_set(&context->state_int,
<API key>(context));
break;
case <API key>:
dev_dbg(&sdev->dev,
"link %d EVENT: spi tfr complete (status %d len %d)\n",
link->id, msg->status, msg->actual_length);
<API key>(context);
break;
case <API key>:
{
char *statestr;
struct ipc_link_context *contexts = l1_context.device_context;
statestr = <API key>(context);
dev_err(&sdev->dev,
"link %d EVENT: modem comms timeout (%s)!\n",
link->id, ipc_dbg_state_id(context->state));
if (statestr != NULL) {
dev_err(&sdev->dev, "%s", statestr);
kfree(statestr);
}
/* cancel all link timeout timers except this one */
for (i = 0; i < <API key>; i++)
if (contexts[i].link->id != link->id)
del_timer(&contexts[i].comms_timer);
break;
}
case <API key>:
dev_dbg(&sdev->dev,
"link %d EVENT: slave-stable timeout\n", link->id);
break;
case IPC_SM_RUN_RESET:
dev_dbg(&sdev->dev,
"link %d EVENT: reset\n", link->id);
del_timer(&context->comms_timer);
break;
default:
break;
}
if (!<API key>(context))
state_machine_run(context, event);
else
dev_dbg(&sdev->dev,
"link %d is suspended, waiting for resume\n", link->id);
<API key>(&context->sm_lock, flags);
}
|
#ifdef __TURBOC__
# ifndef __COMPACT__
# error "The COMPACT model is needed"
# endif
#endif
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
#include <time.h>
#if defined(__TURBOC__) | defined(MSC)
# include <io.h> /* for type declarations */
#endif
#ifdef UCB
# include <strings.h>
#else
# include <string.h>
#endif
#ifdef VMS
# define GOOD 1
#else
# define GOOD 0
#endif
#ifdef __TURBOC__
#define MAXLEN (0xfff0) /* maximum length of document */
/* A segment is 64k bytes! */
#else
/* ... but no problem on virtual operating systems */
#define MAXLEN (1024*1024) /* maximum length of document */
#endif
#define MAXWORD 250 /* maximum word length */
#define MAXLINE 500 /* maximum line length */
#define MAXDEF 200 /* maximum number of defines */
#define MAXARGS 128 /* maximal number of arguments */
#define EOS '\0' /* end of string */
#if defined(__TURBOC__) | defined (VAXC)
# define index strchr
#endif
#ifdef MAIN /* can only declare globals once */
# define GLOBAL
#else
# define GLOBAL extern
#endif
GLOBAL int math_mode, /* math mode status */
de_arg, /* .de argument */
IP_stat, /* IP status */
QP_stat, /* QP status */
TP_stat; /* TP status */
#ifdef DEBUG
GLOBAL int debug_o;
GLOBAL int debug_v;
#endif
GLOBAL struct defs {
char *def_macro;
char *replace;
int illegal;
} def[MAXDEF];
GLOBAL struct mydefs {
char *def_macro;
char *replace;
int illegal;
int arg_no;
int par; /* if it impiles (or contains) a par break */
} mydef[MAXDEF];
GLOBAL struct measure {
char old_units[MAXWORD]; float old_value;
char units[MAXWORD]; float value;
char def_units[MAXWORD]; /* default units */
int def_value; /* default value: 0 means take last one */
} linespacing, indent, tmpind, space, vspace;
typedef unsigned char bool;
extern int errno;
|
<!DOCTYPE html PUBLIC "-
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/js.cookie.js"></script>
<title>BenchmarkTest00250</title>
</head>
<body>
<form action="/benchmark/BenchmarkTest00250" method="POST" id="<API key>">
<div><label>Please explain your answer:</label></div>
<br/>
<div><textarea rows="4" cols="50" id="vectorArea" name="vectorArea" value=""></textarea></div>
<div><label>Any additional note for the reviewer:</label></div>
<div><input type="text" id="answer" name="answer"></input></div>
<br/>
<div><label>An AJAX request will be sent with a header named vector and value:</label>
<input type="text" id="vector" name="vector" value="color" class="safe"></input></div>
<div><input type="button" id="login-btn" value="Login" /></div>
</form>
<div id="ajax-form-msg1"><pre><code class="prettyprint" id="code"></code></pre></div>
<script>
$('.safe').keypress(function (e) {
if (e.which == 13) {
$('#login-btn').trigger('click');
return false;
}
});
$("#login-btn").click(function(){
var formData = $("#<API key>").serializeArray();
var URL = $("#<API key>").attr("action");
var text = $("#<API key> input[id=vector]").val();
$.ajax({
beforeSend: function (request){
request.setRequestHeader($("#<API key> input[id=vector]").val(), 'vector');
},
url : URL,
type: "POST",
data : formData,
success: function(data, textStatus, jqXHR){
$("#code").text(data);
},
error: function (jqXHR, textStatus, errorThrown){ console.error(errorThrown);}
});
});
</script>
</body>
</html>
|
#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http:
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
<API key> = part[line_number];
name = <API key>.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = <API key>.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http:
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for <API key> in long_description:
sys.stdout.write(<API key>.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print ""
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
|
#if !defined(CMANY_HPP)
#define CMANY_HPP
#include <util/XercesDefs.hpp>
#include <validators/common/CMNode.hpp>
class CMStateSet;
class CMAny : public CMNode
{
public :
// Constructors
CMAny
(
const ContentSpecNode::NodeTypes type
, const unsigned int URI
, const unsigned int position
);
~CMAny();
// Getter methods
unsigned int getURI() const;
unsigned int getPosition() const;
// Setter methods
void setPosition(const unsigned int newPosition);
// Implementation of the public CMNode virtual interface
bool isNullable() const;
protected :
// Implementation of the protected CMNode virtual interface
void calcFirstPos(CMStateSet& toSet) const;
void calcLastPos(CMStateSet& toSet) const;
private :
// Private data members
// fURI;
// URI of the any content model. This value is set if the type is
// of the following:
// XMLContentSpec.CONTENTSPECNODE_ANY,
// XMLContentSpec.<API key>.
// fPosition
// Part of the algorithm to convert a regex directly to a DFA
// numbers each leaf sequentially. If its -1, that means its an
// epsilon node. Zero and greater are non-epsilon positions.
unsigned int fURI;
unsigned int fPosition;
};
#endif
|
<?php // $Id: report.php,v 1.29 2008/11/30 21:33:58 skodak Exp $
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
$courses = get_courses('all','c.shortname','c.id,c.shortname,c.fullname');
$courseoptions = array();
foreach ($courses as $c) {
$context = <API key>(CONTEXT_COURSE, $c->id);
if (has_capability('coursereport/stats:view', $context)) {
$courseoptions[$c->id] = $c->shortname;
}
}
$reportoptions = <API key>($course->id, $mode);
$timeoptions = <API key>($mode);
if (empty($timeoptions)) {
print_error('nostatstodisplay', '', $CFG->wwwroot.'/course/view.php?id='.$course->id);
}
$table->width = 'auto';
if ($mode == STATS_MODE_DETAILED) {
$param = <API key>($time,null,$course->id,$mode); // we only care about the table and the time string (if we have time)
//TODO: lceanup this ugly mess
$sql = 'SELECT DISTINCT s.userid, u.firstname, u.lastname, u.idnumber
FROM {stats_user_'.$param->table.'} s
JOIN {user} u ON u.id = s.userid
WHERE courseid = '.$course->id
. ((!empty($param->stattype)) ? ' AND stattype = \''.$param->stattype.'\'' : '')
. ((!empty($time)) ? ' AND timeend >= '.$param->timeafter : '')
.' ORDER BY u.lastname, u.firstname ASC';
if (!$us = $DB->get_records_sql($sql, $param->params)) {
print_error('nousers');
}
foreach ($us as $u) {
$users[$u->userid] = fullname($u, true);
}
$table->align = array('left','left','left','left','left','left','left','left');
$table->data[] = array(get_string('course'),choose_from_menu($courseoptions,'course',$course->id,'','','',true),
get_string('users'),choose_from_menu($users,'userid',$userid,'','','',true),
get_string('statsreporttype'),choose_from_menu($reportoptions,'report',($report == 5) ? $report.$roleid : $report,'','','',true),
get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true),
'<input type="submit" value="'.get_string('view').'" />') ;
} else if ($mode == STATS_MODE_RANKED) {
$table->align = array('left','left','left','left','left','left');
$table->data[] = array(get_string('statsreporttype'),choose_from_menu($reportoptions,'report',($report == 5) ? $report.$roleid : $report,'','','',true),
get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true),
'<input type="submit" value="'.get_string('view').'" />') ;
} else if ($mode == STATS_MODE_GENERAL) {
$table->align = array('left','left','left','left','left','left','left');
$table->data[] = array(get_string('course'),choose_from_menu($courseoptions,'course',$course->id,'','','',true),
get_string('statsreporttype'),choose_from_menu($reportoptions,'report',($report == 5) ? $report.$roleid : $report,'','','',true),
get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true),
'<input type="submit" value="'.get_string('view').'" />') ;
}
echo '<form action="index.php" method="post">'."\n"
.'<div>'."\n"
.'<input type="hidden" name="mode" value="'.$mode.'" />'."\n";
print_table($table);
echo '</div>';
echo '</form>';
if (!empty($report) && !empty($time)) {
if ($report == STATS_REPORT_LOGINS && $course->id != SITEID) {
print_error('reportnotavailable');
}
$param = <API key>($time,$report,$course->id,$mode);
if ($mode == STATS_MODE_DETAILED) {
$param->table = 'user_'.$param->table;
}
if (!empty($param->sql)) {
$sql = $param->sql;
} else {
//TODO: lceanup this ugly mess
$sql = 'SELECT '.((empty($param->fieldscomplete)) ? 'id,roleid,timeend,' : '').$param->fields
.' FROM {stats_'.$param->table.'} WHERE '
.(($course->id == SITEID) ? '' : ' courseid = '.$course->id.' AND ')
.((!empty($userid)) ? ' userid = '.$userid.' AND ' : '')
.((!empty($roleid)) ? ' roleid = '.$roleid.' AND ' : '')
. ((!empty($param->stattype)) ? ' stattype = \''.$param->stattype.'\' AND ' : '')
.' timeend >= '.$param->timeafter
.' '.$param->extras
.' ORDER BY timeend DESC';
}
$stats = $DB->get_records_sql($sql, $params);
if (empty($stats)) {
notify(get_string('statsnodata'));
} else {
$stats = stats_fix_zeros($stats,$param->timeafter,$param->table,(!empty($param->line2)));
print_heading(format_string($course->shortname).' - '.get_string('statsreport'.$report)
.((!empty($user)) ? ' '.get_string('statsreportforuser').' ' .fullname($user,true) : '')
.((!empty($roleid)) ? ' '.$DB->get_field('role','name', array('id'=>$roleid)) : ''));
if (empty($CFG->gdversion)) {
echo "(".get_string("gdneed").")";
} else {
if ($mode == STATS_MODE_DETAILED) {
echo '<div class="graph"><img src="'.$CFG->wwwroot.'/course/report/stats/graph.php?mode='.$mode.'&course='.$course->id.'&time='.$time.'&report='.$report.'&userid='.$userid.'" alt="'.get_string('statisticsgraph').'" /></div';
} else {
echo '<div class="graph"><img src="'.$CFG->wwwroot.'/course/report/stats/graph.php?mode='.$mode.'&course='.$course->id.'&time='.$time.'&report='.$report.'&roleid='.$roleid.'" alt="'.get_string('statisticsgraph').'" /></div>';
}
}
$table = new StdClass;
$table->align = array('left','center','center','center');
$param->table = str_replace('user_','',$param->table);
switch ($param->table) {
case 'daily' : $period = get_string('day'); break;
case 'weekly' : $period = get_string('week'); break;
case 'monthly': $period = get_string('month', 'form'); break;
default : $period = '';
}
$table->head = array(get_string('periodending','moodle',$period));
if (empty($param->crosstab)) {
$table->head[] = $param->line1;
if (!empty($param->line2)) {
$table->head[] = $param->line2;
}
}
if (empty($param->crosstab)) {
foreach ($stats as $stat) {
$a = array(userdate($stat->timeend-(60*60*24),get_string('strftimedate'),$CFG->timezone),$stat->line1);
if (isset($stat->line2)) {
$a[] = $stat->line2;
}
if (empty($CFG->loglifetime) || ($stat->timeend-(60*60*24)) >= (time()-60*60*24*$CFG->loglifetime)) {
if (has_capability('coursereport/log:view', <API key>(CONTEXT_COURSE, $course->id))) {
$a[] = '<a href="'.$CFG->wwwroot.'/course/report/log/index.php?id='.
$course->id.'&chooselog=1&showusers=1&showcourses=1&user='
.$userid.'&date='.usergetmidnight($stat->timeend-(60*60*24)).'">'
.get_string('course').' ' .get_string('logs').'</a> ';
} else {
$a[] = '';
}
}
$table->data[] = $a;
}
} else {
$data = array();
$roles = array();
$times = array();
$missedlines = array();
$rolenames = get_all_roles();
foreach ($rolenames as $r) {
$rolenames[$r->id] = $r->name;
}
$rolenames = role_fix_names($rolenames, <API key>(CONTEXT_COURSE, $course->id));
foreach ($stats as $stat) {
if (!empty($stat->zerofixed)) {
$missedlines[] = $stat->timeend;
}
$data[$stat->timeend][$stat->roleid] = $stat->line1;
if ($stat->roleid != 0) {
if (!array_key_exists($stat->roleid,$roles)) {
$roles[$stat->roleid] = $rolenames[$stat->roleid];
}
} else {
if (!array_key_exists($stat->roleid,$roles)) {
$roles[$stat->roleid] = get_string('all');
}
}
if (!array_key_exists($stat->timeend,$times)) {
$times[$stat->timeend] = userdate($stat->timeend,get_string('strftimedate'),$CFG->timezone);
}
}
foreach ($data as $time => $rolesdata) {
if (in_array($time,$missedlines)) {
$rolesdata = array();
foreach ($roles as $roleid => $guff) {
$rolesdata[$roleid] = 0;
}
}
else {
foreach (array_keys($roles) as $r) {
if (!array_key_exists($r, $rolesdata)) {
$rolesdata[$r] = 0;
}
}
}
krsort($rolesdata);
$row = array_merge(array($times[$time]),$rolesdata);
if (empty($CFG->loglifetime) || ($stat->timeend-(60*60*24)) >= (time()-60*60*24*$CFG->loglifetime)) {
if (has_capability('coursereport/log:view', <API key>(CONTEXT_COURSE, $course->id))) {
$row[] = '<a href="'.$CFG->wwwroot.'/course/report/log/index.php?id='
.$course->id.'&chooselog=1&showusers=1&showcourses=1&user='.$userid
.'&date='.usergetmidnight($time-(60*60*24)).'">'
.get_string('course').' ' .get_string('logs').'</a> ';
} else {
$row[] = '';
}
}
$table->data[] = $row;
}
krsort($roles);
$table->head = array_merge($table->head,$roles);
}
$table->head[] = get_string('logs');
if (!empty($lastrecord)) {
$lastrecord[] = $lastlink;
$table->data[] = $lastrecord;
}
print_table($table);
}
}
?>
|
module Actions
module Pulp3
module Repository
class CreatePublication < Pulp3::AbstractAsyncTask
middleware.use Actions::Middleware::<API key>
def plan(repository, smart_proxy, options)
sequence do
action = plan_self(:repository_id => repository.id, :smart_proxy_id => smart_proxy.id, :contents_changed => options[:contents_changed], :options => options)
plan_action(SavePublication, repository, action.output, :contents_changed => options[:contents_changed])
end
end
def <API key>
repository = ::Katello::Repository.find(input[:repository_id])
smart_proxy = ::SmartProxy.find(input[:smart_proxy_id])
if repository.publication_href.nil? || input[:options][:force]
output[:response] = repository.backend_service(smart_proxy).create_publication
else
[]
end
end
end
end
end
end
|
'use strict';
app.controller('orderController', ['$scope', '$rootScope', 'toastrService', 'orderService',
function ($scope, $rootScope, toastrService, orderService) {
$scope.paging = 1;
$scope.disabledMore = false;
$scope.data = [];
$scope.getOrders = function () {
orderService.get($scope.paging).then(function (data) {
if (data.length > 0) {
$scope.data.push.apply($scope.data, data);
} else {
$scope.disabledMore = true;
}
});
}
$scope.more = function () {
$scope.paging++;
$scope.getOrders();
};
$scope.refresh = function () {
$scope.paging = 1;
$scope.data = [];
$scope.getOrders();
};
$scope.getOrders();
$scope.openOrder = function (item, $index) {
$scope.order = item;
$scope.order.$index = $index;
$('#modal-order').modal({
backdrop: true
});
};
}
]);
|
obj-$(CONFIG_ICDTCP3_ITD) += itddrv.o
obj-$(CONFIG_ICDTCP3_LCD) += hd44780drv.o
obj-$(CONFIG_ICDTCP3) += icdcommon.o
|
#!/usr/bin/env python
# Users can change the output by editing
# this file directly.
import sys
sys.stdout.write('
sys.stdout.write('
sys.stdout.write('# -- TEXTPATGEN GENERATED FILE --\n')
sys.stdout.write('
sys.stdout.write('# -- Created from a Python script.\n')
sys.stdout.write('
sys.stdout.write("
num=0
for length in range(0, 16):
for width in range(0, 15):
sys.stdout.write('X-%04X ' % num)
num=num+1
width=width+1
length=length+1
sys.stdout.write('X-%04X\n' % num)
num=num+1
sys.stdout.write('# -- End of file.\n');
sys.stdout.flush()
|
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php
/*
* Print the <title> tag based on what is being viewed.
*/
global $page, $paged;
wp_title( '|', true, 'right' );
// Add the blog name.
bloginfo( 'name' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
echo " | $site_description";
// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );
?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('template_url'); ?>/css/skin.css" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php
/* We add some JavaScript to pages with the comment form
* to support sites with threaded comments (when in use).
*/
if ( is_singular() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
/* Always have wp_head() just before the closing </head>
* tag of your theme, or you will break many plugins, which
* generally use this hook to add elements to <head> such
* as styles, scripts, and meta tags.
*/
wp_head();
?>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/javascript/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/javascript/jquery.jcarousel.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#mycarousel').jcarousel({
scroll:3,
auto:5,
wrap:"both"
});
});
</script>
</head>
<a name="menu"></a>
<body <?php body_class(); ?>>
<div class="centralizarCorpo content">
<div class="header">
<div class='img_header_detalhe <API key>'>
<div class="<API key> <API key>"></div>
<div class="<API key> <API key>"></div>
</div>
<div class="img_header_menu <API key>"></div>
<div class="img_header_line <API key>"></div>
<div class="menu">
<a class="bt_empresa" href="#empresa"><div class="img_header_bt1 img_header_bt1_size"></div></a>
<a class="bt_consultoria" href="#consultoria"><div class="img_header_bt2 img_header_bt2_size"></div></a>
<a class="bt_treinamentos" href="#treinamento"><div class="img_header_bt3 img_header_bt3_size"></div></a>
<a class="bt_clientes" href="#clientes"><div class="img_header_bt4 img_header_bt4_size"></div></a>
<a class="bt_contato" href="#contato"><div class="img_header_bt5 img_header_bt5_size"></div></a>
</div>
</div>
|
from .. import config
from .. import fixtures
from ..assertions import eq_
from ..assertions import in_
from ..schema import Column
from ..schema import Table
from ... import bindparam
from ... import case
from ... import Computed
from ... import exists
from ... import false
from ... import func
from ... import Integer
from ... import literal
from ... import literal_column
from ... import null
from ... import select
from ... import String
from ... import testing
from ... import text
from ... import true
from ... import tuple_
from ... import union
from ... import util
class CollateTest(fixtures.TablesTest):
__backend__ = True
@classmethod
def define_tables(cls, metadata):
Table(
"some_table",
metadata,
Column("id", Integer, primary_key=True),
Column("data", String(100)),
)
@classmethod
def insert_data(cls, connection):
connection.execute(
cls.tables.some_table.insert(),
[
{"id": 1, "data": "collate data1"},
{"id": 2, "data": "collate data2"},
],
)
def _assert_result(self, select, result):
eq_(config.db.execute(select).fetchall(), result)
@testing.requires.order_by_collation
def <API key>(self):
collation = testing.requires.<API key>(testing.config)
self._assert_result(
select([self.tables.some_table]).order_by(
self.tables.some_table.c.data.collate(collation).asc()
),
[(1, "collate data1"), (2, "collate data2")],
)
class OrderByLabelTest(fixtures.TablesTest):
"""Test the dialect sends appropriate ORDER BY expressions when
labels are used.
This essentially exercises the "<API key>"
setting.
"""
__backend__ = True
@classmethod
def define_tables(cls, metadata):
Table(
"some_table",
metadata,
Column("id", Integer, primary_key=True),
Column("x", Integer),
Column("y", Integer),
Column("q", String(50)),
Column("p", String(50)),
)
@classmethod
def insert_data(cls, connection):
connection.execute(
cls.tables.some_table.insert(),
[
{"id": 1, "x": 1, "y": 2, "q": "q1", "p": "p3"},
{"id": 2, "x": 2, "y": 3, "q": "q2", "p": "p2"},
{"id": 3, "x": 3, "y": 4, "q": "q3", "p": "p1"},
],
)
def _assert_result(self, select, result):
eq_(config.db.execute(select).fetchall(), result)
def test_plain(self):
table = self.tables.some_table
lx = table.c.x.label("lx")
self._assert_result(select([lx]).order_by(lx), [(1,), (2,), (3,)])
def test_composed_int(self):
table = self.tables.some_table
lx = (table.c.x + table.c.y).label("lx")
self._assert_result(select([lx]).order_by(lx), [(3,), (5,), (7,)])
def <API key>(self):
table = self.tables.some_table
lx = (table.c.x + table.c.y).label("lx")
ly = (func.lower(table.c.q) + table.c.p).label("ly")
self._assert_result(
select([lx, ly]).order_by(lx, ly.desc()),
[(3, util.u("q1p3")), (5, util.u("q2p2")), (7, util.u("q3p1"))],
)
def test_plain_desc(self):
table = self.tables.some_table
lx = table.c.x.label("lx")
self._assert_result(
select([lx]).order_by(lx.desc()), [(3,), (2,), (1,)]
)
def <API key>(self):
table = self.tables.some_table
lx = (table.c.x + table.c.y).label("lx")
self._assert_result(
select([lx]).order_by(lx.desc()), [(7,), (5,), (3,)]
)
@testing.requires.<API key>
def <API key>(self):
table = self.tables.some_table
expr = (table.c.x + table.c.y).label("lx")
stmt = (
select([func.count(table.c.id), expr])
.group_by(expr)
.order_by(expr)
)
self._assert_result(stmt, [(1, 3), (1, 5), (1, 7)])
class LimitOffsetTest(fixtures.TablesTest):
__backend__ = True
@classmethod
def define_tables(cls, metadata):
Table(
"some_table",
metadata,
Column("id", Integer, primary_key=True),
Column("x", Integer),
Column("y", Integer),
)
@classmethod
def insert_data(cls, connection):
connection.execute(
cls.tables.some_table.insert(),
[
{"id": 1, "x": 1, "y": 2},
{"id": 2, "x": 2, "y": 3},
{"id": 3, "x": 3, "y": 4},
{"id": 4, "x": 4, "y": 5},
],
)
def _assert_result(self, select, result, params=()):
eq_(config.db.execute(select, params).fetchall(), result)
def test_simple_limit(self):
table = self.tables.some_table
self._assert_result(
select([table]).order_by(table.c.id).limit(2),
[(1, 1, 2), (2, 2, 3)],
)
@testing.requires.offset
def test_simple_offset(self):
table = self.tables.some_table
self._assert_result(
select([table]).order_by(table.c.id).offset(2),
[(3, 3, 4), (4, 4, 5)],
)
@testing.requires.offset
def <API key>(self):
table = self.tables.some_table
self._assert_result(
select([table]).order_by(table.c.id).limit(2).offset(1),
[(2, 2, 3), (3, 3, 4)],
)
@testing.requires.offset
def <API key>(self):
"""test that 'literal binds' mode works - no bound params."""
table = self.tables.some_table
stmt = select([table]).order_by(table.c.id).limit(2).offset(1)
sql = stmt.compile(
dialect=config.db.dialect, compile_kwargs={"literal_binds": True}
)
sql = str(sql)
self._assert_result(sql, [(2, 2, 3), (3, 3, 4)])
@testing.requires.bound_limit_offset
def test_bound_limit(self):
table = self.tables.some_table
self._assert_result(
select([table]).order_by(table.c.id).limit(bindparam("l")),
[(1, 1, 2), (2, 2, 3)],
params={"l": 2},
)
@testing.requires.bound_limit_offset
def test_bound_offset(self):
table = self.tables.some_table
self._assert_result(
select([table]).order_by(table.c.id).offset(bindparam("o")),
[(3, 3, 4), (4, 4, 5)],
params={"o": 2},
)
@testing.requires.bound_limit_offset
def <API key>(self):
table = self.tables.some_table
self._assert_result(
select([table])
.order_by(table.c.id)
.limit(bindparam("l"))
.offset(bindparam("o")),
[(2, 2, 3), (3, 3, 4)],
params={"l": 2, "o": 1},
)
class CompoundSelectTest(fixtures.TablesTest):
__backend__ = True
@classmethod
def define_tables(cls, metadata):
Table(
"some_table",
metadata,
Column("id", Integer, primary_key=True),
Column("x", Integer),
Column("y", Integer),
)
@classmethod
def insert_data(cls, connection):
connection.execute(
cls.tables.some_table.insert(),
[
{"id": 1, "x": 1, "y": 2},
{"id": 2, "x": 2, "y": 3},
{"id": 3, "x": 3, "y": 4},
{"id": 4, "x": 4, "y": 5},
],
)
def _assert_result(self, select, result, params=()):
eq_(config.db.execute(select, params).fetchall(), result)
def test_plain_union(self):
table = self.tables.some_table
s1 = select([table]).where(table.c.id == 2)
s2 = select([table]).where(table.c.id == 3)
u1 = union(s1, s2)
self._assert_result(u1.order_by(u1.c.id), [(2, 2, 3), (3, 3, 4)])
def <API key>(self):
table = self.tables.some_table
s1 = select([table]).where(table.c.id == 2)
s2 = select([table]).where(table.c.id == 3)
u1 = union(s1, s2).alias().select()
self._assert_result(u1.order_by(u1.c.id), [(2, 2, 3), (3, 3, 4)])
@testing.requires.<API key>
@testing.requires.<API key>
def <API key>(self):
table = self.tables.some_table
s1 = (
select([table])
.where(table.c.id == 2)
.limit(1)
.order_by(table.c.id)
)
s2 = (
select([table])
.where(table.c.id == 3)
.limit(1)
.order_by(table.c.id)
)
u1 = union(s1, s2).limit(2)
self._assert_result(u1.order_by(u1.c.id), [(2, 2, 3), (3, 3, 4)])
@testing.requires.<API key>
def <API key>(self):
table = self.tables.some_table
s1 = select([table]).where(table.c.id == 2).order_by(table.c.id)
s2 = select([table]).where(table.c.id == 3).order_by(table.c.id)
u1 = union(s1, s2).limit(2)
self._assert_result(u1.order_by(u1.c.id), [(2, 2, 3), (3, 3, 4)])
def <API key>(self):
table = self.tables.some_table
s1 = select([table]).where(table.c.id == 2).distinct()
s2 = select([table]).where(table.c.id == 3).distinct()
u1 = union(s1, s2).limit(2)
self._assert_result(u1.order_by(u1.c.id), [(2, 2, 3), (3, 3, 4)])
@testing.requires.<API key>
def <API key>(self):
table = self.tables.some_table
s1 = (
select([table])
.where(table.c.id == 2)
.limit(1)
.order_by(table.c.id)
)
s2 = (
select([table])
.where(table.c.id == 3)
.limit(1)
.order_by(table.c.id)
)
# this necessarily has double parens
u1 = union(s1, s2).alias()
self._assert_result(
u1.select().limit(2).order_by(u1.c.id), [(2, 2, 3), (3, 3, 4)]
)
def <API key>(self):
table = self.tables.some_table
s1 = (
select([table])
.where(table.c.id == 2)
.limit(1)
.order_by(table.c.id)
.alias()
.select()
)
s2 = (
select([table])
.where(table.c.id == 3)
.limit(1)
.order_by(table.c.id)
.alias()
.select()
)
u1 = union(s1, s2).limit(2)
self._assert_result(u1.order_by(u1.c.id), [(2, 2, 3), (3, 3, 4)])
class <API key>(fixtures.TablesTest):
__backend__ = True
@classmethod
def define_tables(cls, metadata):
Table(
"some_table",
metadata,
Column("id", Integer, primary_key=True),
Column("x", Integer),
Column("y", Integer),
Column("z", String(50)),
)
@classmethod
def insert_data(cls, connection):
connection.execute(
cls.tables.some_table.insert(),
[
{"id": 1, "x": 1, "y": 2, "z": "z1"},
{"id": 2, "x": 2, "y": 3, "z": "z2"},
{"id": 3, "x": 3, "y": 4, "z": "z3"},
{"id": 4, "x": 4, "y": 5, "z": "z4"},
],
)
def _assert_result(self, select, result, params=()):
eq_(config.db.execute(select, params).fetchall(), result)
def <API key>(self):
# test that any anonymous aliasing used by the dialect
# is fine with duplicates
table = self.tables.some_table
stmt = (
select([table.c.id])
.where(table.c.x.in_(bindparam("q", expanding=True)))
.where(table.c.y.in_(bindparam("p", expanding=True)))
.order_by(table.c.id)
)
self._assert_result(stmt, [], params={"q": [], "p": []})
@testing.requires.tuple_in
def <API key>(self):
table = self.tables.some_table
stmt = (
select([table.c.id])
.where(
tuple_(table.c.x, table.c.z).in_(
bindparam("q", expanding=True)
)
)
.order_by(table.c.id)
)
self._assert_result(stmt, [], params={"q": []})
@testing.requires.tuple_in
def <API key>(self):
table = self.tables.some_table
stmt = (
select([table.c.id])
.where(
tuple_(table.c.x, table.c.y).in_(
bindparam("q", expanding=True)
)
)
.order_by(table.c.id)
)
self._assert_result(stmt, [], params={"q": []})
def <API key>(self):
table = self.tables.some_table
stmt = (
select([table.c.id])
.where(table.c.x.in_(bindparam("q", expanding=True)))
.order_by(table.c.id)
)
self._assert_result(stmt, [(2,), (3,), (4,)], params={"q": [2, 3, 4]})
@testing.requires.tuple_in
def <API key>(self):
table = self.tables.some_table
stmt = (
select([table.c.id])
.where(
tuple_(table.c.x, table.c.y).in_(
bindparam("q", expanding=True)
)
)
.order_by(table.c.id)
)
self._assert_result(
stmt, [(2,), (3,), (4,)], params={"q": [(2, 3), (3, 4), (4, 5)]}
)
@testing.requires.tuple_in
def <API key>(self):
table = self.tables.some_table
stmt = (
select([table.c.id])
.where(
tuple_(table.c.x, table.c.z).in_(
bindparam("q", expanding=True)
)
)
.order_by(table.c.id)
)
self._assert_result(
stmt,
[(2,), (3,), (4,)],
params={"q": [(2, "z2"), (3, "z3"), (4, "z4")]},
)
def <API key>(self):
table = self.tables.some_table
stmt = (
select([table.c.id])
.where(table.c.x.in_(bindparam("q", expanding=True)))
.order_by(table.c.id)
)
self._assert_result(stmt, [], params={"q": []})
def <API key>(self):
table = self.tables.some_table
stmt = (
select([table.c.id])
.where(table.c.x.notin_(bindparam("q", expanding=True)))
.order_by(table.c.id)
)
self._assert_result(stmt, [(1,), (2,), (3,), (4,)], params={"q": []})
def <API key>(self):
table = self.tables.some_table
stmt = (
select([table.c.id])
.where(table.c.z.in_(bindparam("q", expanding=True)))
.order_by(table.c.id)
)
self._assert_result(stmt, [], params={"q": []})
def <API key>(self):
table = self.tables.some_table
stmt = (
select([table.c.id])
.where(table.c.z.notin_(bindparam("q", expanding=True)))
.order_by(table.c.id)
)
self._assert_result(stmt, [(1,), (2,), (3,), (4,)], params={"q": []})
def <API key>(self):
stmt = select(
[
case(
[
(
null().in_(
bindparam("foo", value=(), expanding=True)
),
true(),
)
],
else_=false(),
)
]
)
in_(config.db.execute(stmt).fetchone()[0], (False, 0))
class LikeFunctionsTest(fixtures.TablesTest):
__backend__ = True
run_inserts = "once"
run_deletes = None
@classmethod
def define_tables(cls, metadata):
Table(
"some_table",
metadata,
Column("id", Integer, primary_key=True),
Column("data", String(50)),
)
@classmethod
def insert_data(cls, connection):
connection.execute(
cls.tables.some_table.insert(),
[
{"id": 1, "data": "abcdefg"},
{"id": 2, "data": "ab/cdefg"},
{"id": 3, "data": "ab%cdefg"},
{"id": 4, "data": "ab_cdefg"},
{"id": 5, "data": "abcde/fg"},
{"id": 6, "data": "abcde%fg"},
{"id": 7, "data": "ab#cdefg"},
{"id": 8, "data": "ab9cdefg"},
{"id": 9, "data": "abcde
{"id": 10, "data": "abcd9fg"},
],
)
def _test(self, expr, expected):
some_table = self.tables.some_table
with config.db.connect() as conn:
rows = {
value
for value, in conn.execute(
select([some_table.c.id]).where(expr)
)
}
eq_(rows, expected)
def <API key>(self):
col = self.tables.some_table.c.data
self._test(col.startswith("ab%c"), {1, 2, 3, 4, 5, 6, 7, 8, 9, 10})
def <API key>(self):
col = self.tables.some_table.c.data
self._test(col.startswith("ab%c", autoescape=True), {3})
def <API key>(self):
col = self.tables.some_table.c.data
self._test(
col.startswith(literal_column("'ab%c'")),
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
)
def <API key>(self):
col = self.tables.some_table.c.data
self._test(col.startswith("ab##c", escape="#"), {7})
def <API key>(self):
col = self.tables.some_table.c.data
self._test(col.startswith("ab%c", autoescape=True, escape="
self._test(col.startswith("ab#c", autoescape=True, escape="#"), {7})
def <API key>(self):
col = self.tables.some_table.c.data
self._test(col.endswith("e%fg"), {1, 2, 3, 4, 5, 6, 7, 8, 9})
def <API key>(self):
col = self.tables.some_table.c.data
self._test(
col.endswith(literal_column("'e%fg'")), {1, 2, 3, 4, 5, 6, 7, 8, 9}
)
def <API key>(self):
col = self.tables.some_table.c.data
self._test(col.endswith("e%fg", autoescape=True), {6})
def <API key>(self):
col = self.tables.some_table.c.data
self._test(col.endswith("e##fg", escape="#"), {9})
def <API key>(self):
col = self.tables.some_table.c.data
self._test(col.endswith("e%fg", autoescape=True, escape="
self._test(col.endswith("e#fg", autoescape=True, escape="#"), {9})
def <API key>(self):
col = self.tables.some_table.c.data
self._test(col.contains("b%cde"), {1, 2, 3, 4, 5, 6, 7, 8, 9})
def <API key>(self):
col = self.tables.some_table.c.data
self._test(col.contains("b%cde", autoescape=True), {3})
def <API key>(self):
col = self.tables.some_table.c.data
self._test(col.contains("b##cde", escape="#"), {7})
def <API key>(self):
col = self.tables.some_table.c.data
self._test(col.contains("b%cd", autoescape=True, escape="
self._test(col.contains("b#cd", autoescape=True, escape="#"), {7})
class ComputedColumnTest(fixtures.TablesTest):
__backend__ = True
__requires__ = ("computed_columns",)
@classmethod
def define_tables(cls, metadata):
Table(
"square",
metadata,
Column("id", Integer, primary_key=True),
Column("side", Integer),
Column("area", Integer, Computed("side * side")),
Column("perimeter", Integer, Computed("4 * side")),
)
@classmethod
def insert_data(cls, connection):
connection.execute(
cls.tables.square.insert(),
[{"id": 1, "side": 10}, {"id": 10, "side": 42}],
)
def test_select_all(self):
with config.db.connect() as conn:
res = conn.execute(
select([text("*")])
.select_from(self.tables.square)
.order_by(self.tables.square.c.id)
).fetchall()
eq_(res, [(1, 10, 100, 40), (10, 42, 1764, 168)])
def test_select_columns(self):
with config.db.connect() as conn:
res = conn.execute(
select(
[self.tables.square.c.area, self.tables.square.c.perimeter]
)
.select_from(self.tables.square)
.order_by(self.tables.square.c.id)
).fetchall()
eq_(res, [(100, 40), (1764, 168)])
class ExistsTest(fixtures.TablesTest):
__backend__ = True
@classmethod
def define_tables(cls, metadata):
Table(
"stuff",
metadata,
Column("id", Integer, primary_key=True),
Column("data", String(50)),
)
@classmethod
def insert_data(cls, connection):
connection.execute(
cls.tables.stuff.insert(),
[
{"id": 1, "data": "some data"},
{"id": 2, "data": "some data"},
{"id": 3, "data": "some data"},
{"id": 4, "data": "some other data"},
],
)
def test_select_exists(self, connection):
stuff = self.tables.stuff
eq_(
connection.execute(
select([literal(1)]).where(
exists().where(stuff.c.data == "some data")
)
).fetchall(),
[(1,)],
)
def <API key>(self, connection):
stuff = self.tables.stuff
eq_(
connection.execute(
select([literal(1)]).where(
exists().where(stuff.c.data == "no data")
)
).fetchall(),
[],
)
class <API key>(fixtures.TablesTest):
__backend__ = True
__requires__ = ("<API key>",)
@classmethod
def define_tables(cls, metadata):
Table(
"is_distinct_test",
metadata,
Column("id", Integer, primary_key=True),
Column("col_a", Integer, nullable=True),
Column("col_b", Integer, nullable=True),
)
@testing.combinations(
("both_int_different", 0, 1, 1),
("both_int_same", 1, 1, 0),
("one_null_first", None, 1, 1),
("one_null_second", 0, None, 1),
("both_null", None, None, 0),
id_="iaaa",
argnames="col_a_value, col_b_value, <API key>",
)
def <API key>(
self, col_a_value, col_b_value, <API key>, connection
):
tbl = self.tables.is_distinct_test
connection.execute(
tbl.insert(),
[{"id": 1, "col_a": col_a_value, "col_b": col_b_value}],
)
result = connection.execute(
tbl.select(tbl.c.col_a.is_distinct_from(tbl.c.col_b))
).fetchall()
eq_(
len(result),
<API key>,
)
<API key> = (
1 if <API key> == 0 else 0
)
result = connection.execute(
tbl.select(tbl.c.col_a.isnot_distinct_from(tbl.c.col_b))
).fetchall()
eq_(
len(result),
<API key>,
)
|
#ifndef <API key>
#define <API key>
#include <Ice/Value.h>
#include <Ice/OutputStream.h>
#include <Ice/InputStream.h>
#ifdef ICE_CPP11_MAPPING
namespace Ice
{
template<typename T>
class InterfaceByValue : public ValueHelper<InterfaceByValue<T>, Value>
{
public:
virtual std::string ice_id() const
{
return T::ice_staticId();
}
static const std::string& ice_staticId()
{
return T::ice_staticId();
}
std::tuple<> ice_tuple() const
{
return std::tie();
}
};
}
#endif
#endif
|
<?lsmb FILTER latex -?>
\documentclass{scrartcl}
\usepackage{xltxtra}
\setmainfont{Verdana}
\usepackage{tabularx}
\usepackage[letterpaper,top=2cm,bottom=1.5cm,left=1.1cm,right=1.5cm]{geometry}
\usepackage{graphicx}
\setlength{\parindent}{0pt}
\begin{document}
\pagestyle{myheadings}
\thispagestyle{empty}
<?lsmb INCLUDE letterhead.tex ?>
\centerline{\MakeUppercase{\textbf{<?lsmb text('AP Transaction') ?>}}}
\vspace*{0.5cm}
\parbox[t]{.5\textwidth}{
<?lsmb name ?>
<?lsmb address1 ?>
<?lsmb address2 ?>
<?lsmb city ?>
<?lsmb IF state ?>
\hspace{-0.1cm}, <?lsmb state ?>
<?lsmb END ?> <?lsmb zipcode ?>
<?lsmb country ?>
\vspace{0.3cm}
<?lsmb IF contact ?>
<?lsmb contact ?>
\vspace{0.2cm}
<?lsmb END ?>
<?lsmb IF vendorphone ?>
Tel: <?lsmb vendorphone ?>
<?lsmb END ?>
<?lsmb IF vendorfax ?>
Fax: <?lsmb vendorfax ?>
<?lsmb END ?>
<?lsmb email ?>
<?lsmb IF vendortaxnumber ?>
Tax Number: <?lsmb vendortaxnumber ?>
<?lsmb END ?>
}
\hfill
\begin{tabular}[t]{ll}
\textbf{<?lsmb text('Invoice #') ?>} & <?lsmb invnumber ?> \\
\textbf{<?lsmb text('Date') ?>} & <?lsmb invdate ?> \\
\textbf{<?lsmb text('Due') ?>} & <?lsmb duedate ?> \\
<?lsmb IF ponumber ?>
\textbf{<?lsmb text('PO #') ?>} & <?lsmb ponumber ?> \\
<?lsmb END ?>
<?lsmb IF ordnumber ?>
\textbf{<?lsmb text('Order #') ?>} & <?lsmb ordnumber ?> \\
<?lsmb END ?>
\textbf{<?lsmb text('Employee') ?>} & <?lsmb employee ?> \\
\end{tabular}
\vspace{1cm}
\begin{tabularx}{\textwidth}[t]{@{}llrX@{\hspace{1cm}}l@{}}
<?lsmb FOREACH amount ?>
<?lsmb lc = loop.count - 1 ?>
<?lsmb accno.${lc} ?> &
<?lsmb account.${lc} ?> &
<?lsmb amount.${lc} ?> &
<?lsmb description.${lc} ?> &
<?lsmb projectnumber.${lc} ?> \\
<?lsmb END ?>
\multicolumn{2}{r}{\textbf{Subtotal}} & <?lsmb subtotal ?> & \\
<?lsmb FOREACH tax ?>
<?lsmb lc = loop.count - 1 ?>
\multicolumn{2}{r}{\textbf{<?lsmb taxdescription.${lc} ?> @ <?lsmb taxrate.${lc} ?> \%}} & <?lsmb tax.${lc} ?> & \\
<?lsmb END ?>
\multicolumn{2}{r}{\textbf{Total}} & <?lsmb invtotal ?> & \\
\end{tabularx}
\vspace{0.3cm}
<?lsmb text_amount ?> ***** <?lsmb decimal ?>/100 <?lsmb currency ?>
<?lsmb IF notes ?>
\vspace{0.3cm}
<?lsmb FOREACH P IN notes.split('\n\n') ?>
<?lsmb P ?>\medskip
<?lsmb END ?>
<?lsmb END ?>
\vspace{0.3cm}
<?lsmb IF paid_1 ?>
\begin{tabular}{@{}llllr@{}}
\multicolumn{5}{c}{\textbf{<?lsmb text('Payments') ?>}} \\
\hline
\textbf{<?lsmb text('Date') ?>} & & \textbf{<?lsmb text('Source') ?>} & \textbf{<?lsmb text('Memo') ?>} & \textbf{<?lsmb text('Amount') ?>} \\
<?lsmb END ?>
<?lsmb FOREACH payment ?>
<?lsmb lc = loop.count - 1 ?>
<?lsmb paymentdate.${lc} ?> & <?lsmb paymentaccount.${lc} ?> & <?lsmb paymentsource.${lc} ?> & <?lsmb paymentmemo.${lc} ?> & <?lsmb payment.${lc} ?> \\
<?lsmb END ?>
<?lsmb IF paid_1 ?>
\end{tabular}
<?lsmb END ?>
\end{document}
<?lsmb END ?>
|
<?php
if (! defined('NV_IS_FILE_WEBTOOLS')) {
die('Stop!!!');
}
$contents = 'Error Access!!!';
$checksess = $nv_Request->get_title('checksess', 'get', '');
if ($checksess == md5($global_config['sitekey'] . session_id()) and file_exists(NV_ROOTDIR . '/install/update_data.php')) {
$contents = '';
$list_file_docs = nv_scandir(NV_ROOTDIR . '/install', '/^update_docs_([a-z]{2})\.html$/');
// Xoa cac file docs
foreach ($list_file_docs as $docsfile) {
$check_del = nv_deletefile(NV_ROOTDIR . '/install/' . $docsfile);
if ($check_del[0] == 0) {
$contents .= $check_del[1] . ' ' . $lang_module['<API key>'];
}
}
// Xoa file du lieu nang cap
$check_delete_file = nv_deletefile(NV_ROOTDIR . '/install/update_data.php');
if ($check_delete_file[0] == 0) {
$contents .= $check_delete_file[1] . ' ' . $lang_module['<API key>'];
}
// Xoa thu muc file thay doi
if (file_exists(NV_ROOTDIR . '/install/update')) {
$check_delete_dir = nv_deletefile(NV_ROOTDIR . '/install/update', true);
if ($check_delete_dir[0] == 0) {
$contents .= $check_delete_dir[1] . ' ' . $lang_module['<API key>'];
}
}
// Xoa file log
$list_file_logs = nv_scandir(NV_ROOTDIR . '/' . NV_DATADIR, '/^config_update_NVUD([A-Z0-9]+)\.php$/');
foreach ($list_file_logs as $logsfile) {
$check_del = nv_deletefile(NV_ROOTDIR . '/' . NV_DATADIR . '/' . $logsfile);
if ($check_del[0] == 0) {
$contents .= $check_del[1] . ' ' . $lang_module['<API key>'];
}
}
clearstatcache();
}
if ($contents == '') {
$contents = 'OK';
}
include NV_ROOTDIR . '/includes/header.php';
echo $contents;
include NV_ROOTDIR . '/includes/footer.php';
|
@import url(http://fonts.googleapis.com/css?family=Quicksand:400,700|Paytone+One|Montserrat+Alternates:400,700|Josefin+Sans:400,600,700,400italic|Wendy+One|Fredoka+One|Raleway:400,600,500,700|Righteous|Passion+One:700,400,900|Comfortaa:700,400|Open+Sans:700,400);
/* VARIABLES */
/* navy */
/* bright light blue #7ECEFD */
/* muted blue (darker) */
/* light muted blue */
/* orange #D57E01 #ED8C01 */
/* muted yellow */
/* light orange */
/* white - the background-color for the header, body, and footer */
/* grey - the main text on the site */
/* super light blue */
/* FONT */
html {
height: 100%;
font-size: 1.2em; }
html, body, button, input, select, textarea {
font-family: "Josefin Sans", san-seriff; }
body {
height: 100%;
background-color: #fff;
color: #7A7A7A; }
a {
text-decoration: none;
color: #71B9E4; }
div#wrapper, div#header-wrapper {
max-width: 1200px;
margin: 0 auto;
padding: 0 5%;
height: 100%; }
h2 {
color: #346098;
margin: .75em 0;
font-size: 2em; }
h3 {
color: #71B9E4;
margin: .5em 0;
font-size: 1.4em; }
h4 {
font-size: 1.2em;
margin: .75em 0; }
p {
margin: .35em 0; }
ul {
margin: .5em 0; }
img {
width: 100%; }
header {
float: left;
margin: 0 0 1.6em 0;
padding: 5px 0 0 0;
width: 100%;
background-color: #346098; }
#logo {
text-align: center;
margin: 0; }
h1 {
font-family: "Josefin Sans", san-seriff;
margin: 15px 0;
font-size: 2.2em;
font-weight: bold;
line-height: 0.8em; }
h1 .logo-1 {
color: #FFA347; }
h1 .logo-2 {
color: #F5C149; }
h1 .logo-3 {
color: #ACACAC;
font-size: .75em;
/* for the ".com" */ }
p#slogan {
color: #ACACAC;
font-style: italic;
position: relative;
top: -15px;
left: 5px;
margin: 0; }
nav {
text-align: center;
padding: 10px 0 0 0;
margin: 0;
/* end ul */
/* end li */
/* end a */ }
nav ul {
list-style: none;
margin: 0 10px;
padding: 0; }
nav li {
display: inline-block;
margin-bottom: 10px; }
nav li.current_page_item {
border-bottom: 3px solid #F5C149; }
nav a {
font-size: 1em;
font-weight: 600;
padding: 0 10px;
font-family: "Josefin Sans", san-seriff;
text-transform: uppercase; }
nav a:hover {
border-bottom: 3px solid #F5C149; }
/* end nav */
footer {
font-size: 0.75em;
text-align: center;
clear: both;
padding-top: 50px;
color: #7A7A7A;
margin-bottom: 30px; }
footer hr {
position: relative;
top: 25px; }
footer p {
line-height: 50px;
/* this should match the max-height of the image */
border-top: solid #7A7A7A 1.9px; }
footer img {
max-height: 50px;
position: relative;
top: 30px;
padding: 5px;
width: auto; }
#home-2 h3, #home-3 h3 {
margin-top: 0; }
h2.cta {
margin: 0 0 .75em 0; }
section#home-1 {
clear: left;
position: relative;
top: -1.6em; }
/*
section#home-2 {
margin-top: 56px;;
}*/
img#home-img {
width: 100%;
height: 250px;
display: none;
/* this default will be overridden when the screen get's wider than 480px */ }
section#home-4:after {
content: "";
visibility: hidden;
display: block;
height: 0;
clear: both; }
section#home-4 {
margin-bottom: 1em; }
section#home-4 div {
margin: 12px; }
section#home-4 div span {
margin-left: 5em; }
.btn, .button-orange {
-moz-box-shadow: inset 0px 1px 0px 0px #fce2c1;
-webkit-box-shadow: inset 0px 1px 0px 0px #fce2c1;
box-shadow: inset 0px 1px 0px 0px #fce2c1;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ffc477), color-stop(1, #FFA347));
background: -moz-linear-gradient(center top, #ffc477 5%, #ffa347 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc477', endColorstr='#ffa347');
background-color: #ffc477;
-<API key>: 13px;
-<API key>: 13px;
<API key>: 13px;
-<API key>: 13px;
-<API key>: 13px;
<API key>: 13px;
-<API key>: 13px;
-<API key>: 13px;
<API key>: 13px;
-<API key>: 13px;
-<API key>: 13px;
<API key>: 13px;
text-indent: 0px;
border: 1px solid #eeb44f;
display: inline-block;
color: #ffffff;
/*font-family:Trebuchet MS;*/
font-size: 20px;
font-weight: bold;
font-style: normal;
height: 39px;
line-height: 39px;
width: 250px;
text-decoration: none;
text-align: center;
text-shadow: 1px 1px 0px #cc9f52; }
.button-orange:hover {
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #FFA347), color-stop(1, #ffc477));
background: -moz-linear-gradient(center top, #FFA347 5%, #ffc477 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffa347', endColorstr='#ffc477');
background-color: #FFA347; }
.button-1:active {
position: relative;
top: 1px; }
/* This button was generated using CSSButtonGenerator.com */
.button-yellow {
-moz-box-shadow: inset 0px 1px 0px 0px #fae7c0;
-webkit-box-shadow: inset 0px 1px 0px 0px #fae7c0;
box-shadow: inset 0px 1px 0px 0px #fae7c0;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f8d480), color-stop(1, #F5C149));
background: -moz-linear-gradient(center top, #f8d480 5%, #F5C149 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8d480', endColorstr='#f5c149');
background-color: #f8d480;
/*-<API key>:13px;
-<API key>:13px;
<API key>:13px;
-<API key>:13px;
-<API key>:13px;
<API key>:13px;
-<API key>:13px;
-<API key>:13px;
<API key>:13px;
-<API key>:13px;
-<API key>:13px;
<API key>:13px;
text-indent:0px;*/
border: 1px solid #edc651;
/*display:inline-block;
color:#ffffff;
font-family:Trebuchet MS;
font-size:15px;
font-weight:bold;
font-style:normal;
height:39px;
line-height:39px;
width:200px;
text-decoration:none;
text-align:center;*/
text-shadow: 1px 1px 0px #cc9f52; }
.button-yellow:hover {
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #F5C149), color-stop(1, #f8d480));
background: -moz-linear-gradient(center top, #F5C149 5%, #f8d480 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5c149', endColorstr='#f8d480');
background-color: #F5C149; }
.button-yellow:active {
/*position:relative;
top:1px;*/ }
h4.cta {
clear: both; }
html, body {
overflow-x: hidden; }
/* keep the help boxes from being huge */
img.<API key> {
/* "width: auto is the fallback for IE not supporting width: initial" */
width: auto;
width: initial; }
/* for smaller widths - the meeting time drop down shoudln't be wider than the viewport */
select#ninja_forms_field_8 {
max-width: 100%; }
.<API key> {
display: none; }
#contact-2 h3 {
margin: 0 0 .5em 0; }
div#gmap {
width: 100% !important;
/*260px*/ }
/* Styles for the income thresholds table */
.CSSTableGenerator {
margin: 0px;
padding: 0px;
width: 100%;
border: 1px solid #000000;
-<API key>: 0px;
-<API key>: 0px;
<API key>: 0px;
-<API key>: 0px;
-<API key>: 0px;
<API key>: 0px;
-<API key>: 0px;
-<API key>: 0px;
<API key>: 0px;
-<API key>: 0px;
-<API key>: 0px;
<API key>: 0px; }
.CSSTableGenerator table {
border-collapse: collapse;
border-spacing: 0;
width: 100%;
height: 100%;
margin: 0px;
padding: 0px; }
.CSSTableGenerator tr:last-child td:last-child {
-<API key>: 0px;
-<API key>: 0px;
<API key>: 0px; }
.CSSTableGenerator table tr:first-child td:first-child {
-<API key>: 0px;
-<API key>: 0px;
<API key>: 0px; }
.CSSTableGenerator table tr:first-child td:last-child {
-<API key>: 0px;
-<API key>: 0px;
<API key>: 0px; }
.CSSTableGenerator tr:last-child td:first-child {
-<API key>: 0px;
-<API key>: 0px;
<API key>: 0px; }
.CSSTableGenerator tr:hover td {
background-color: #ffffff; }
.CSSTableGenerator td {
vertical-align: middle;
background-color: #fcfcfc;
border: 1px solid #000000;
border-width: 0px 1px 1px 0px;
text-align: center;
padding: 7px;
/*font-size:10px;
font-family:Arial;
font-weight:bold;
color:#000000;*/ }
.CSSTableGenerator tr:last-child td {
border-width: 0px 1px 0px 0px; }
.CSSTableGenerator tr td:last-child {
border-width: 0px 0px 1px 0px; }
.CSSTableGenerator tr:last-child td:last-child {
border-width: 0px 0px 0px 0px; }
.CSSTableGenerator tr:first-child td {
background: -o-linear-gradient(bottom, #ffa347 5%, #ffa347 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ffa347), color-stop(1, #ffa347));
background: -moz-linear-gradient(center top, #ffa347 5%, #ffa347 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#ffa347", endColorstr="#ffa347");
background: -o-linear-gradient(top, #ffa347, ffa347);
background-color: #ffa347;
border: 0px solid #000000;
text-align: center;
border-width: 0px 0px 1px 1px;
/*font-size:14px;
font-family:Arial;
font-weight:bold;
color:#ffffff;*/ }
.CSSTableGenerator tr:first-child:hover td {
background: -o-linear-gradient(bottom, #ffa347 5%, #ffa347 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ffa347), color-stop(1, #ffa347));
background: -moz-linear-gradient(center top, #ffa347 5%, #ffa347 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#ffa347", endColorstr="#ffa347");
background: -o-linear-gradient(top, #ffa347, ffa347);
background-color: #ffa347; }
.CSSTableGenerator tr:first-child td:first-child {
border-width: 0px 0px 1px 0px; }
.CSSTableGenerator tr:first-child td:last-child {
border-width: 0px 0px 1px 1px; }
.CSSTableGenerator {
max-width: 800px; }
table#income_chart {
font-size: .88em; }
/*# sourceMappingURL=style.css.map */
|
<?php
require_once dirname(__FILE__) . '/securimage.php';
$img = new Securimage();
//Change some settings
$img->image_width = 280;
$img->image_height = 100;
$img->perturbation = 0.9; // high level of distortion
$img->code_length = rand(5,6); // random code length
$img->image_bg_color = new Securimage_Color("#ffffff");
$img->num_lines = 12;
$img->noise_level = 5;
$img->text_color = new Securimage_Color("#000000");
$img->noise_color = $img->text_color;
$img->line_color = new Securimage_Color("#cccccc");
$img->show();
|
#ifndef <API key>
#define <API key>
#include "dialogex.h"
#include <wx/timer.h>
class CMainFrame;
class <API key> final : public wxDialogEx
{
public:
static <API key>* Create(CMainFrame* pMainFrame) { return new <API key>(pMainFrame); }
void Run();
void Delete();
protected:
<API key>(CMainFrame* pMainFrame);
virtual ~<API key>() = default;
bool ClearReconnect();
void RemoveXmlFile(const wxString& name);
CMainFrame* const m_pMainFrame;
wxTimer m_timer;
DECLARE_EVENT_TABLE()
void OnTimer(wxTimerEvent& event);
};
#endif
|
# encoding: utf-8
# This file is part of Cerebrum.
# Cerebrum is free software; you can redistribute it and/or modify it
# (at your option) any later version.
# Cerebrum is distributed in the hope that it will be useful, but
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# along with Cerebrum; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
""" An abstract event that can be stored in the database. """
from __future__ import absolute_import
import datetime
import itertools
import mx.DateTime
import pytz
import cereconf
class _VerbSingleton(type):
""" A metaclass that makes each EventType verb a singleton. """
verbs = {}
def __call__(cls, verb, *args):
if verb not in cls.verbs:
cls.verbs[verb] = super(_VerbSingleton, cls).__call__(verb, *args)
return cls.verbs[verb]
def get_verb(cls, verb):
return cls.verbs.get(verb)
class EventType(_VerbSingleton('EventTypeSingleton', (object,), {})):
"""Holds an event type."""
__slots__ = ['verb', 'description', ]
def __init__(self, verb, description):
""" Initialize EventType.
:verb: Scim verb
:description: HR description text
"""
self.verb = verb
self.description = description
def __repr__(self):
return '<{0.__class__.__name__!s} {0.verb}>'.format(self)
def __eq__(self, other):
"""Equality."""
return isinstance(other, EventType) and other.verb == self.verb
def __hash__(self):
"""Hash."""
return hash(self.verb)
# Define event types:
ADD = EventType('add', 'Add an object to subject')
CREATE = EventType('create', 'Create a new subject')
ACTIVATE = EventType('activate', 'Subject has no longer quarantines in system')
MODIFY = EventType('modify', 'Attributes has changed')
DEACTIVATE = EventType('deactivate', 'Quarantine is activated')
DELETE = EventType('delete', 'Subject is deleted')
REMOVE = EventType('remove', 'Remove an object from subject')
PASSWORD = EventType('password', 'Subject has changed password')
JOIN = EventType('join', 'Join two objects')
class EntityRef(object):
""" Representation of a single entity.
The entity_id can be used internally to identify which object we reference
The entity_type and ident is used to generate a reference to the object
that other systems can use.
"""
__slots__ = ['ident', 'entity_type', 'entity_id', ]
def __init__(self, entity_id, entity_type, ident):
self.entity_id = int(entity_id)
self.entity_type = entity_type
self.ident = ident
def __repr__(self):
return ("<{0.__class__.__name__}"
" id={0.entity_id!r}"
" type={0.entity_type!r}"
" ident={0.ident!r}>").format(self)
def __eq__(self, other):
return (isinstance(other, EntityRef) and
self.entity_id == other.entity_id)
def to_dict(self):
return {
'ident': self.ident,
'entity_id': self.entity_id,
'entity_type': self.entity_type, }
class DateTimeDescriptor(object):
""" Datetime descriptor that handles timezones.
When setting the datetime, this method will try to localize it with the
default_timezone in the following ways:
- mx.DateTime.DateTimeType: Naive datetime, assume in default_timezone
- datetime.datetime: Assume in default_timezone if naive
- integer: Assume timestamp in UTC
The returned object will always be a localized datetime.datetime
"""
default_timezone = pytz.timezone(cereconf.TIMEZONE)
def __init__(self, slot):
""" Creates a new datetime descriptor.
:param str slot:
The attribute name where the actual value is stored.
"""
self.slot = slot
def __repr__(self):
return '{0.__class__.__name__}({0.slot!r})'.format(self)
def __get__(self, obj, cls=None):
if not obj:
return self
return getattr(obj, self.slot, None)
def __set__(self, obj, value):
if value is None:
self.__delete__(obj)
return
if isinstance(value, (int, long, )):
# UTC timestamp
value = pytz.utc.localize(
datetime.datetime.fromtimestamp(value))
elif isinstance(value, mx.DateTime.DateTimeType):
# Naive datetime in default_timezone
value = self.default_timezone.localize(value.pydatetime())
elif isinstance(value, datetime.datetime):
if value.tzinfo is None:
value = self.default_timezone.localize(value)
else:
raise TypeError('Invalid datetime {0} ({1})'.format(type(value),
repr(value)))
setattr(obj, self.slot, value)
def __delete__(self, obj):
if hasattr(obj, self.slot):
delattr(obj, self.slot)
class Event(object):
""" Event abstraction.
Contains all the neccessary data to serialize an event.
"""
DEFAULT_TIMEZONE = 'Europe/Oslo'
__slots__ = ['event_type', 'subject', 'objects', 'context', 'attributes',
'_timestamp', '_scheduled', ]
timestamp = DateTimeDescriptor('_timestamp')
scheduled = DateTimeDescriptor('_scheduled')
def __init__(self, event_type,
subject=None,
objects=None,
context=None,
attributes=None,
timestamp=None,
scheduled=None):
"""
:param EventType event: the type of event
:param EntityRef subject: reference to the affected entity
:param list objects: sequence of other affected objects (EntityRef)
:param list context: sequence of affected systems (str)
:param list attributes: sequence of affected attributes (str)
:param datetime timestamp: when the event originated
:param datetime schedule: when the event should be issued
"""
self.event_type = event_type
self.subject = subject
self.timestamp = timestamp
self.scheduled = scheduled
self.objects = set(objects or [])
self.context = set(context or [])
self.attributes = set(attributes or [])
def __repr__(self):
return ('<{0.__class__.__name__}'
' event={0.event_type!r}'
' subject={0.subject!r}>').format(self)
def mergeable(self, other):
"""Can this event be merged with other."""
if self.scheduled is not None:
return False
if self.subject != other.subject:
return False
if self.event_type == CREATE:
return other.event_type not in (DEACTIVATE, REMOVE)
if self.event_type == DELETE:
return other.event_type in (REMOVE, DEACTIVATE, ADD, ACTIVATE,
MODIFY, PASSWORD)
if (self.event_type == other.event_type and
self.event_type in (ADD, REMOVE, ACTIVATE, DEACTIVATE)):
return True
if self.context != other.context:
return False
return True
def merge(self, other):
"""Merge messages."""
def ret_self():
self.objects.update(other.objects)
return [self]
if not self.mergeable(other):
return [self, other]
if self.event_type == CREATE:
if other.event_type == DELETE:
return []
if other.event_type == ADD:
self.context.update(other.context)
return ret_self()
if other.event_type == ACTIVATE:
return ret_self() # TODO: if quarantine is an attr, delete it
if other.event_type == MODIFY:
self.attributes.update(other.attributes)
return ret_self()
if other.event_type == PASSWORD:
self.attributes.add('password')
return ret_self()
elif self.event_type == DELETE:
return ret_self()
elif other.event_type == DELETE:
return [other]
elif (ACTIVATE == self.event_type and
DEACTIVATE == other.event_type and
self.context == other.context):
return []
elif (ADD == self.event_type and
REMOVE == other.event_type and
self.context == other.context):
return []
elif self.event_type == other.event_type:
if self.event_type in (ADD, REMOVE, ACTIVATE, DEACTIVATE):
self.context.update(other.context)
return ret_self()
if self.context != other.context:
return [self, other]
self.attributes.update(other.attributes)
return ret_self()
return [self, other]
def merge_events(events):
"""Merge events with similarities.
As long as subject is the same:
* create + add/activate/modify/password = create with attributes merged
* create + deactivate/remove is untouched
* create + delete should be removed
* delete + remove/deactivate/add/activate/modify/password = delete
* x + x = x
* activate + deactivate = noop (careful with aud)
Sort into canonical order:
#. create
#. delete
#. add
#. activate
#. modify
#. password
#. deactivate
#. remove
"""
order = (CREATE, DELETE, ADD, ACTIVATE, MODIFY, PASSWORD, DEACTIVATE,
REMOVE, JOIN)
ps = [[] for x in order]
for pl in events:
pltype = pl.event_type
idx = order.index(pltype)
ps[idx].append(pl)
result = {}
for idx, tp, pl in zip(range(len(order)), order, ps):
for p in pl:
if p.subject not in result:
result[p.subject] = [p]
else:
result[p.subject].append(p)
def merge_list(finished, merged, current, rest):
while rest or merged:
if rest:
new = current.merge(rest[0])
if not new:
rest.pop(0)
merged.extend(rest)
rest = merged
if not rest:
return finished
merged = []
current = rest.pop(0)
elif len(new) == 1:
if new[0] is not current:
merged.extend(rest)
rest = merged
current = rest.pop(0)
merged = []
else:
rest.pop(0)
else:
merged.append(rest.pop(0))
else: # merged is not empty
finished.append(current)
rest = merged
merged = []
current = rest.pop(0)
finished.append(current)
return finished
for sub, lst in result.items():
result[sub] = merge_list([], [], lst[0], lst[1:])
return list(itertools.chain(*result.values()))
|
# -*- coding: utf-8 -*-
from utils import *
commands = [
'^remindme',
'^reminder',
'^remind$',
'^r '
]
parameters = (
('delay', True),
('message', True),
)
description = 'Set a reminder for yourself. First argument is delay until you wish to be reminded.\nExample: `' + config['command_start'] + 'remindme 2h GiT GuD`'
action = 'typing'
hidden = True
reminders = load_json('data/reminders.json')
def to_seconds(time, unit):
if unit == 's':
return float(time)
elif unit == 'm':
return float(time) * 60
elif unit == 'h':
return float(time) * 60 * 60
elif unit == 'd':
return float(time) * 60 * 60 * 24
def run(msg):
input = get_input(msg['text'])
if not input:
doc = get_doc(commands, parameters, description)
return send_message(msg['chat']['id'], doc,
parse_mode="Markdown")
delay = first_word(input)
if delay:
time = delay[:-1]
unit = delay[-1:]
if not is_int(time) or is_int(unit):
message = 'The delay must be in this format: `(integer)(s|m|h|d)`.\nExample: `2h` for 2 hours.'
return send_message(msg['chat']['id'], message, parse_mode="Markdown")
try:
alarm = now() + to_seconds(time, unit)
except:
return send_message(msg['chat']['id'], message, parse_mode="Markdown")
text = all_but_first_word(input)
if not text:
send_message(msg['chat']['id'], 'Please include a reminder.')
if 'username' in msg['from']:
text += '\n@' + msg['from']['username']
reminder = OrderedDict()
reminder['alarm'] = alarm
reminder['chat_id'] = msg['chat']['id']
reminder['text'] = text
reminders[int(now())] = reminder
save_json('data/reminders.json', reminders)
if unit == 's':
delay = delay.replace('s', ' seconds')
if unit == 'm':
delay = delay.replace('m', ' minutes')
if unit == 'h':
delay = delay.replace('h', ' hours')
if unit == 'd':
delay = delay.replace('d', ' days')
message = 'Your reminder has been set for *' + delay + '* from now:\n\n' + text
send_message(msg['chat']['id'], message, parse_mode="Markdown")
def cron():
reminders = load_json('data/reminders.json', True)
for id, reminder in reminders.items():
if now() > reminder['alarm']:
send_message(reminder['chat_id'], reminder['text'])
del reminders[id]
save_json('data/reminders.json', reminders)
|
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2_05) on Fri Aug 13 10:55:24 CDT 2004 -->
<TITLE>
Uses of Class javazoom.jl.decoder.OutputChannels
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="Uses of Class javazoom.jl.decoder.OutputChannels";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<A NAME="navbar_top"></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../javazoom/jl/decoder/OutputChannels.html" title="class in javazoom.jl.decoder"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="OutputChannels.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>javazoom.jl.decoder.OutputChannels</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
Packages that use <A HREF="../../../../javazoom/jl/decoder/OutputChannels.html" title="class in javazoom.jl.decoder">OutputChannels</A></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#javazoom.jl.decoder"><B>javazoom.jl.decoder</B></A></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<A NAME="javazoom.jl.decoder"></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
Uses of <A HREF="../../../../javazoom/jl/decoder/OutputChannels.html" title="class in javazoom.jl.decoder">OutputChannels</A> in <A HREF="../../../../javazoom/jl/decoder/package-summary.html">javazoom.jl.decoder</A></FONT></TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="<API key>">
<TD COLSPAN=2>Fields in <A HREF="../../../../javazoom/jl/decoder/package-summary.html">javazoom.jl.decoder</A> declared as <A HREF="../../../../javazoom/jl/decoder/OutputChannels.html" title="class in javazoom.jl.decoder">OutputChannels</A></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../javazoom/jl/decoder/OutputChannels.html" title="class in javazoom.jl.decoder">OutputChannels</A></CODE></FONT></TD>
<TD><CODE><B>OutputChannels.</B><B><A HREF="../../../../javazoom/jl/decoder/OutputChannels.html#LEFT">LEFT</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../javazoom/jl/decoder/OutputChannels.html" title="class in javazoom.jl.decoder">OutputChannels</A></CODE></FONT></TD>
<TD><CODE><B>OutputChannels.</B><B><A HREF="../../../../javazoom/jl/decoder/OutputChannels.html#RIGHT">RIGHT</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../javazoom/jl/decoder/OutputChannels.html" title="class in javazoom.jl.decoder">OutputChannels</A></CODE></FONT></TD>
<TD><CODE><B>OutputChannels.</B><B><A HREF="../../../../javazoom/jl/decoder/OutputChannels.html#BOTH">BOTH</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../javazoom/jl/decoder/OutputChannels.html" title="class in javazoom.jl.decoder">OutputChannels</A></CODE></FONT></TD>
<TD><CODE><B>OutputChannels.</B><B><A HREF="../../../../javazoom/jl/decoder/OutputChannels.html#DOWNMIX">DOWNMIX</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="<API key>">
<TD COLSPAN=2>Methods in <A HREF="../../../../javazoom/jl/decoder/package-summary.html">javazoom.jl.decoder</A> that return <A HREF="../../../../javazoom/jl/decoder/OutputChannels.html" title="class in javazoom.jl.decoder">OutputChannels</A></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../javazoom/jl/decoder/OutputChannels.html" title="class in javazoom.jl.decoder">OutputChannels</A></CODE></FONT></TD>
<TD><CODE><B>OutputChannels.</B><B><A HREF="../../../../javazoom/jl/decoder/OutputChannels.html#fromInt(int)">fromInt</A></B>(int code)</CODE>
<BR>
Creates an <code>OutputChannels</code> instance
corresponding to the given channel code.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../javazoom/jl/decoder/OutputChannels.html" title="class in javazoom.jl.decoder">OutputChannels</A></CODE></FONT></TD>
<TD><CODE><B>Decoder.Params.</B><B><A HREF="../../../../javazoom/jl/decoder/Decoder.Params.html#getOutputChannels()">getOutputChannels</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="<API key>">
<TD COLSPAN=2>Methods in <A HREF="../../../../javazoom/jl/decoder/package-summary.html">javazoom.jl.decoder</A> with parameters of type <A HREF="../../../../javazoom/jl/decoder/OutputChannels.html" title="class in javazoom.jl.decoder">OutputChannels</A></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>Decoder.Params.</B><B><A HREF="../../../../javazoom/jl/decoder/Decoder.Params.html#setOutputChannels(javazoom.jl.decoder.OutputChannels)">setOutputChannels</A></B>(<A HREF="../../../../javazoom/jl/decoder/OutputChannels.html" title="class in javazoom.jl.decoder">OutputChannels</A> out)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<HR>
<A NAME="navbar_bottom"></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="<API key>"></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../javazoom/jl/decoder/OutputChannels.html" title="class in javazoom.jl.decoder"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="OutputChannels.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<HR>
</BODY>
</HTML>
|
/*global require*/
/*jshint white: false, newcap: true, regexp: true, browser: true,
forin: false, nomen: true, bitwise: false, maxerr: 100,
indent: 4, plusplus: false, curly: true, eqeqeq: true,
freeze: true, latedef: true, noarg: true, nonew: true, quotmark: double, undef: true,
unused: true, strict: true, asi: false, boss: false, evil: false, expr: false,
funcscope: false*/
var fluid = fluid || require("infusion"),
flock = fluid.registerNamespace("flock");
(function () {
"use strict";
// TODO: Unit tests.
flock.ugen.print = function (input, output, options) {
var that = flock.ugen(input, output, options);
that.gen = function (numSamps) {
var inputs = that.inputs,
out = that.output,
m = that.model,
label = m.label,
chan = inputs.channel,
// Basic multichannel support. This should be inproved
// by factoring the multichannel input code out of flock.ugen.out.
source = chan ? inputs.source.output[chan.output[0]] : inputs.source.output,
trig = inputs.trigger.output[0],
freq = inputs.freq.output[0],
i,
j,
val;
if (trig > 0.0 && m.prevTrig <= 0.0) {
fluid.log(fluid.logLevel.IMPORTANT, label + source);
}
if (m.freq !== freq) {
m.sampInterval = Math.round(m.sampleRate / freq);
m.freq = freq;
m.counter = m.sampInterval;
}
for (i = 0, j = 0 ; i < numSamps; i++, j += m.strides.source) {
if (m.counter >= m.sampInterval) {
fluid.log(fluid.logLevel.IMPORTANT, label + source[j]);
m.counter = 0;
}
m.counter++;
out[i] = val = source[i];
}
m.value = m.unscaledValue = val;
};
that.init = function () {
var o = that.options;
that.model.label = o.label ? o.label + ": " : "";
that.onInputChanged();
};
that.init();
return that;
};
flock.ugenDefaults("flock.ugen.print", {
rate: "audio",
inputs: {
source: null,
trigger: 0.0,
freq: 1.0
},
ugenOptions: {
model: {
unscaledValue: 0.0,
value: 0.0,
counter: 0
},
strideInputs: ["source"]
}
});
}());
|
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
local insert = table.insert
local require = require
local pcall = pcall
local loadstring = loadstring
local print = print
local tests = {}
local aborted = {}
local function addTest (test)
test.n = #tests+1
insert(tests,test)
end
local function runTests(listOfTests,output)
local output = output or io.stdout
local status,err,fails
for i,test in ipairs(listOfTests) do
output:write(i..'/ TOPIC : '..test.topic..'\n')
output:write('COMMENTS : '..test.comments..'\n')
output:write('Sample Code :\n'..test.sample..'\n')
output:write('Output\n')
status,err = pcall(loadstring(test.sample))
if not status then
output:write('Error occured\n')
insert(aborted,{test = test, error = err})
end
output:write('\nEnd of Test '..i..'\n\n')
end
fails = #aborted
if fails > 0 then
output:write(fails..' test'..(fails>1 and 's' or '')..' aborted..\n')
for i in ipairs(aborted) do
output:write('Test '..aborted[i].test.n..' : '..aborted[i].error..'\n')
end
else
output:write('All tests runned successfully\n')
output:close()
end
end
addTest(
{
topic = 'Class Creation',
comments = 'We will cover various ways to create classes using LCS',
sample = [[
local LCS = require "LCS"
local myClass = LCS.class()
local myClass2 = LCS.class {var1 = 0, var2 = nil}
print(myClass2.var1)
print(myClass2.var2)
print(myClass2.var3)
print(LCS.is_A(myClass,'class'))
print(LCS.is_A(myClass))
]],
}
)
addTest(
{
topic = 'Instantiation (1/2)',
comments = 'We will cover differents ways to instantiate objects from a class',
sample = [[
local LCS = require 'LCS'
local Animal = LCS.class {name = 'Animal'}
function Animal:yell()
print('I am a '..self.name)
end
local kitty = Animal()
print(kitty.name)
kitty.name = 'kitty'
kitty:yell()
local doggy = Animal:new()
print(doggy.name)
doggy.name = 'doggy'
doggy:yell()
]],
}
)
addTest(
{
topic = 'Instantiation (2/2)',
comments = 'We will cover how to instantiante objects and init them with parameters',
sample = [[
local LCS = require 'LCS'
local Animal = LCS.class {name = 'Animal', weight = nil}
function Animal:init(name,weight)
self.name = name
self.weight = weight
end
function Animal:yell()
print('I am a ',self.name,', I weight ',self.weight)
end
local kitty = Animal('kitty',10)
local doggy = Animal:new('doggy',20)
kitty:yell()
doggy:yell()
]],
}
)
addTest(
{
topic = 'Inheritance ',
comments = 'We will learn how to use inheritance feature in LCS',
sample = [[
local LCS = require 'LCS'
local Animal = LCS.class {name = 'Animal'}
function Animal:init(name)
self.name = name
end
function Animal:yell()
print('I am a ',self.name)
end
local Cat = Animal:extends()
local Dog = Animal:extends()
function Cat:speak()
print('Meeoow')
end
function Dog:speak()
print('Ouah Ouah!')
end
local kitty = Cat('kitty')
local doggy = Dog('Doggy')
kitty:yell()
doggy:yell()
kitty:speak()
doggy:speak()
]],
}
)
addTest(
{
topic = 'Super Call ',
comments = 'We will learn how to call methods defined within a superclass from a derived class',
sample = [[
local LCS = require 'LCS'
local Animal = LCS.class {name = 'Animal'}
function Animal:init(name)
self.name = name
end
function Animal:yell()
print('I am a ',self.name)
end
local Cat = Animal:extends()
function Cat:yell()
print('Meeoow')
end
local kitty = Cat('kitty')
kitty:yell()
kitty:super('yell')
]],
}
)
addTest(
{
topic = 'Final and static classes ',
comments = 'We will learn how to create final and static classes.\nThis test will have no output.',
sample = [[
local LCS = require 'LCS'
local FinalAnimal = LCS.class.final {name = 'Animal'}
local StaticAnimal = LCS.class.static {name = 'Animal'}
-- This will throw an error
-- local FinalDog = FinalAnimal:extends()
-- This will throw an error
-- staticKitty = StaticAnimal()
]],
}
)
addTest(
{
topic = 'Full Api review ',
comments = 'We will learn the use of the whole api functions',
sample = [[
local LCS = require 'LCS'
local Animal = LCS.class {name = 'Animal'}
function Animal:init(name)
self.name = name
end
local Cat = Animal:extends()
function Cat:yell()
print('Meeoow')
end
local thing = Animal('thing')
local kitty = Cat('kitty')
print(kitty:getClass() == Cat)
print(Cat:getClass() == Animal)
print(thing:getClass() == Animal)
print(Animal:getClass() == nil)
print(kitty:is_A(Cat))
print(thing:is_A(Animal))
print(LCS.is_A(kitty,'object'))
print(LCS.is_A(thing))
print(LCS.is_A(Cat,'class'))
print(LCS.is_A(Animal))
print((Animal:getSubClasses())[Cat])
]],
}
)
runTests(tests)
|
#include "TextPasteCommand.h"
#include <KoTextEditor.h>
#include <KoTextDocument.h>
#include <KoTextPaste.h>
#include <KoChangeTracker.h>
#include <KoShapeController.h>
#include <klocale.h>
#include <kdebug.h>
#include <kaction.h>
#include <QTextDocument>
#include <QApplication>
#include <QMimeData>
#include "<API key>.h"
#include "DeleteCommand.h"
#include "KoDocumentRdfBase.h"
#ifdef SHOULD_BUILD_RDF
#include <Soprano/Soprano>
#else
namespace Soprano
{
class Model
{
};
}
#endif
TextPasteCommand::TextPasteCommand(const QMimeData *mimeData,
QTextDocument *document,
KoShapeController *shapeController,
KoCanvasBase *canvas, KUndo2Command *parent, bool pasteAsText)
: KUndo2Command (parent),
m_mimeData(mimeData),
m_document(document),
m_rdf(0),
m_shapeController(shapeController),
m_canvas(canvas),
m_pasteAsText(pasteAsText),
m_first(true)
{
m_rdf = qobject_cast<KoDocumentRdfBase*>(shapeController->resourceManager()->resource(KoText::DocumentRdf).value<QObject*>());
if (m_pasteAsText)
setText(i18nc("(qtundo-format)", "Paste As Text"));
else
setText(i18nc("(qtundo-format)", "Paste"));
}
void TextPasteCommand::undo()
{
KUndo2Command::undo();
}
void TextPasteCommand::redo()
{
if (m_document.isNull()) return;
KoTextDocument textDocument(m_document);
KoTextEditor *editor = textDocument.textEditor();
if (!m_first) {
KUndo2Command::redo();
} else {
editor->beginEditBlock(); //this is needed so Qt does not merge successive paste actions together
m_first = false;
if (editor->hasSelection()) { //TODO
editor->addCommand(new DeleteCommand(DeleteCommand::NextChar, m_document.data(), m_shapeController, this));
}
// check for mime type
if (m_mimeData->hasFormat(KoOdf::mimeType(KoOdf::Text))
|| m_mimeData->hasFormat(KoOdf::mimeType(KoOdf::OpenOfficeClipboard)) ) {
KoOdf::DocumentType odfType = KoOdf::Text;
if (!m_mimeData->hasFormat(KoOdf::mimeType(odfType))) {
odfType = KoOdf::OpenOfficeClipboard;
}
if (m_pasteAsText) {
editor->insertText(m_mimeData->text());
} else {
QSharedPointer<Soprano::Model> rdfModel;
#ifdef SHOULD_BUILD_RDF
if(!m_rdf) {
rdfModel = QSharedPointer<Soprano::Model>(Soprano::createModel());
} else {
rdfModel = m_rdf->model();
}
#endif
KoTextPaste paste(editor, m_shapeController, rdfModel, m_canvas, this);
paste.paste(odfType, m_mimeData);
#ifdef SHOULD_BUILD_RDF
if (m_rdf) {
m_rdf-><API key>(editor->document());
}
#endif
}
} else if (!m_pasteAsText && m_mimeData->hasHtml()) {
editor->insertHtml(m_mimeData->html());
} else if (m_pasteAsText || m_mimeData->hasText()) {
editor->insertText(m_mimeData->text());
}
editor->endEditBlock(); //see above beginEditBlock
}
}
|
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.4
# Default target executed when no arguments are given to make.
default_target: all
# Special targets provided by cmake.
# Disable implicit rules so canoncical targets will work.
.SUFFIXES:
.SUFFIXES: .<API key>
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /opt/local/bin/cmake
# The command to remove a file.
RM = /opt/local/bin/cmake -E remove -f
# The program to use to edit the cache.
CMAKE_EDIT_COMMAND = /opt/local/bin/ccmake
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/paul/Estelle-ruby/ext/taglib
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/paul/Estelle-ruby/ext/taglib
# Include the progress variables for this target.
include CMakeFiles/progress.make
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
cd /Users/paul/Estelle-ruby/ext/taglib/taglib/ape && /opt/local/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
# Special rule for the target install
install: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
cd /Users/paul/Estelle-ruby/ext/taglib/taglib/ape && /opt/local/bin/cmake -P cmake_install.cmake
# Special rule for the target install
install/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
cd /Users/paul/Estelle-ruby/ext/taglib/taglib/ape && /opt/local/bin/cmake -P cmake_install.cmake
# Special rule for the target install/local
install/local: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
cd /Users/paul/Estelle-ruby/ext/taglib/taglib/ape && /opt/local/bin/cmake -<API key>=1 -P cmake_install.cmake
# Special rule for the target install/local
install/local/fast: install/local
# Special rule for the target <API key>
<API key>:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Only default component available"
# Special rule for the target <API key>
<API key>/fast: <API key>
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
cd /Users/paul/Estelle-ruby/ext/taglib/taglib/ape && /opt/local/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
# The main all target
all: <API key>
cd /Users/paul/Estelle-ruby/ext/taglib && $(CMAKE_COMMAND) -E <API key> /Users/paul/Estelle-ruby/ext/taglib/CMakeFiles $(CMAKE_ALL_PROGRESS)
cd /Users/paul/Estelle-ruby/ext/taglib && $(MAKE) -f CMakeFiles/Makefile2 taglib/ape/all
$(CMAKE_COMMAND) -E <API key> /Users/paul/Estelle-ruby/ext/taglib/CMakeFiles 0
# The main clean target
clean:
cd /Users/paul/Estelle-ruby/ext/taglib && $(MAKE) -f CMakeFiles/Makefile2 taglib/ape/clean
# The main clean target
clean/fast: clean
# Prepare targets for installation.
preinstall: all
cd /Users/paul/Estelle-ruby/ext/taglib && $(MAKE) -f CMakeFiles/Makefile2 taglib/ape/preinstall
# Prepare targets for installation.
preinstall/fast:
cd /Users/paul/Estelle-ruby/ext/taglib && $(MAKE) -f CMakeFiles/Makefile2 taglib/ape/preinstall
# clear depends
depend:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
# Help Target
help::
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... install"
@echo "... install/local"
@echo "... <API key>"
@echo "... rebuild_cache"
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
<API key>:
cd /Users/paul/Estelle-ruby/ext/taglib && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
|
/*
* Virtual Raw MIDI client
*
* The virtual rawmidi client is a sequencer client which associate
* a rawmidi device file. The created rawmidi device file can be
* accessed as a normal raw midi, but its MIDI source and destination
* are arbitrary. For example, a user-client software synth connected
* to this port can be used as a normal midi device as well.
*
* The virtual rawmidi device accepts also multiple opens. Each file
* has its own input buffer, so that no conflict would occur. The drain
* of input/output buffer acts only to the local buffer.
*
*/
#include <linux/init.h>
#include <linux/wait.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/rawmidi.h>
#include <sound/info.h>
#include <sound/control.h>
#include <sound/minors.h>
#include <sound/seq_kernel.h>
#include <sound/seq_midi_event.h>
#include <sound/seq_virmidi.h>
MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
MODULE_DESCRIPTION("Virtual Raw MIDI client on Sequencer");
MODULE_LICENSE("GPL");
/*
* initialize an event record
*/
static void <API key>(struct snd_virmidi *vmidi,
struct snd_seq_event *ev)
{
memset(ev, 0, sizeof(*ev));
ev->source.port = vmidi->port;
switch (vmidi->seq_mode) {
case <API key>:
ev->dest.client = <API key>;
break;
case <API key>:
/* FIXME: source and destination are same - not good.. */
ev->dest.client = vmidi->client;
ev->dest.port = vmidi->port;
break;
}
ev->type = <API key>;
}
/*
* decode input event and put to read buffer of each opened file
*/
static int <API key>(struct snd_virmidi_dev *rdev,
struct snd_seq_event *ev)
{
struct snd_virmidi *vmidi;
unsigned char msg[4];
int len;
read_lock(&rdev->filelist_lock);
list_for_each_entry(vmidi, &rdev->filelist, list) {
if (!vmidi->trigger)
continue;
if (ev->type == <API key>) {
if ((ev->flags & <API key>) != <API key>)
continue;
<API key>(ev, (snd_seq_dump_func_t)snd_rawmidi_receive, vmidi->substream);
} else {
len = <API key>(vmidi->parser, msg, sizeof(msg), ev);
if (len > 0)
snd_rawmidi_receive(vmidi->substream, msg, len);
}
}
read_unlock(&rdev->filelist_lock);
return 0;
}
/*
* receive an event from the remote virmidi port
*
* for rawmidi inputs, you can call this function from the event
* handler of a remote port which is attached to the virmidi via
* <API key>.
*/
#if 0
int snd_virmidi_receive(struct snd_rawmidi *rmidi, struct snd_seq_event *ev)
{
struct snd_virmidi_dev *rdev;
rdev = rmidi->private_data;
return <API key>(rdev, ev);
}
#endif
/*
* event handler of virmidi port
*/
static int <API key>(struct snd_seq_event *ev, int direct,
void *private_data, int atomic, int hop)
{
struct snd_virmidi_dev *rdev;
rdev = private_data;
if (!(rdev->flags & SNDRV_VIRMIDI_USE))
return 0; /* ignored */
return <API key>(rdev, ev);
}
/*
* trigger rawmidi stream for input
*/
static void <API key>(struct <API key> *substream, int up)
{
struct snd_virmidi *vmidi = substream->runtime->private_data;
if (up) {
vmidi->trigger = 1;
} else {
vmidi->trigger = 0;
}
}
/*
* trigger rawmidi stream for output
*/
static void <API key>(struct <API key> *substream, int up)
{
struct snd_virmidi *vmidi = substream->runtime->private_data;
int count, res;
unsigned char buf[32], *pbuf;
if (up) {
vmidi->trigger = 1;
if (vmidi->seq_mode == <API key> &&
!(vmidi->rdev->flags & <API key>)) {
<API key>(substream, substream->runtime->buffer_size - substream->runtime->avail);
return; /* ignored */
}
if (vmidi->event.type != <API key>) {
if (<API key>(vmidi->client, &vmidi->event, in_atomic(), 0) < 0)
return;
vmidi->event.type = <API key>;
}
while (1) {
count = <API key>(substream, buf, sizeof(buf));
if (count <= 0)
break;
pbuf = buf;
while (count > 0) {
res = <API key>(vmidi->parser, pbuf, count, &vmidi->event);
if (res < 0) {
<API key>(vmidi->parser);
continue;
}
<API key>(substream, res);
pbuf += res;
count -= res;
if (vmidi->event.type != <API key>) {
if (<API key>(vmidi->client, &vmidi->event, in_atomic(), 0) < 0)
return;
vmidi->event.type = <API key>;
}
}
}
} else {
vmidi->trigger = 0;
}
}
/*
* open rawmidi handle for input
*/
static int <API key>(struct <API key> *substream)
{
struct snd_virmidi_dev *rdev = substream->rmidi->private_data;
struct snd_rawmidi_runtime *runtime = substream->runtime;
struct snd_virmidi *vmidi;
unsigned long flags;
vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL);
if (vmidi == NULL)
return -ENOMEM;
vmidi->substream = substream;
if (snd_midi_event_new(0, &vmidi->parser) < 0) {
kfree(vmidi);
return -ENOMEM;
}
vmidi->seq_mode = rdev->seq_mode;
vmidi->client = rdev->client;
vmidi->port = rdev->port;
runtime->private_data = vmidi;
write_lock_irqsave(&rdev->filelist_lock, flags);
list_add_tail(&vmidi->list, &rdev->filelist);
<API key>(&rdev->filelist_lock, flags);
vmidi->rdev = rdev;
return 0;
}
/*
* open rawmidi handle for output
*/
static int <API key>(struct <API key> *substream)
{
struct snd_virmidi_dev *rdev = substream->rmidi->private_data;
struct snd_rawmidi_runtime *runtime = substream->runtime;
struct snd_virmidi *vmidi;
vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL);
if (vmidi == NULL)
return -ENOMEM;
vmidi->substream = substream;
if (snd_midi_event_new(MAX_MIDI_EVENT_BUF, &vmidi->parser) < 0) {
kfree(vmidi);
return -ENOMEM;
}
vmidi->seq_mode = rdev->seq_mode;
vmidi->client = rdev->client;
vmidi->port = rdev->port;
<API key>(vmidi, &vmidi->event);
vmidi->rdev = rdev;
runtime->private_data = vmidi;
return 0;
}
/*
* close rawmidi handle for input
*/
static int <API key>(struct <API key> *substream)
{
struct snd_virmidi *vmidi = substream->runtime->private_data;
snd_midi_event_free(vmidi->parser);
list_del(&vmidi->list);
substream->runtime->private_data = NULL;
kfree(vmidi);
return 0;
}
/*
* close rawmidi handle for output
*/
static int <API key>(struct <API key> *substream)
{
struct snd_virmidi *vmidi = substream->runtime->private_data;
snd_midi_event_free(vmidi->parser);
substream->runtime->private_data = NULL;
kfree(vmidi);
return 0;
}
/*
* subscribe callback - allow output to rawmidi device
*/
static int <API key>(void *private_data,
struct <API key> *info)
{
struct snd_virmidi_dev *rdev;
rdev = private_data;
if (!try_module_get(rdev->card->module))
return -EFAULT;
rdev->flags |= <API key>;
return 0;
}
/*
* unsubscribe callback - disallow output to rawmidi device
*/
static int <API key>(void *private_data,
struct <API key> *info)
{
struct snd_virmidi_dev *rdev;
rdev = private_data;
rdev->flags &= ~<API key>;
module_put(rdev->card->module);
return 0;
}
/*
* use callback - allow input to rawmidi device
*/
static int snd_virmidi_use(void *private_data,
struct <API key> *info)
{
struct snd_virmidi_dev *rdev;
rdev = private_data;
if (!try_module_get(rdev->card->module))
return -EFAULT;
rdev->flags |= SNDRV_VIRMIDI_USE;
return 0;
}
/*
* unuse callback - disallow input to rawmidi device
*/
static int snd_virmidi_unuse(void *private_data,
struct <API key> *info)
{
struct snd_virmidi_dev *rdev;
rdev = private_data;
rdev->flags &= ~SNDRV_VIRMIDI_USE;
module_put(rdev->card->module);
return 0;
}
/*
* Register functions
*/
static struct snd_rawmidi_ops <API key> = {
.open = <API key>,
.close = <API key>,
.trigger = <API key>,
};
static struct snd_rawmidi_ops <API key> = {
.open = <API key>,
.close = <API key>,
.trigger = <API key>,
};
/*
* create a sequencer client and a port
*/
static int <API key>(struct snd_virmidi_dev *rdev)
{
int client;
struct <API key> pcallbacks;
struct snd_seq_port_info *pinfo;
int err;
if (rdev->client >= 0)
return 0;
pinfo = kzalloc(sizeof(*pinfo), GFP_KERNEL);
if (!pinfo) {
err = -ENOMEM;
goto __error;
}
client = <API key>(rdev->card, rdev->device,
"%s %d-%d", rdev->rmidi->name,
rdev->card->number,
rdev->device);
if (client < 0) {
err = client;
goto __error;
}
rdev->client = client;
/* create a port */
pinfo->addr.client = client;
sprintf(pinfo->name, "VirMIDI %d-%d", rdev->card->number, rdev->device);
/* set all capabilities */
pinfo->capability |= <API key> | <API key> | <API key>;
pinfo->capability |= <API key> | <API key> | <API key>;
pinfo->capability |= <API key>;
pinfo->type = <API key>
| <API key>
| <API key>;
pinfo->midi_channels = 16;
memset(&pcallbacks, 0, sizeof(pcallbacks));
pcallbacks.owner = THIS_MODULE;
pcallbacks.private_data = rdev;
pcallbacks.subscribe = <API key>;
pcallbacks.unsubscribe = <API key>;
pcallbacks.use = snd_virmidi_use;
pcallbacks.unuse = snd_virmidi_unuse;
pcallbacks.event_input = <API key>;
pinfo->kernel = &pcallbacks;
err = <API key>(client, <API key>, pinfo);
if (err < 0) {
<API key>(client);
rdev->client = -1;
goto __error;
}
rdev->port = pinfo->addr.port;
err = 0; /* success */
__error:
kfree(pinfo);
return err;
}
/*
* release the sequencer client
*/
static void <API key>(struct snd_virmidi_dev *rdev)
{
if (rdev->client >= 0) {
<API key>(rdev->client);
rdev->client = -1;
}
}
/*
* register the device
*/
static int <API key>(struct snd_rawmidi *rmidi)
{
struct snd_virmidi_dev *rdev = rmidi->private_data;
int err;
switch (rdev->seq_mode) {
case <API key>:
err = <API key>(rdev);
if (err < 0)
return err;
break;
case <API key>:
if (rdev->client == 0)
return -EINVAL;
/* should check presence of port more strictly.. */
break;
default:
snd_printk(KERN_ERR "seq_mode is not set: %d\n", rdev->seq_mode);
return -EINVAL;
}
return 0;
}
/*
* unregister the device
*/
static int <API key>(struct snd_rawmidi *rmidi)
{
struct snd_virmidi_dev *rdev = rmidi->private_data;
if (rdev->seq_mode == <API key>)
<API key>(rdev);
return 0;
}
static struct <API key> <API key> = {
.dev_register = <API key>,
.dev_unregister = <API key>,
};
/*
* free device
*/
static void snd_virmidi_free(struct snd_rawmidi *rmidi)
{
struct snd_virmidi_dev *rdev = rmidi->private_data;
kfree(rdev);
}
/*
* create a new device
*
*/
/* exported */
int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmidi)
{
struct snd_rawmidi *rmidi;
struct snd_virmidi_dev *rdev;
int err;
*rrmidi = NULL;
if ((err = snd_rawmidi_new(card, "VirMidi", device,
16, /* may be configurable */
16, /* may be configurable */
&rmidi)) < 0)
return err;
strcpy(rmidi->name, rmidi->id);
rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
if (rdev == NULL) {
snd_device_free(card, rmidi);
return -ENOMEM;
}
rdev->card = card;
rdev->rmidi = rmidi;
rdev->device = device;
rdev->client = -1;
rwlock_init(&rdev->filelist_lock);
INIT_LIST_HEAD(&rdev->filelist);
rdev->seq_mode = <API key>;
rmidi->private_data = rdev;
rmidi->private_free = snd_virmidi_free;
rmidi->ops = &<API key>;
snd_rawmidi_set_ops(rmidi, <API key>, &<API key>);
snd_rawmidi_set_ops(rmidi, <API key>, &<API key>);
rmidi->info_flags = <API key> |
<API key> |
<API key>;
*rrmidi = rmidi;
return 0;
}
/*
* ENTRY functions
*/
static int __init alsa_virmidi_init(void)
{
return 0;
}
static void __exit alsa_virmidi_exit(void)
{
}
module_init(alsa_virmidi_init)
module_exit(alsa_virmidi_exit)
EXPORT_SYMBOL(snd_virmidi_new);
|
// External imports
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.BufferedInputStream;
import javax.imageio.ImageIO;
import javax.swing.*;
// Local imports
import org.j3d.renderer.aviatrix3d.texture.TextureCreateUtils;
/**
* Example application that demonstrates how to use the loader interface
* to load a file into the scene graph.
* <p>
*
* @author Justin Couch
* @version $Revision: 1.1 $
*/
public class NormalMapDemo extends JFrame
implements ActionListener
{
private JFileChooser openDialog;
/** Renderer for the basic image */
private ImageIcon srcIcon;
private JLabel srcLabel;
/** Renderer for the normal map version */
private ImageIcon mapIcon;
private JLabel mapLabel;
/** Utility for munging textures to power of 2 size */
private TextureCreateUtils textureUtils;
public NormalMapDemo()
{
super("Normal map conversion demo");
setSize(1280, 1024);
setLocation(0, 0);
<API key>(JFrame.EXIT_ON_CLOSE);
textureUtils = new TextureCreateUtils();
JPanel p1 = new JPanel(new BorderLayout());
srcIcon = new ImageIcon();
srcLabel = new JLabel();
srcLabel.<API key>(SwingConstants.BOTTOM);
srcLabel.setText("Source Image");
mapIcon = new ImageIcon();
mapLabel = new JLabel();
mapLabel.<API key>(SwingConstants.BOTTOM);
mapLabel.setText("NormalMap Image");
JButton b = new JButton("Open A file");
b.addActionListener(this);
p1.add(b, BorderLayout.SOUTH);
p1.add(srcLabel, BorderLayout.WEST);
p1.add(mapLabel, BorderLayout.EAST);
getContentPane().add(p1);
}
// Methods defined by WindowListener
/**
* Process the action event from the open button
*/
public void actionPerformed(ActionEvent evt)
{
if(openDialog == null)
openDialog = new JFileChooser();
int ret_val = openDialog.showOpenDialog(this);
if(ret_val != JFileChooser.APPROVE_OPTION)
return;
File file = openDialog.getSelectedFile();
try
{
System.out.println("Loading external file: " + file);
FileInputStream is = new FileInputStream(file);
BufferedInputStream stream = new BufferedInputStream(is);
BufferedImage img = ImageIO.read(stream);
if(img == null)
{
System.out.println("Image load barfed");
return;
}
srcIcon.setImage(img);
srcLabel.setIcon(srcIcon);
BufferedImage map_img = textureUtils.createNormalMap(img, null);
mapIcon.setImage(map_img);
mapLabel.setIcon(mapIcon);
}
catch(IOException ioe)
{
System.out.println("crashed " + ioe.getMessage());
ioe.printStackTrace();
}
}
// Local methods
public static void main(String[] args)
{
NormalMapDemo demo = new NormalMapDemo();
demo.setVisible(true);
}
}
|
# tps23861
Linux driver for TPS23861 IEEE 802.3at Quad Port Power-over-Ethernet PSE Controller.
Tested with kernel version 3.19.0
Bindings example:
tps23861: tps23861@20 {
compatible = "ti,tps23861";
reg = <0x20>;
irq-gpio = <84>;
port0@0 {
enable = <1>;
mode = "auto";
power = <1>;
};
port1@1 {
enable = <1>;
mode = "manual";
power = <0>;
};
port2@2 {
enable = <0>;
};
port3@3 {
enable = <0>;
};
};
|
<?php get_header() ?>
archive
<!--/nav-->
<?php
$banner_image = get_field('banner_image');
$bannerUrl = <API key>($banner_image, 'large');
$bannerImg = aq_resize($bannerUrl[0], 974, 312, true);
if ($bannerImg == '') {
$bannerImg = <API key>() . '/images/the-authors-banner.jpg';
}
?>
<section id="banner">
<div class="container" style="background-image:url('<?php echo $bannerImg; ?>');">
</div>
</section>
<!--main
<div id="main" role="main">
<div class="container">
<section id="archive-news">
<header class="section-header left"><h1>Latest News</h1></header>
<?php if (have_posts()):
while (have_posts()) : the_post();
?>
<?php
$feat_image = <API key>($post->ID);
$featureUrl = <API key>($feat_image, 'large');
$featureImage = aq_resize($featureUrl[0], 309, 206, true);
?>
<article class="has-feature">
<div class="wrap">
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div class="alpha">
<small><time datetime="2014-11-21"><?php echo get_the_date(); ?></time></small>
<?php the_content(); ?>
</div>
<div class="beta"><figure><a href="<?php the_permalink(); ?>"><img src="<?php echo $featureImage; ?>" /></a></figure></div>
</div>
<div class="divide"><div></div></div>
</article>
<?php
endwhile;
endif;
?>
</section>
</div> <!-- /container -->
</div>
<!-- testimonials slider -->
<!-- /testimonials slider -->
<?php get_footer() ?>
|
#ifndef TILIB_H
#define TILIB_H
#ifdef __cplusplus
extern "C" {
#endif
#define GRAYSCALE (0)
#define TRUECOLOR (1)
#define BUTTERWORTH (0)
#define DAUB97 (1)
int TiCompress(unsigned char *image,
unsigned char *stream,
int img_width,
int img_height,
int wavelet,
int img_type,
int desired_size,
int *actual_size,
int lum_ratio,
int cb_ratio,
int cr_ratio,
int scales);
int TiCheckHeader(unsigned char *stream,
int *img_width,
int *img_height,
int *img_type,
int stream_size);
int TiDecompress(unsigned char *stream,
unsigned char *image,
int img_width,
int img_height,
int img_type,
int stream_size);
#ifdef __cplusplus
}
#endif
#endif /* TILIB_H */
|
<?php
// Dropcap shortcode
add_shortcode( 'dropcap', 'shortcode_dropcap' );
function shortcode_dropcap( $atts, $content = null ) {
extract( shortcode_atts( array(
'text' => '',
'el_class' => ''
), $atts ) );
return '<span class="dropcap '.$el_class.'">' . $content . '</span>';
}
|
package com.sun.media.jai.opimage;
import java.awt.RenderingHints;
import java.awt.geom.Rectangle2D;
import java.awt.image.RenderedImage;
import java.awt.image.renderable.RenderContext;
import java.awt.image.renderable.ParameterBlock;
import java.awt.image.renderable.RenderableImage;
import javax.media.jai.CRIFImpl;
import javax.media.jai.ImageLayout;
import java.util.Map;
/**
* A <code>CRIF</code> supporting the "Or" operation in the
* rendered and renderable image layers.
*
* @since EA2
* @see javax.media.jai.operator.OrDescriptor
* @see OrOpImage
*
*/
public class OrCRIF extends CRIFImpl {
/** Constructor. */
public OrCRIF() {
super("or");
}
/**
* Creates a new instance of <code>OrOpImage</code> in the
* rendered layer. This method satisifies the implementation of RIF.
*
* @param paramBlock The two source images to be "Ored" together.
* @param renderHints Optionally contains destination image layout.
*/
public RenderedImage create(ParameterBlock paramBlock,
RenderingHints renderHints) {
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
return new OrOpImage(paramBlock.getRenderedSource(0),
paramBlock.getRenderedSource(1),
renderHints,
layout);
}
}
|
using BlueBit.CarsEvidence.Commons.Templates;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.Contracts;
namespace BlueBit.CarsEvidence.BL.Entities
{
public class Person :
EntityBase,
IObjectWithGetCode,
IObjectWithGetInfo
{
[Required]
[MaxLength(Configuration.Consts.LengthCode)]
public virtual string Code { get; set; }
[MaxLength(Configuration.Consts.LengthInfo)]
public virtual string Info { get; set; }
[Required]
[MaxLength(Configuration.Consts.LengthText)]
public virtual string FirstName { get; set; }
[Required]
[MaxLength(Configuration.Consts.LengthText)]
public virtual string LastName { get; set; }
public virtual ISet<PeriodRouteEntry> PeriodRouteEntries { get; set; }
public virtual ISet<PeriodFuelEntry> PeriodFuelEntries { get; set; }
public override void Init()
{
PeriodRouteEntries = PeriodRouteEntries ?? new HashSet<PeriodRouteEntry>();
PeriodFuelEntries = PeriodFuelEntries ?? new HashSet<PeriodFuelEntry>();
}
}
public static class PersonExtensions
{
public static PeriodRouteEntry AddPeriodRouteEntry(this Person @this, PeriodRouteEntry entry)
{
Contract.Assert(@this != null);
Contract.Assert(entry != null);
Contract.Assert(entry.Person == null);
entry.Person = @this;
@this.PeriodRouteEntries.Add(entry);
return entry;
}
public static PeriodFuelEntry AddPeriodFuelEntry(this Person @this, PeriodFuelEntry entry)
{
Contract.Assert(@this != null);
Contract.Assert(entry != null);
Contract.Assert(entry.Person == null);
entry.Person = @this;
@this.PeriodFuelEntries.Add(entry);
return entry;
}
}
}
|
#ifndef <API key>
#define <API key>
#include "jsapi.h"
#include "jsfriendapi.h"
#include "network/HttpClient.h"
#include "js_bindings_config.h"
#include "ScriptingCore.h"
#include "jsb_helper.h"
class MinXmlHttpRequest : public cocos2d::Ref
{
public:
enum class ResponseType
{
STRING,
ARRAY_BUFFER,
BLOB,
DOCUMENT,
JSON
};
// Ready States (http://www.w3.org/TR/XMLHttpRequest/#<API key>)
static const unsigned short UNSENT = 0;
static const unsigned short OPENED = 1;
static const unsigned short HEADERS_RECEIVED = 2;
static const unsigned short LOADING = 3;
static const unsigned short DONE = 4;
MinXmlHttpRequest();
~MinXmlHttpRequest();
<API key>(MinXmlHttpRequest);
<API key>(MinXmlHttpRequest);
<API key>(MinXmlHttpRequest, onreadystatechange);
<API key>(MinXmlHttpRequest, responseType);
<API key>(MinXmlHttpRequest, withCredentials);
<API key>(MinXmlHttpRequest, upload);
<API key>(MinXmlHttpRequest, timeout);
JS_BINDED_PROP_GET(MinXmlHttpRequest, readyState);
JS_BINDED_PROP_GET(MinXmlHttpRequest, status);
JS_BINDED_PROP_GET(MinXmlHttpRequest, statusText);
JS_BINDED_PROP_GET(MinXmlHttpRequest, responseText);
JS_BINDED_PROP_GET(MinXmlHttpRequest, response);
JS_BINDED_PROP_GET(MinXmlHttpRequest, responseXML);
JS_BINDED_FUNC(MinXmlHttpRequest, open);
JS_BINDED_FUNC(MinXmlHttpRequest, send);
JS_BINDED_FUNC(MinXmlHttpRequest, abort);
JS_BINDED_FUNC(MinXmlHttpRequest, <API key>);
JS_BINDED_FUNC(MinXmlHttpRequest, getResponseHeader);
JS_BINDED_FUNC(MinXmlHttpRequest, setRequestHeader);
JS_BINDED_FUNC(MinXmlHttpRequest, overrideMimeType);
void <API key>(cocos2d::network::HttpClient *sender, cocos2d::network::HttpResponse *response);
private:
void _gotHeader(std::string header);
void _setRequestHeader(const char* field, const char* value);
void <API key>();
void _sendRequest(JSContext *cx);
std::string _url;
JSContext* _cx;
std::string _meth;
std::string _type;
char* _data;
uint32_t _dataSize;
JSObject* <API key>;
int _readyState;
int _status;
std::string _statusText;
ResponseType _responseType;
unsigned _timeout;
bool _isAsync;
cocos2d::network::HttpRequest* _httpRequest;
bool _isNetwork;
bool <API key>;
bool _errorFlag;
std::unordered_map<std::string, std::string> _httpHeader;
std::unordered_map<std::string, std::string> _requestHeader;
};
#endif
|
<?php
abstract class <API key> extends <API key> {
public function <API key>($oTerm) {
echo $this->_getFieldsOutput(isset($oTerm->term_id) ? $oTerm->term_id : null, false);
}
public function <API key>($oTerm) {
echo $this->_getFieldsOutput(isset($oTerm->term_id) ? $oTerm->term_id : null, true);
}
private function _getFieldsOutput($iTermID, $bRenderTableRow) {
$_aOutput = array();
$_aOutput[] = wp_nonce_field($this->oProp->sClassHash, $this->oProp->sClassHash, true, false);
$this->_setOptionArray($iTermID, $this->oProp->sOptionKey);
$this->oForm->format();
$_oFieldsTable = new <API key>($this->oProp-><API key>, $this->_getFieldErrors(), $this->oMsg);
$_aOutput[] = $bRenderTableRow ? $_oFieldsTable->getFieldRows($this->oForm->aFields['_default'], array($this, '<API key>')) : $_oFieldsTable->getFields($this->oForm->aFields['_default'], array($this, '<API key>'));
$_sOutput = $this->oUtil->addAndApplyFilters($this, 'content_' . $this->oProp->sClassName, implode(PHP_EOL, $_aOutput));
$this->oUtil->addAndDoActions($this, 'do_' . $this->oProp->sClassName, $this);
return $_sOutput;
}
public function <API key>($vValue, $sColumnSlug, $sTermID) {
$_sCellHTML = '';
if (isset($_GET['taxonomy']) && $_GET['taxonomy']) {
$_sCellHTML = $this->oUtil->addAndApplyFilter($this, "cell_{$_GET['taxonomy']}", $vValue, $sColumnSlug, $sTermID);
}
$_sCellHTML = $this->oUtil->addAndApplyFilter($this, "cell_{$this->oProp->sClassName}", $_sCellHTML, $sColumnSlug, $sTermID);
$_sCellHTML = $this->oUtil->addAndApplyFilter($this, "cell_{$this->oProp->sClassName}_{$sColumnSlug}", $_sCellHTML, $sTermID);
echo $_sCellHTML;
}
}
|
<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'WM_Revision' ) ) {
/**
* Class WM_Revision
*
* Handles all the functionality to track custom fields
*
* @since 0.4
*/
class WM_Revision {
/**
* @since 0.4
*/
function __construct() {
/**
* This hook filters the number of revisions to keep for a specific post.
*/
add_filter( '<API key>', array( $this, '<API key>' ), 999, 2 );
/**
* This hooks gets fired once a revision is stored in WP_Post table in DB.
*
* This gives us $revision_id. So we can make use of that and store our stuff into post meta for that particular revision.
* E.g., Taxonomy diff, meta diff., featured image diff, etc.
*
*/
add_action( '<API key>', array( $this, '<API key>' ), 10, 1 );
/**
* Filter whether the post has changed since the last revision.
*
* By default a revision is saved only if one of the revisioned fields has changed.
* This filter can override that so a revision is saved even if nothing has changed.
*
* We will take care of our own fields and pass on the flag.
*/
add_filter( '<API key>', array( $this, 'check_for_changes' ), 10, 3 );
/**
* We may have to call this dynamically within a for loop. depending upon how many custom fields that we are supporting.
*/
foreach ( array_keys( $this-><API key>() ) as $field ) {
add_filter( '<API key>'.$field, array( $this, '<API key>' ), 10, 4 );
}
/**
* This adds custom diff ui for custom revision fields
*/
add_filter( '<API key>', array( $this, 'revision_ui_diff' ), 10, 3 );
}
/**
* @param $num
* @param $post
*
* @return int
* @since 0.1
*/
function <API key>( $num, $post ) {
// Check individual Post Limit
$revision_limit = get_post_meta( $post->ID, WM_Admin::$<API key>, true );
if ( '' !== $revision_limit ) {
if ( ! is_numeric( $revision_limit ) ) {
$num = - 1;
} else {
$num = intval( $revision_limit );
}
} else {
$post_type = get_post_type( $post );
$revision_limit = get_option( WM_Settings::$revision_limit_key . $post_type, false );
if ( '' === $revision_limit || ! is_numeric( $revision_limit ) ) {
$num = - 1;
} else {
$num = intval( $revision_limit );
}
}
return $num;
}
/**
* @return array $revision_fields
* @since 0.5
*/
function <API key>() {
$revision_fields = array(
'post_author' => array(
'label' => __( 'Post Author', WM_TEXT_DOMAIN ),
'meta_key' => '_wm_post_author',
'meta_value' => function( $post ) {
$author = new WP_User( $post->post_author );
return $author->display_name . ' (' . $post->post_author . ')';
},
),
'post_status' => array(
'label' => __( 'Post Status', WM_TEXT_DOMAIN ),
'meta_key' => '_wm_post_status',
'meta_value' => function( $post ) {
$post_status = <API key>( $post->post_status );
return $post_status->label;
},
),
'post_date' => array(
'label' => __( 'Post Date', WM_TEXT_DOMAIN ),
'meta_key' => '_wm_post_date',
'meta_value' => function( $post ) {
$datef = 'M j, Y @ H:i';
return date_i18n( $datef, strtotime( $post->post_date ) );
},
),
);
return $revision_fields;
}
/**
* @param $revision_id
* @since 0.4
*/
function <API key>( $revision_id ) {
$revision = get_post( $revision_id );
$post = get_post( $revision->post_parent );
foreach ( $this-><API key>() as $field => $fieldmeta ) {
update_post_meta( $post->ID, $fieldmeta['meta_key'] . '_' . $revision_id , call_user_func( $fieldmeta['meta_value'], $post ) );
}
}
/**
* @param $post_has_changed
* @param $last_revision
* @param $post
*
* @return mixed
* @since 0.4
*/
function check_for_changes( $post_has_changed, $last_revision, $post ) {
foreach ( $this-><API key>() as $field => $fieldmeta ) {
$post_value = <API key>( call_user_func( $fieldmeta['meta_value'], $post ) );
$revision_value = <API key>( apply_filters( "<API key>$field", $last_revision->$field, $field, $last_revision, 'from' ) );
if ( $post_value != $revision_value ) {
$post_has_changed = true;
break;
}
}
return $post_has_changed;
}
/**
* Contextually filter a post revision field.
*
* The dynamic portion of the hook name, $field, corresponds to each of the post
* fields of the revision object being iterated over in a foreach statement.
*
* @param string $value The current revision field to compare to or from.
* @param string $field The current revision field.
* @param WP_Post $post The revision post object to compare to or from.
* @param string $context The context of whether the current revision is the old or the new one. Values are 'to' or 'from'.
*
* @return string $value
* @since 0.4
*/
function <API key>( $value, $field, $post, $context ) {
$revision_fields = $this-><API key>();
if ( array_key_exists( $field, $revision_fields ) ) {
$value = get_post_meta( $post->post_parent, $revision_fields[ $field ]['meta_key'] . '_' . $post->ID, true );
}
return $value;
}
/**
* Filter the fields displayed in the post revision diff UI.
*
* @since 4.1.0
*
* @param array $return Revision UI fields. Each item is an array of id, name and diff.
* @param WP_Post $compare_from The revision post to compare from.
* @param WP_Post $compare_to The revision post to compare to.
*
* @return array $return
* @since 0.5
*/
function revision_ui_diff( $return, $compare_from, $compare_to ) {
foreach ( $this-><API key>() as $field => $fieldmeta ) {
/**
* Contextually filter a post revision field.
*
* The dynamic portion of the hook name, `$field`, corresponds to each of the post
* fields of the revision object being iterated over in a foreach statement.
*
* @since 3.6.0
*
* @param string $compare_from->$field The current revision field to compare to or from.
* @param string $field The current revision field.
* @param WP_Post $compare_from The revision post object to compare to or from.
* @param string null The context of whether the current revision is the old
* or the new one. Values are 'to' or 'from'.
*/
$content_from = $compare_from ? apply_filters( "<API key>$field", $compare_from->$field, $field, $compare_from, 'from' ) : '';
/** This filter is documented in wp-admin/includes/revision.php */
$content_to = apply_filters( "<API key>$field", $compare_to->$field, $field, $compare_to, 'to' );
$args = array(
'show_split_view' => true,
);
/**
* Filter revisions text diff options.
*
* Filter the options passed to {@see wp_text_diff()} when viewing a post revision.
*
* @since 4.1.0
*
* @param array $args {
* Associative array of options to pass to {@see wp_text_diff()}.
*
* @type bool $show_split_view True for split view (two columns), false for
* un-split view (single column). Default true.
* }
* @param string $field The current revision field.
* @param WP_Post $compare_from The revision post to compare from.
* @param WP_Post $compare_to The revision post to compare to.
*/
$args = apply_filters( '<API key>', $args, $field, $compare_from, $compare_to );
$diff = wp_text_diff( $content_from, $content_to, $args );
if ( $diff ) {
$return[] = array(
'id' => $field,
'name' => $fieldmeta['label'],
'diff' => $diff,
);
}
}
return $return;
}
}
}
|
<?php
get_header(); ?>
<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
get_template_part( 'content', get_post_format() );
?>
<?php endwhile; ?>
<?php <API key>( 'nav-below' ); ?>
<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
<div id="food-content">
<h1>image</h1>
<div id="inner-box">
<p>Fresh. Local. Family Owned.</p>
<a class="button" href="
<h1>Icon menu </h1>
<p>Browse Menus</p>
</a>
</div>
</div>
<div class="wrapper">
<blockquote id="feedback">
<p> Thank you for providing us each delicious food and service for the St. Mary's
50th Anniversary Celebration! The food was excellent and you are all the best to work with! We are grateful for you, thank you.<br>
<span>-Siobhan </span>
</p>
<div class="splitter">
</div>
<br>
<br>
<p>Many thanks for your kindness during such a sad time for us - you were so helpful. Everyone enjoyed your wonderful food at the church reception. <br> <span>-Mrs. Showalter</span></p>
</blockquote>
<div id="contact-info">
<div id="contact-box">
<img src="wp-content/themes/morrisseys_catering/images/icon_phone.png" alt="phone.icon"> <p> (804) 592-2188</p>
</div>
<br>
<br>
<div class="address-info">
<p> 8901 Three Chopt Road, Suite A, Richmond, Va 23229 </p>
<p> Located in the Westbury Pharmacy Center</p>
</div> <!--address-info
</div> <!-- contact-info" -->
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
|
<?php
use Icinga\Web\Controller;
use Icinga\Web\Url;
use Icinga\Web\Widget\Tabextension\DashboardAction;
use Icinga\Web\Widget\Tabextension\OutputFormat;
use Icinga\Application\Config;
use Icinga\Application\Logger;
use Icinga\Data\ConfigObject;
use Icinga\Protocol\File\FileReader;
use \<API key> as ActionError;
/**
* Class ListController
*
* Application wide controller for various listing actions
*/
class ListController extends Controller
{
/**
* Add title tab
*
* @param string $action
*/
protected function addTitleTab($action)
{
$this->getTabs()->add($action, array(
'label' => ucfirst($action),
'url' => Url::fromPath(
'list/'
. str_replace(' ', '', $action)
)
))->extend(new OutputFormat())->extend(new DashboardAction())->activate($action);
}
/**
* Display the application log
*/
public function <API key>()
{
if (! Logger::writesToFile()) {
throw new ActionError('Site not found', 404);
}
$this->addTitleTab('application log');
$resource = new FileReader(new ConfigObject(array(
'filename' => Config::app()->get('logging', 'file'),
'fields' => '/(?<!.)(?<datetime>[0-9]{4}(?:-[0-9]{2}){2}' // date
. 'T[0-9]{2}(?::[0-9]{2}){2}(?:[\+\-][0-9]{2}:[0-9]{2})?)' // time
. ' - (?<loglevel>[A-Za-z]+) - (?<message>.*)(?!.)/msS' // loglevel, message
)));
$this->view->logData = $resource->select()->order('DESC');
$this->setupLimitControl();
$this-><API key>($this->view->logData);
}
}
|
SHELL = /bin/sh
# V=0 quiet, V=1 verbose. other values don't work.
V = 0
Q1 = $(V:1=)
Q = $(Q1:0=@)
ECHO1 = $(V:1=@ :)
ECHO = $(ECHO1:0=@ echo)
NULLCMD = :
srcdir = .
topdir = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0
hdrdir = $(topdir)
arch_hdrdir = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19
PATH_SEPARATOR = :
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
prefix = $(DESTDIR)/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
rubyarchprefix = $(rubylibprefix)/$(arch)
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
exec_prefix = $(prefix)
vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
sitearchhdrdir = $(sitehdrdir)/$(sitearch)
rubyarchhdrdir = $(rubyhdrdir)/$(arch)
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
sitehdrdir = $(rubyhdrdir)/site_ruby
rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
vendorarchdir = $(vendorlibdir)/$(sitearch)
vendorlibdir = $(vendordir)/$(ruby_version)
vendordir = $(rubylibprefix)/vendor_ruby
sitearchdir = $(DESTDIR)./.gem.<API key>
sitelibdir = $(DESTDIR)./.gem.<API key>
sitedir = $(DESTDIR)/Library/Ruby/Site
rubyarchdir = $(rubylibdir)/$(arch)
rubylibdir = $(rubylibprefix)/$(ruby_version)
sitearchincludedir = $(includedir)/$(sitearch)
archincludedir = $(includedir)/$(arch)
sitearchlibdir = $(libdir)/$(sitearch)
archlibdir = $(libdir)/$(arch)
ridir = $(datarootdir)/$(RI_BASE_NAME)
mandir = $(DESTDIR)/usr/share/man
localedir = $(datarootdir)/locale
libdir = $(exec_prefix)/lib
psdir = $(docdir)
pdfdir = $(docdir)
dvidir = $(docdir)
htmldir = $(docdir)
infodir = $(DESTDIR)/usr/share/info
docdir = $(datarootdir)/doc/$(PACKAGE)
oldincludedir = $(DESTDIR)/usr/include
includedir = $(DESTDIR)/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk$(prefix)/include
localstatedir = $(prefix)/var
sharedstatedir = $(prefix)/com
sysconfdir = $(DESTDIR)/Library/Ruby/Site
datadir = $(datarootdir)
datarootdir = $(prefix)/share
libexecdir = $(exec_prefix)/libexec
sbindir = $(exec_prefix)/sbin
bindir = $(exec_prefix)/bin
archdir = $(rubyarchdir)
CC_WRAPPER =
CC = xcrun clang
CXX = xcrun clang++
LIBRUBY = $(LIBRUBY_SO)
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework Security -framework Foundation $(MAINLIBS)
empty =
OUTFLAG = -o $(empty)
COUTFLAG = -o $(empty)
CSRCFLAG = $(empty)
RUBY_EXTCONF_H = extconf.h
cflags = $(optflags) $(debugflags) $(warnflags)
cxxflags = $(optflags) $(debugflags) $(warnflags)
optflags =
debugflags = -g
warnflags =
cppflags =
CCDLFLAGS =
CFLAGS = $(CCDLFLAGS) -g -Os -pipe -<API key> $(ARCH_FLAG)
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) -I/opt/local/lib/libffi-3.2.1/include
DEFS =
CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\" -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -<API key> -D_REENTRANT $(DEFS) $(cppflags)
CXXFLAGS = $(CCDLFLAGS) -g -Os -pipe $(ARCH_FLAG)
ldflags = -L. -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.Internal.sdk/usr/local/lib -L/opt/local/lib
dldflags = -arch x86_64 -undefined dynamic_lookup -multiply_defined suppress
ARCH_FLAG = -arch x86_64
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
LDSHARED = $(CC) -dynamic -bundle
LDSHAREDXX = $(CXX) -dynamic -bundle
AR = libtool -static
EXEEXT =
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
RUBY_SO_NAME = ruby.2.6
RUBYW_INSTALL_NAME =
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
RUBYW_BASE_NAME = rubyw
RUBY_BASE_NAME = ruby
arch = universal-darwin19
sitearch = $(arch)
ruby_version = 2.6.0
ruby = $(bindir)/$(RUBY_BASE_NAME)
RUBY = $(ruby)
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h $(RUBY_EXTCONF_H)
RM = rm -f
RM_RF = $(RUBY) -run -e rm
RMDIRS = rmdir -p
MAKEDIRS = mkdir -p
INSTALL = /usr/bin/install -c
INSTALL_PROG = $(INSTALL) -m 0755
INSTALL_DATA = $(INSTALL) -m 644
COPY = cp
TOUCH = exit >
preload =
libpath = . $(libdir)
LIBPATH = -L. -L$(libdir)
DEFFILE =
CLEANFILES = mkmf.log
DISTCLEANFILES =
DISTCLEANDIRS =
extout =
extout_prefix =
target_prefix =
LOCAL_LIBS =
LIBS = $(LIBRUBYARG_SHARED) -lffi -lffi
ORIG_SRCS = AbstractMemory.c ArrayType.c Buffer.c Call.c ClosurePool.c DynamicLibrary.c Function.c FunctionInfo.c LastError.c LongDouble.c MappedType.c MemoryPointer.c MethodHandle.c Platform.c Pointer.c Struct.c StructByValue.c StructLayout.c Thread.c Type.c Types.c Variadic.c ffi.c
SRCS = $(ORIG_SRCS)
OBJS = AbstractMemory.o ArrayType.o Buffer.o Call.o ClosurePool.o DynamicLibrary.o Function.o FunctionInfo.o LastError.o LongDouble.o MappedType.o MemoryPointer.o MethodHandle.o Platform.o Pointer.o Struct.o StructByValue.o StructLayout.o Thread.o Type.o Types.o Variadic.o ffi.o
HDRS = $(srcdir)/Type.h $(srcdir)/rbffi_endian.h $(srcdir)/MappedType.h $(srcdir)/Types.h $(srcdir)/LastError.h $(srcdir)/ArrayType.h $(srcdir)/extconf.h $(srcdir)/StructByValue.h $(srcdir)/AbstractMemory.h $(srcdir)/ClosurePool.h $(srcdir)/Call.h $(srcdir)/MethodHandle.h $(srcdir)/Struct.h $(srcdir)/rbffi.h $(srcdir)/Thread.h $(srcdir)/compat.h $(srcdir)/DynamicLibrary.h $(srcdir)/Platform.h $(srcdir)/Function.h $(srcdir)/LongDouble.h $(srcdir)/MemoryPointer.h $(srcdir)/Pointer.h
LOCAL_HDRS =
TARGET = ffi_c
TARGET_NAME = ffi_c
TARGET_ENTRY = Init_$(TARGET_NAME)
DLLIB = $(TARGET).bundle
EXTSTATIC =
STATIC_LIB =
TIMESTAMP_DIR = .
BINDIR = $(bindir)
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
TARGET_SO_DIR =
TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
CLEANLIBS = $(TARGET_SO)
CLEANOBJS = *.o *.bak
all: $(DLLIB)
static: $(STATIC_LIB)
.PHONY: all install static install-so install-rb
.PHONY: clean clean-so clean-static clean-rb
clean-static::
clean-rb-default::
clean-rb::
clean-so::
clean: clean-so clean-static clean-rb-default clean-rb
-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
<API key>::
distclean-rb::
distclean-so::
distclean-static::
distclean: clean distclean-so distclean-static <API key> distclean-rb
-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
realclean: distclean
install: install-so install-rb
install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.time
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
clean-static::
-$(Q)$(RM) $(STATIC_LIB)
install-rb: pre-install-rb do-install-rb install-rb-default
install-rb-default: <API key> <API key>
pre-install-rb: Makefile
<API key>: Makefile
do-install-rb:
<API key>:
<API key>:
@$(NULLCMD)
$(TIMESTAMP_DIR)/.sitearchdir.time:
$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
$(Q) $(TOUCH) $@
site-install: site-install-so site-install-rb
site-install-so: install-so
site-install-rb: install-rb
.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
.cc.o:
$(ECHO) compiling $(<)
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
.cc.S:
$(ECHO) translating $(<)
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
.mm.o:
$(ECHO) compiling $(<)
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
.mm.S:
$(ECHO) translating $(<)
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
.cxx.o:
$(ECHO) compiling $(<)
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
.cxx.S:
$(ECHO) translating $(<)
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
.cpp.o:
$(ECHO) compiling $(<)
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
.cpp.S:
$(ECHO) translating $(<)
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
.c.o:
$(ECHO) compiling $(<)
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
.c.S:
$(ECHO) translating $(<)
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
.m.o:
$(ECHO) compiling $(<)
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
.m.S:
$(ECHO) translating $(<)
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
$(TARGET_SO): $(OBJS) Makefile
$(ECHO) linking shared-object $(DLLIB)
-$(Q)$(RM) $(@)
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
$(Q) $(POSTLINK)
$(OBJS): $(HDRS) $(ruby_headers)
|
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <unistd.h>
#include <global.h>
#include <neutrino.h>
#include <driver/fontrenderer.h>
#include <driver/screen_max.h>
#include <gui/widget/icons.h>
#include <zapit/getservices.h>
#include <zapit/zapit.h>
#include "<API key>.h"
extern CBouquetManager *g_bouquetManager;
<API key>::<API key>(const std::string & Caption, CZapitBouquet* Bouquet, CZapitClient::channelsMode Mode)
{
caption = Caption;
bouquet = Bouquet;
mode = Mode;
selected = 0;
liststart = 0;
<API key> = SORT_ALPHA;
bouquetChannels = NULL;
int iw, ih;
action_icon_width = 0;
frameBuffer->getIconSize(<API key>, &action_icon_width, &ih);
status_icon_width = 0;
frameBuffer->getIconSize(<API key>, &iw, &ih);
status_icon_width = std::max(status_icon_width, iw);
frameBuffer->getIconSize(<API key>, &iw, &ih);
status_icon_width = std::max(status_icon_width, iw);
}
<API key>::~<API key>()
{
}
void <API key>::paintItem(int pos)
{
int ypos = y + header_height + pos*item_height;
unsigned int current = liststart + pos;
bool i_selected = current == selected;
int i_radius = RADIUS_NONE;
fb_pixel_t color;
fb_pixel_t bgcolor;
getItemColors(color, bgcolor, i_selected);
if (i_selected)
{
if (current < Channels.size() || Channels.empty())
paintDetails(pos, current);
i_radius = RADIUS_LARGE;
}
else
{
if (current < Channels.size() && (Channels[current]->flags & CZapitChannel::NOT_PRESENT))
color = <API key>;
}
if (i_radius)
frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, <API key>);
frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, bgcolor, i_radius);
if (current < Channels.size())
{
if (isChannelInBouquet(current))
frameBuffer->paintIcon(<API key>, x + OFFSET_INNER_MID, ypos, item_height);
else
frameBuffer->paintIcon(<API key>, x + OFFSET_INNER_MID, ypos, item_height);
int text_offset = 2*OFFSET_INNER_MID + action_icon_width;
item_font->RenderString(x + text_offset, ypos + item_height, width - text_offset - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID - status_icon_width, Channels[current]->getName(), color);
if (Channels[current]->scrambled)
frameBuffer->paintIcon(<API key>, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - status_icon_width, ypos, item_height);
else if (!Channels[current]->getUrl().empty())
frameBuffer->paintIcon(<API key>, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - status_icon_width, ypos, item_height);
}
frameBuffer->blit();
}
void <API key>::paintItems()
{
liststart = (selected/items_count)*items_count;
for(unsigned int count = 0; count < items_count; count++)
paintItem(count);
int total_pages;
int current_page;
getScrollBarData(&total_pages, ¤t_page, Channels.size(), items_count, selected);
paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, body_height, total_pages, current_page);
}
void <API key>::paintHead()
{
CBEGlobals::paintHead(caption + (mode == CZapitClient::MODE_TV ? " - TV" : " - Radio"),
mode == CZapitClient::MODE_TV ? NEUTRINO_ICON_VIDEO : NEUTRINO_ICON_AUDIO);
}
struct button_label <API key>[] =
{
{ <API key>, <API key> },
{ <API key>, <API key> },
{ <API key>, <API key> }
};
void <API key>::paintFoot()
{
switch (<API key>)
{
case SORT_FREQ:
{
<API key>[0].locale = <API key>;
break;
}
case SORT_SAT:
{
<API key>[0].locale = <API key>;
break;
}
case SORT_CH_NUMBER:
{
<API key>[0].locale = <API key>;
break;
}
case SORT_ALPHA:
default:
{
<API key>[0].locale = <API key>;
break;
}
}
const short numbuttons = sizeof(<API key>)/sizeof(<API key>[0]);
CBEGlobals::paintFoot(numbuttons, <API key>);
}
std::string <API key>::getInfoText(int index)
{
std::string res = "";
if (Channels.empty())
return res;
std::string satname = CServiceManager::getInstance()->GetSatelliteName(Channels[index]-><API key>());
if (IS_WEBCHAN(Channels[index]->getChannelID()))
satname = "Web-Channel"; // TODO split into WebTV/WebRadio
transponder t;
CServiceManager::getInstance()->GetTransponder(Channels[index]->getTransponderId(), t);
std::string desc = t.description();
if (Channels[index]->pname)
{
if (desc.empty())
desc = std::string(Channels[index]->pname);
else
desc += " (" + std::string(Channels[index]->pname) + ")";
}
if (!Channels[index]->getDesc().empty())
desc += "\n" + Channels[index]->getDesc();
res = satname + " - " + desc;
return res;
}
void <API key>::updateSelection(unsigned int newpos)
{
if (newpos == selected || newpos == (unsigned int)-1)
return;
unsigned int prev_selected = selected;
selected = newpos;
unsigned int oldliststart = liststart;
liststart = (selected/items_count)*items_count;
if (oldliststart != liststart)
{
paintItems();
}
else
{
paintItem(prev_selected - liststart);
paintItem(selected - liststart);
}
}
int <API key>::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
{
neutrino_msg_t msg;
neutrino_msg_data_t data;
int res = menu_return::RETURN_REPAINT;
selected = 0;
if (parent)
parent->hide();
bouquetChannels = mode == CZapitClient::MODE_TV ? &(bouquet->tvChannels) : &(bouquet->radioChannels);
Channels.clear();
if (mode == CZapitClient::MODE_RADIO)
CServiceManager::getInstance()->GetAllRadioChannels(Channels);
else
CServiceManager::getInstance()->GetAllTvChannels(Channels);
sort(Channels.begin(), Channels.end(), CmpChannelByChName());
paintHead();
paintBody();
paintFoot();
paintItems();
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr);
channelChanged = false;
bool loop = true;
while (loop)
{
g_RCInput-><API key>(&msg, &data, &timeoutEnd);
if (msg <= CRCInput::RC_MaxRC)
timeoutEnd = CRCInput::calcTimeoutEnd(*timeout_ptr);
if ((msg == CRCInput::RC_timeout) || (msg == CRCInput::RC_home))
{
loop = false;
}
else if (msg == CRCInput::RC_up || msg == (neutrino_msg_t)g_settings.key_pageup ||
msg == CRCInput::RC_down || msg == (neutrino_msg_t)g_settings.key_pagedown)
{
int new_selected = UpDownKey(Channels, msg, items_count, selected);
updateSelection(new_selected);
}
else if (msg == (neutrino_msg_t) g_settings.key_list_start || msg == (neutrino_msg_t) g_settings.key_list_end)
{
if (!Channels.empty())
{
int new_selected = msg == (neutrino_msg_t) g_settings.key_list_start ? 0 : Channels.size() - 1;
updateSelection(new_selected);
}
}
else if (msg == CRCInput::RC_ok || msg == CRCInput::RC_green)
{
if (selected < Channels.size())
selectChannel();
}
else if (msg == CRCInput::RC_red)
{
if (selected < Channels.size())
sortChannels();
}
else if (CNeutrinoApp::getInstance()->listModeKey(msg))
{
// do nothing
}
else
{
CNeutrinoApp::getInstance()->handleMsg(msg, data);
}
}
hide();
return res;
}
void <API key>::sortChannels()
{
<API key>++;
if (<API key> >= SORT_END)
<API key> = SORT_ALPHA;
switch (<API key>)
{
case SORT_FREQ:
{
sort(Channels.begin(), Channels.end(), CmpChannelByFreq());
break;
}
case SORT_SAT:
{
sort(Channels.begin(), Channels.end(), CmpChannelBySat());
break;
}
case SORT_CH_NUMBER:
{
sort(Channels.begin(), Channels.end(), CmpChannelByChNum());
break;
}
case SORT_ALPHA:
default:
{
sort(Channels.begin(), Channels.end(), CmpChannelByChName());
break;
}
}
paintFoot();
paintItems();
}
void <API key>::selectChannel()
{
channelChanged = true;
if (isChannelInBouquet(selected))
bouquet->removeService(Channels[selected]);
else
bouquet->addService(Channels[selected]);
bouquetChannels = mode == CZapitClient::MODE_TV ? &(bouquet->tvChannels) : &(bouquet->radioChannels);
paintItem(selected - liststart);
g_RCInput->postMsg(CRCInput::RC_down, 0);
}
bool <API key>::isChannelInBouquet(int index)
{
for (unsigned int i=0; i< bouquetChannels->size(); i++)
{
if ((*bouquetChannels)[i]->getChannelID() == Channels[index]->getChannelID())
return true;
}
return false;
}
bool <API key>::hasChanged()
{
return channelChanged;
}
|
#include <linux/err.h>
#include <linux/bug.h>
#include <linux/completion.h>
#include <net/ieee802154.h>
#include <crypto/algapi.h>
#include "mac802154.h"
#include "llsec.h"
static void llsec_key_put(struct mac802154_llsec_key *key);
static bool llsec_key_id_equal(const struct <API key> *a,
const struct <API key> *b);
static void llsec_dev_free(struct <API key> *dev);
void <API key>(struct mac802154_llsec *sec)
{
memset(sec, 0, sizeof(*sec));
memset(&sec->params.default_key_source, 0xFF, IEEE802154_ADDR_LEN);
INIT_LIST_HEAD(&sec->table.security_levels);
INIT_LIST_HEAD(&sec->table.devices);
INIT_LIST_HEAD(&sec->table.keys);
hash_init(sec->devices_short);
hash_init(sec->devices_hw);
rwlock_init(&sec->lock);
}
void <API key>(struct mac802154_llsec *sec)
{
struct <API key> *sl, *sn;
struct <API key> *dev, *dn;
struct <API key> *key, *kn;
<API key>(sl, sn, &sec->table.security_levels, list) {
struct <API key> *msl;
msl = container_of(sl, struct <API key>, level);
list_del(&sl->list);
kfree(msl);
}
<API key>(dev, dn, &sec->table.devices, list) {
struct <API key> *mdev;
mdev = container_of(dev, struct <API key>, dev);
list_del(&dev->list);
llsec_dev_free(mdev);
}
<API key>(key, kn, &sec->table.keys, list) {
struct mac802154_llsec_key *mkey;
mkey = container_of(key->key, struct mac802154_llsec_key, key);
list_del(&key->list);
llsec_key_put(mkey);
kfree(key);
}
}
int <API key>(struct mac802154_llsec *sec,
struct <API key> *params)
{
read_lock_bh(&sec->lock);
*params = sec->params;
read_unlock_bh(&sec->lock);
return 0;
}
int <API key>(struct mac802154_llsec *sec,
const struct <API key> *params,
int changed)
{
write_lock_bh(&sec->lock);
if (changed & <API key>)
sec->params.enabled = params->enabled;
if (changed & <API key>)
sec->params.frame_counter = params->frame_counter;
if (changed & <API key>)
sec->params.out_level = params->out_level;
if (changed & <API key>)
sec->params.out_key = params->out_key;
if (changed & <API key>)
sec->params.default_key_source = params->default_key_source;
if (changed & <API key>)
sec->params.pan_id = params->pan_id;
if (changed & <API key>)
sec->params.hwaddr = params->hwaddr;
if (changed & <API key>)
sec->params.coord_hwaddr = params->coord_hwaddr;
if (changed & <API key>)
sec->params.coord_shortaddr = params->coord_shortaddr;
write_unlock_bh(&sec->lock);
return 0;
}
static struct mac802154_llsec_key*
llsec_key_alloc(const struct <API key> *template)
{
const int authsizes[3] = { 4, 8, 16 };
struct mac802154_llsec_key *key;
int i;
key = kzalloc(sizeof(*key), GFP_KERNEL);
if (!key)
return NULL;
kref_init(&key->ref);
key->key = *template;
BUILD_BUG_ON(ARRAY_SIZE(authsizes) != ARRAY_SIZE(key->tfm));
for (i = 0; i < ARRAY_SIZE(key->tfm); i++) {
key->tfm[i] = crypto_alloc_aead("ccm(aes)", 0,
CRYPTO_ALG_ASYNC);
if (!key->tfm[i])
goto err_tfm;
if (crypto_aead_setkey(key->tfm[i], template->key,
<API key>))
goto err_tfm;
if (<API key>(key->tfm[i], authsizes[i]))
goto err_tfm;
}
key->tfm0 = <API key>("ctr(aes)", 0, CRYPTO_ALG_ASYNC);
if (!key->tfm0)
goto err_tfm;
if (<API key>(key->tfm0, template->key,
<API key>))
goto err_tfm0;
return key;
err_tfm0:
<API key>(key->tfm0);
err_tfm:
for (i = 0; i < ARRAY_SIZE(key->tfm); i++)
if (key->tfm[i])
crypto_free_aead(key->tfm[i]);
kfree(key);
return NULL;
}
static void llsec_key_release(struct kref *ref)
{
struct mac802154_llsec_key *key;
int i;
key = container_of(ref, struct mac802154_llsec_key, ref);
for (i = 0; i < ARRAY_SIZE(key->tfm); i++)
crypto_free_aead(key->tfm[i]);
<API key>(key->tfm0);
kfree(key);
}
static struct mac802154_llsec_key*
llsec_key_get(struct mac802154_llsec_key *key)
{
kref_get(&key->ref);
return key;
}
static void llsec_key_put(struct mac802154_llsec_key *key)
{
kref_put(&key->ref, llsec_key_release);
}
static bool llsec_key_id_equal(const struct <API key> *a,
const struct <API key> *b)
{
if (a->mode != b->mode)
return false;
if (a->mode == <API key>)
return <API key>(&a->device_addr, &b->device_addr);
if (a->id != b->id)
return false;
switch (a->mode) {
case <API key>:
return true;
case <API key>:
return a->short_source == b->short_source;
case <API key>:
return a->extended_source == b->extended_source;
}
return false;
}
int <API key>(struct mac802154_llsec *sec,
const struct <API key> *id,
const struct <API key> *key)
{
struct mac802154_llsec_key *mkey = NULL;
struct <API key> *pos, *new;
if (!(key->frame_types & (1 << <API key>)) &&
key->cmd_frame_ids)
return -EINVAL;
list_for_each_entry(pos, &sec->table.keys, list) {
if (llsec_key_id_equal(&pos->id, id))
return -EEXIST;
if (memcmp(pos->key->key, key->key,
<API key>))
continue;
mkey = container_of(pos->key, struct mac802154_llsec_key, key);
/* Don't allow multiple instances of the same AES key to have
* different allowed frame types/command frame ids, as this is
* not possible in the 802.15.4 PIB.
*/
if (pos->key->frame_types != key->frame_types ||
pos->key->cmd_frame_ids != key->cmd_frame_ids)
return -EEXIST;
break;
}
new = kzalloc(sizeof(*new), GFP_KERNEL);
if (!new)
return -ENOMEM;
if (!mkey)
mkey = llsec_key_alloc(key);
else
mkey = llsec_key_get(mkey);
if (!mkey)
goto fail;
new->id = *id;
new->key = &mkey->key;
list_add_rcu(&new->list, &sec->table.keys);
return 0;
fail:
kfree(new);
return -ENOMEM;
}
int <API key>(struct mac802154_llsec *sec,
const struct <API key> *key)
{
struct <API key> *pos;
list_for_each_entry(pos, &sec->table.keys, list) {
struct mac802154_llsec_key *mkey;
mkey = container_of(pos->key, struct mac802154_llsec_key, key);
if (llsec_key_id_equal(&pos->id, key)) {
list_del_rcu(&pos->list);
llsec_key_put(mkey);
return 0;
}
}
return -ENOENT;
}
static bool <API key>(__le16 short_addr)
{
return short_addr != cpu_to_le16(<API key>) &&
short_addr != cpu_to_le16(0xffff);
}
static u32 <API key>(__le16 short_addr, __le16 pan_id)
{
return ((__force u16) short_addr) << 16 | (__force u16) pan_id;
}
static u64 llsec_dev_hash_long(__le64 hwaddr)
{
return (__force u64) hwaddr;
}
static struct <API key>*
<API key>(struct mac802154_llsec *sec, __le16 short_addr,
__le16 pan_id)
{
struct <API key> *dev;
u32 key = <API key>(short_addr, pan_id);
<API key>(sec->devices_short, dev, bucket_s, key) {
if (dev->dev.short_addr == short_addr &&
dev->dev.pan_id == pan_id)
return dev;
}
return NULL;
}
static struct <API key>*
llsec_dev_find_long(struct mac802154_llsec *sec, __le64 hwaddr)
{
struct <API key> *dev;
u64 key = llsec_dev_hash_long(hwaddr);
<API key>(sec->devices_hw, dev, bucket_hw, key) {
if (dev->dev.hwaddr == hwaddr)
return dev;
}
return NULL;
}
static void llsec_dev_free(struct <API key> *dev)
{
struct <API key> *pos, *pn;
struct <API key> *devkey;
<API key>(pos, pn, &dev->dev.keys, list) {
devkey = container_of(pos, struct <API key>,
devkey);
list_del(&pos->list);
kfree(devkey);
}
kfree(dev);
}
int <API key>(struct mac802154_llsec *sec,
const struct <API key> *dev)
{
struct <API key> *entry;
u32 skey = <API key>(dev->short_addr, dev->pan_id);
u64 hwkey = llsec_dev_hash_long(dev->hwaddr);
BUILD_BUG_ON(sizeof(hwkey) != IEEE802154_ADDR_LEN);
if ((<API key>(dev->short_addr) &&
<API key>(sec, dev->short_addr, dev->pan_id)) ||
llsec_dev_find_long(sec, dev->hwaddr))
return -EEXIST;
entry = kmalloc(sizeof(*entry), GFP_KERNEL);
if (!entry)
return -ENOMEM;
entry->dev = *dev;
spin_lock_init(&entry->lock);
INIT_LIST_HEAD(&entry->dev.keys);
if (<API key>(dev->short_addr))
hash_add_rcu(sec->devices_short, &entry->bucket_s, skey);
else
INIT_HLIST_NODE(&entry->bucket_s);
hash_add_rcu(sec->devices_hw, &entry->bucket_hw, hwkey);
list_add_tail_rcu(&entry->dev.list, &sec->table.devices);
return 0;
}
static void llsec_dev_free_rcu(struct rcu_head *rcu)
{
llsec_dev_free(container_of(rcu, struct <API key>, rcu));
}
int <API key>(struct mac802154_llsec *sec, __le64 device_addr)
{
struct <API key> *pos;
pos = llsec_dev_find_long(sec, device_addr);
if (!pos)
return -ENOENT;
hash_del_rcu(&pos->bucket_s);
hash_del_rcu(&pos->bucket_hw);
call_rcu(&pos->rcu, llsec_dev_free_rcu);
return 0;
}
static struct <API key>*
llsec_devkey_find(struct <API key> *dev,
const struct <API key> *key)
{
struct <API key> *devkey;
<API key>(devkey, &dev->dev.keys, list) {
if (!llsec_key_id_equal(key, &devkey->key_id))
continue;
return container_of(devkey, struct <API key>,
devkey);
}
return NULL;
}
int <API key>(struct mac802154_llsec *sec,
__le64 dev_addr,
const struct <API key> *key)
{
struct <API key> *dev;
struct <API key> *devkey;
dev = llsec_dev_find_long(sec, dev_addr);
if (!dev)
return -ENOENT;
if (llsec_devkey_find(dev, &key->key_id))
return -EEXIST;
devkey = kmalloc(sizeof(*devkey), GFP_KERNEL);
if (!devkey)
return -ENOMEM;
devkey->devkey = *key;
list_add_tail_rcu(&devkey->devkey.list, &dev->dev.keys);
return 0;
}
int <API key>(struct mac802154_llsec *sec,
__le64 dev_addr,
const struct <API key> *key)
{
struct <API key> *dev;
struct <API key> *devkey;
dev = llsec_dev_find_long(sec, dev_addr);
if (!dev)
return -ENOENT;
devkey = llsec_devkey_find(dev, &key->key_id);
if (!devkey)
return -ENOENT;
list_del_rcu(&devkey->devkey.list);
kfree_rcu(devkey, rcu);
return 0;
}
static struct <API key>*
llsec_find_seclevel(const struct mac802154_llsec *sec,
const struct <API key> *sl)
{
struct <API key> *pos;
list_for_each_entry(pos, &sec->table.security_levels, list) {
if (pos->frame_type != sl->frame_type ||
(pos->frame_type == <API key> &&
pos->cmd_frame_id != sl->cmd_frame_id) ||
pos->device_override != sl->device_override ||
pos->sec_levels != sl->sec_levels)
continue;
return container_of(pos, struct <API key>,
level);
}
return NULL;
}
int <API key>(struct mac802154_llsec *sec,
const struct <API key> *sl)
{
struct <API key> *entry;
if (llsec_find_seclevel(sec, sl))
return -EEXIST;
entry = kmalloc(sizeof(*entry), GFP_KERNEL);
if (!entry)
return -ENOMEM;
entry->level = *sl;
list_add_tail_rcu(&entry->level.list, &sec->table.security_levels);
return 0;
}
int <API key>(struct mac802154_llsec *sec,
const struct <API key> *sl)
{
struct <API key> *pos;
pos = llsec_find_seclevel(sec, sl);
if (!pos)
return -ENOENT;
list_del_rcu(&pos->level.list);
kfree_rcu(pos, rcu);
return 0;
}
static int llsec_recover_addr(struct mac802154_llsec *sec,
struct ieee802154_addr *addr)
{
__le16 caddr = sec->params.coord_shortaddr;
addr->pan_id = sec->params.pan_id;
if (caddr == cpu_to_le16(<API key>)) {
return -EINVAL;
} else if (caddr == cpu_to_le16(<API key>)) {
addr->extended_addr = sec->params.coord_hwaddr;
addr->mode = <API key>;
} else {
addr->short_addr = sec->params.coord_shortaddr;
addr->mode = <API key>;
}
return 0;
}
static struct mac802154_llsec_key*
llsec_lookup_key(struct mac802154_llsec *sec,
const struct ieee802154_hdr *hdr,
const struct ieee802154_addr *addr,
struct <API key> *key_id)
{
struct ieee802154_addr devaddr = *addr;
u8 key_id_mode = hdr->sec.key_id_mode;
struct <API key> *key_entry;
struct mac802154_llsec_key *key;
if (key_id_mode == <API key> &&
devaddr.mode == <API key>) {
if (hdr->fc.type == <API key>) {
devaddr.extended_addr = sec->params.coord_hwaddr;
devaddr.mode = <API key>;
} else if (llsec_recover_addr(sec, &devaddr) < 0) {
return NULL;
}
}
<API key>(key_entry, &sec->table.keys, list) {
const struct <API key> *id = &key_entry->id;
if (!(key_entry->key->frame_types & BIT(hdr->fc.type)))
continue;
if (id->mode != key_id_mode)
continue;
if (key_id_mode == <API key>) {
if (<API key>(&devaddr, &id->device_addr))
goto found;
} else {
if (id->id != hdr->sec.key_id)
continue;
if ((key_id_mode == <API key>) ||
(key_id_mode == <API key> &&
id->short_source == hdr->sec.short_src) ||
(key_id_mode == <API key> &&
id->extended_source == hdr->sec.extended_src))
goto found;
}
}
return NULL;
found:
key = container_of(key_entry->key, struct mac802154_llsec_key, key);
if (key_id)
*key_id = key_entry->id;
return llsec_key_get(key);
}
static void llsec_geniv(u8 iv[16], __le64 addr,
const struct ieee802154_sechdr *sec)
{
__be64 addr_bytes = (__force __be64) swab64((__force u64) addr);
__be32 frame_counter = (__force __be32) swab32((__force u32) sec->frame_counter);
iv[0] = 1; /* L' = L - 1 = 1 */
memcpy(iv + 1, &addr_bytes, sizeof(addr_bytes));
memcpy(iv + 9, &frame_counter, sizeof(frame_counter));
iv[13] = sec->level;
iv[14] = 0;
iv[15] = 1;
}
static int
<API key>(struct sk_buff *skb, const struct mac802154_llsec *sec,
const struct ieee802154_hdr *hdr,
struct mac802154_llsec_key *key)
{
u8 iv[16];
struct scatterlist src;
struct blkcipher_desc req = {
.tfm = key->tfm0,
.info = iv,
.flags = 0,
};
llsec_geniv(iv, sec->params.hwaddr, &hdr->sec);
sg_init_one(&src, skb->data, skb->len);
return <API key>(&req, &src, &src, skb->len);
}
static struct crypto_aead*
llsec_tfm_by_len(struct mac802154_llsec_key *key, int authlen)
{
int i;
for (i = 0; i < ARRAY_SIZE(key->tfm); i++)
if (<API key>(key->tfm[i]) == authlen)
return key->tfm[i];
BUG();
}
static int
<API key>(struct sk_buff *skb, const struct mac802154_llsec *sec,
const struct ieee802154_hdr *hdr,
struct mac802154_llsec_key *key)
{
u8 iv[16];
unsigned char *data;
int authlen, assoclen, datalen, rc;
struct scatterlist src, assoc[2], dst[2];
struct aead_request *req;
authlen = <API key>(&hdr->sec);
llsec_geniv(iv, sec->params.hwaddr, &hdr->sec);
req = aead_request_alloc(llsec_tfm_by_len(key, authlen), GFP_ATOMIC);
if (!req)
return -ENOMEM;
sg_init_table(assoc, 2);
sg_set_buf(&assoc[0], skb_mac_header(skb), skb->mac_len);
assoclen = skb->mac_len;
data = skb_mac_header(skb) + skb->mac_len;
datalen = skb_tail_pointer(skb) - data;
if (hdr->sec.level & <API key>) {
sg_set_buf(&assoc[1], data, 0);
} else {
sg_set_buf(&assoc[1], data, datalen);
assoclen += datalen;
datalen = 0;
}
sg_init_one(&src, data, datalen);
sg_init_table(dst, 2);
sg_set_buf(&dst[0], data, datalen);
sg_set_buf(&dst[1], skb_put(skb, authlen), authlen);
<API key>(req, 0, NULL, NULL);
<API key>(req, assoc, assoclen);
<API key>(req, &src, dst, datalen, iv);
rc = crypto_aead_encrypt(req);
kfree(req);
return rc;
}
static int llsec_do_encrypt(struct sk_buff *skb,
const struct mac802154_llsec *sec,
const struct ieee802154_hdr *hdr,
struct mac802154_llsec_key *key)
{
if (hdr->sec.level == <API key>)
return <API key>(skb, sec, hdr, key);
else
return <API key>(skb, sec, hdr, key);
}
int <API key>(struct mac802154_llsec *sec, struct sk_buff *skb)
{
struct ieee802154_hdr hdr;
int rc, authlen, hlen;
struct mac802154_llsec_key *key;
u32 frame_ctr;
hlen = ieee802154_hdr_pull(skb, &hdr);
if (hlen < 0 || hdr.fc.type != <API key>)
return -EINVAL;
if (!hdr.fc.security_enabled || hdr.sec.level == 0) {
skb_push(skb, hlen);
return 0;
}
authlen = <API key>(&hdr.sec);
if (skb->len + hlen + authlen + IEEE802154_MFR_SIZE > IEEE802154_MTU)
return -EMSGSIZE;
rcu_read_lock();
read_lock_bh(&sec->lock);
if (!sec->params.enabled) {
rc = -EINVAL;
goto fail_read;
}
key = llsec_lookup_key(sec, &hdr, &hdr.dest, NULL);
if (!key) {
rc = -ENOKEY;
goto fail_read;
}
read_unlock_bh(&sec->lock);
write_lock_bh(&sec->lock);
frame_ctr = be32_to_cpu(sec->params.frame_counter);
hdr.sec.frame_counter = cpu_to_le32(frame_ctr);
if (frame_ctr == 0xFFFFFFFF) {
write_unlock_bh(&sec->lock);
llsec_key_put(key);
rc = -EOVERFLOW;
goto fail;
}
sec->params.frame_counter = cpu_to_be32(frame_ctr + 1);
write_unlock_bh(&sec->lock);
rcu_read_unlock();
skb->mac_len = ieee802154_hdr_push(skb, &hdr);
<API key>(skb);
rc = llsec_do_encrypt(skb, sec, &hdr, key);
llsec_key_put(key);
return rc;
fail_read:
read_unlock_bh(&sec->lock);
fail:
rcu_read_unlock();
return rc;
}
static struct <API key>*
llsec_lookup_dev(struct mac802154_llsec *sec,
const struct ieee802154_addr *addr)
{
struct ieee802154_addr devaddr = *addr;
struct <API key> *dev = NULL;
if (devaddr.mode == <API key> &&
llsec_recover_addr(sec, &devaddr) < 0)
return NULL;
if (devaddr.mode == <API key>) {
u32 key = <API key>(devaddr.short_addr,
devaddr.pan_id);
<API key>(sec->devices_short, dev,
bucket_s, key) {
if (dev->dev.pan_id == devaddr.pan_id &&
dev->dev.short_addr == devaddr.short_addr)
return dev;
}
} else {
u64 key = llsec_dev_hash_long(devaddr.extended_addr);
<API key>(sec->devices_hw, dev,
bucket_hw, key) {
if (dev->dev.hwaddr == devaddr.extended_addr)
return dev;
}
}
return NULL;
}
static int
<API key>(const struct mac802154_llsec *sec,
u8 frame_type, u8 cmd_frame_id,
struct <API key> *rlevel)
{
struct <API key> *level;
<API key>(level, &sec->table.security_levels, list) {
if (level->frame_type == frame_type &&
(frame_type != <API key> ||
level->cmd_frame_id == cmd_frame_id)) {
*rlevel = *level;
return 0;
}
}
return -EINVAL;
}
static int
<API key>(struct sk_buff *skb, const struct mac802154_llsec *sec,
const struct ieee802154_hdr *hdr,
struct mac802154_llsec_key *key, __le64 dev_addr)
{
u8 iv[16];
unsigned char *data;
int datalen;
struct scatterlist src;
struct blkcipher_desc req = {
.tfm = key->tfm0,
.info = iv,
.flags = 0,
};
llsec_geniv(iv, dev_addr, &hdr->sec);
data = skb_mac_header(skb) + skb->mac_len;
datalen = skb_tail_pointer(skb) - data;
sg_init_one(&src, data, datalen);
return <API key>(&req, &src, &src, datalen);
}
static int
<API key>(struct sk_buff *skb, const struct mac802154_llsec *sec,
const struct ieee802154_hdr *hdr,
struct mac802154_llsec_key *key, __le64 dev_addr)
{
u8 iv[16];
unsigned char *data;
int authlen, datalen, assoclen, rc;
struct scatterlist src, assoc[2];
struct aead_request *req;
authlen = <API key>(&hdr->sec);
llsec_geniv(iv, dev_addr, &hdr->sec);
req = aead_request_alloc(llsec_tfm_by_len(key, authlen), GFP_ATOMIC);
if (!req)
return -ENOMEM;
sg_init_table(assoc, 2);
sg_set_buf(&assoc[0], skb_mac_header(skb), skb->mac_len);
assoclen = skb->mac_len;
data = skb_mac_header(skb) + skb->mac_len;
datalen = skb_tail_pointer(skb) - data;
if (hdr->sec.level & <API key>) {
sg_set_buf(&assoc[1], data, 0);
} else {
sg_set_buf(&assoc[1], data, datalen - authlen);
assoclen += datalen - authlen;
data += datalen - authlen;
datalen = authlen;
}
sg_init_one(&src, data, datalen);
<API key>(req, 0, NULL, NULL);
<API key>(req, assoc, assoclen);
<API key>(req, &src, &src, datalen, iv);
rc = crypto_aead_decrypt(req);
kfree(req);
skb_trim(skb, skb->len - authlen);
return rc;
}
static int
llsec_do_decrypt(struct sk_buff *skb, const struct mac802154_llsec *sec,
const struct ieee802154_hdr *hdr,
struct mac802154_llsec_key *key, __le64 dev_addr)
{
if (hdr->sec.level == <API key>)
return <API key>(skb, sec, hdr, key, dev_addr);
else
return <API key>(skb, sec, hdr, key, dev_addr);
}
static int
<API key>(struct <API key> *dev,
const struct <API key> *in_key,
u32 frame_counter)
{
struct <API key> *devkey = NULL;
if (dev->dev.key_mode == <API key>) {
devkey = llsec_devkey_find(dev, in_key);
if (!devkey)
return -ENOENT;
}
spin_lock_bh(&dev->lock);
if ((!devkey && frame_counter < dev->dev.frame_counter) ||
(devkey && frame_counter < devkey->devkey.frame_counter)) {
spin_unlock_bh(&dev->lock);
return -EINVAL;
}
if (devkey)
devkey->devkey.frame_counter = frame_counter + 1;
else
dev->dev.frame_counter = frame_counter + 1;
spin_unlock_bh(&dev->lock);
return 0;
}
int <API key>(struct mac802154_llsec *sec, struct sk_buff *skb)
{
struct ieee802154_hdr hdr;
struct mac802154_llsec_key *key;
struct <API key> key_id;
struct <API key> *dev;
struct <API key> seclevel;
int err;
__le64 dev_addr;
u32 frame_ctr;
if (ieee802154_hdr_peek(skb, &hdr) < 0)
return -EINVAL;
if (!hdr.fc.security_enabled)
return 0;
if (hdr.fc.version == 0)
return -EINVAL;
read_lock_bh(&sec->lock);
if (!sec->params.enabled) {
read_unlock_bh(&sec->lock);
return -EINVAL;
}
read_unlock_bh(&sec->lock);
rcu_read_lock();
key = llsec_lookup_key(sec, &hdr, &hdr.source, &key_id);
if (!key) {
err = -ENOKEY;
goto fail;
}
dev = llsec_lookup_dev(sec, &hdr.source);
if (!dev) {
err = -EINVAL;
goto fail_dev;
}
if (<API key>(sec, hdr.fc.type, 0, &seclevel) < 0) {
err = -EINVAL;
goto fail_dev;
}
if (!(seclevel.sec_levels & BIT(hdr.sec.level)) &&
(hdr.sec.level == 0 && seclevel.device_override &&
!dev->dev.seclevel_exempt)) {
err = -EINVAL;
goto fail_dev;
}
frame_ctr = le32_to_cpu(hdr.sec.frame_counter);
if (frame_ctr == 0xffffffff) {
err = -EOVERFLOW;
goto fail_dev;
}
err = <API key>(dev, &key_id, frame_ctr);
if (err)
goto fail_dev;
dev_addr = dev->dev.hwaddr;
rcu_read_unlock();
err = llsec_do_decrypt(skb, sec, &hdr, key, dev_addr);
llsec_key_put(key);
return err;
fail_dev:
llsec_key_put(key);
fail:
rcu_read_unlock();
return err;
}
|
vti_encoding:SR|utf8-nl
<API key>:TR|08 Nov 2012 23:29:31 -0000
vti_extenderversion:SR|5.0.2.6790
vti_lineageid:SR|{<API key>}
vti_cacheddtm:TX|08 Nov 2012 23:29:31 -0000
vti_filesize:IR|2149
vti_backlinkinfo:VX|
|
# gonads
A Go-style CSP channel implementation for Haskell Monads.
Get it?
|
package org.janelia.alignment.match;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* List of {@link CanvasMatches} with associated tileIds mapped for fast lookup.
*
* @author Eric Trautman
*/
public class TileIdsWithMatches {
private final Set<String> tileIds;
private final List<CanvasMatches> canvasMatchesList;
public TileIdsWithMatches() {
this.canvasMatchesList = new ArrayList<>();
this.tileIds = new HashSet<>();
}
/**
*
* @param canvasMatchesList list of matches for section (could include tiles not in stack).
* @param stackTileIds set of tile ids in stack.
* To be kept, match pair must have both tiles in stack.
*/
public void addMatches(final List<CanvasMatches> canvasMatchesList,
final Set<String> stackTileIds) {
for (final CanvasMatches canvasMatches : canvasMatchesList) {
final String pId = canvasMatches.getpId();
final String qId = canvasMatches.getqId();
if (stackTileIds.contains(pId) && stackTileIds.contains(qId)) {
this.canvasMatchesList.add(canvasMatches);
this.tileIds.add(pId);
this.tileIds.add(qId);
}
}
}
public boolean contains(final String tileId) {
return tileIds.contains(tileId);
}
public List<CanvasMatches> <API key>() {
return canvasMatchesList;
}
}
|
#include "pin.H"
#include <stdio.h>
#include <cassert>
#include <cstring>
#include <cmath>
#include <unistd.h>
#include "dist.cpp"
// Consistency checks?
#define DEBUG 0
// 2: Huge amount of debug output, 1: checks, 0: silent
#define VERBOSE 0
// uses INS_IsStackRead/Write: misleading with -fomit-frame-pointer
#define IGNORE_STACK 1
// collect addresses in chunk buffer before? (always worse)
#define MERGE_CHUNK 0
#define CHUNKSIZE 4096
// must be a power-of-two
#define MEMBLOCKLEN 64
unsigned long stackAccesses;
unsigned long ignoredReads, ignoredWrites;
/* Command line options */
KNOB<int> KnobMinDist(KNOB_MODE_WRITEONCE, "pintool",
"m", "4096", "minimum bucket distance");
KNOB<int> KnobDoubleSteps(KNOB_MODE_WRITEONCE, "pintool",
"s", "1", "number of buckets for doubling distance");
KNOB<bool> KnobPIDPrefix(KNOB_MODE_WRITEONCE, "pintool",
"p", "0", "prepend output by --PID
/* Handle Memory block access (aligned at multiple of MEMBLOCKLEN) */
#if MERGE_CHUNK
void accessMerging(Addr a)
{
static Addr mergeBuffer[CHUNKSIZE];
static int ptr = 0;
if (ptr < CHUNKSIZE) {
mergeBuffer[ptr++] = a;
return;
}
sort(mergeBuffer,mergeBuffer+CHUNKSIZE);
for(ptr=0; ptr<CHUNKSIZE; ptr++) {
RD_accessBlock(mergeBuffer[ptr]);
}
ptr = 0;
}
#define RD_accessBlock accessMerging
#endif
/* Direct Callbacks */
void memAccess(ADDRINT addr, UINT32 size)
{
Addr a1 = (void*) (addr & ~(MEMBLOCKLEN-1));
Addr a2 = (void*) ((addr+size-1) & ~(MEMBLOCKLEN-1));
if (a1 == a2) {
if (VERBOSE >1)
fprintf(stderr," => %p\n", a1);
RD_accessBlock(a1);
}
else {
if (VERBOSE >1)
fprintf(stderr," => CROSS %p/%p\n", a1, a2);
RD_accessBlock(a1);
RD_accessBlock(a2);
}
}
VOID memRead(THREADID t, ADDRINT addr, UINT32 size)
{
if (t > 0) {
// we are NOT thread-safe, ignore access
ignoredReads++;
return;
}
if (VERBOSE >1)
fprintf(stderr,"R %p/%d", (void*)addr, size);
memAccess(addr, size);
}
VOID memWrite(THREADID t, ADDRINT addr, UINT32 size)
{
if (t > 0) {
// we are NOT thread-safe, ignore access
ignoredWrites++;
return;
}
if (VERBOSE >1)
fprintf(stderr,"W %p/%d", (void*)addr, size);
memAccess(addr, size);
}
VOID stackAccess()
{
stackAccesses++;
}
/* Instrumentation */
VOID Instruction(INS ins, VOID* v)
{
if (IGNORE_STACK && (INS_IsStackRead(ins) || INS_IsStackWrite(ins))) {
<API key>( ins, IPOINT_BEFORE, (AFUNPTR)stackAccess,
IARG_END);
return;
}
UINT32 memOperands = <API key>(ins);
for (UINT32 memOp = 0; memOp < memOperands; memOp++) {
if (<API key>(ins, memOp))
<API key>( ins, IPOINT_BEFORE, (AFUNPTR)memRead,
IARG_THREAD_ID,
IARG_MEMORYOP_EA, memOp,
IARG_UINT32, <API key>(ins, memOp),
IARG_END);
if (<API key>(ins, memOp))
<API key>( ins, IPOINT_BEFORE, (AFUNPTR)memWrite,
IARG_THREAD_ID,
IARG_MEMORYOP_EA, memOp,
IARG_UINT32, <API key>(ins, memOp),
IARG_END);
}
}
/* Callbacks from Pin */
VOID ThreadStart(THREADID t, CONTEXT *ctxt, INT32 flags, VOID *v)
{
fprintf(stderr, "Thread %d started\n", t);
}
/* Output results at exit */
VOID Exit(INT32 code, VOID *v)
{
char pStr[20];
if (KnobPIDPrefix.Value())
sprintf(pStr, "--%5d-- ", getpid());
else
pStr[0] = 0;
RD_printHistogram(stderr, pStr, MEMBLOCKLEN);
fprintf(stderr,
"%s ignored stack accesses: %lu\n",
pStr, stackAccesses);
fprintf(stderr,
"%s ignored accesses by thread != 0: %lu reads, %lu writes\n",
pStr, ignoredReads, ignoredWrites);
}
/* Usage/Main Function of the Pin Tool */
INT32 Usage()
{
PIN_ERROR( "PinDist: Get the Stack Reuse Distance Histogram\n"
+ KNOB_BASE::StringKnobSummary() + "\n");
return -1;
}
int main (int argc, char *argv[])
{
if (PIN_Init(argc, argv)) return Usage();
// add buckets [0-1023], [1K - 2K-1], ... [1G - ]
double d = KnobMinDist.Value();
int s = KnobDoubleSteps.Value();
double f = pow(2, 1.0/s);
RD_init((int)(d / MEMBLOCKLEN));
for(d*=f; d< 1024*1024*1024; d*=f)
RD_addBucket((int)(d / MEMBLOCKLEN));
stackAccesses = 0;
PIN_InitSymbols();
<API key>(Instruction, 0);
PIN_AddFiniFunction(Exit, 0);
<API key>(ThreadStart, 0);
PIN_StartProgram();
return 0;
}
|
import { createSelector } from '@automattic/state-utils';
import { filter, orderBy } from 'lodash';
import 'calypso/state/comments/init';
function <API key>( comments, status ) {
return 'all' === status
? filter(
comments,
( comment ) => 'approved' === comment.status || 'unapproved' === comment.status
)
: filter( comments, ( comment ) => status === comment.status );
}
/**
* Returns list of loaded comments for a given site, filtered by status
*
* @param {object} state Redux state
* @param {number} siteId Site for whose comments to find
* @param {string} [status] Status to filter comments
* @param {string} [order=asc] Order in which to sort filtered comments
* @returns {Array<object>} Available comments for site, filtered by status
*/
export const getSiteComments = createSelector(
( state, siteId, status, order = 'asc' ) => {
const comments = state.comments.items ?? {};
const parsedComments = Object.keys( comments )
.filter( ( key ) => parseInt( key.split( '-', 1 ), 10 ) === siteId )
.reduce( ( list, key ) => [ ...list, ...comments[ key ] ], [] );
return status
? orderBy( <API key>( parsedComments, status ), 'date', order )
: orderBy( parsedComments, 'date', order );
},
( state ) => [ state.comments.items ]
);
|
(function(customer_id) {
tinymce.create('tinymce.plugins.<API key>', {
customer_id: customer_id,
init : function(editor, plugin_url) {
editor.addButton('player_scheduling', {
title : 'Embed ItStream Player',
cmd : 'itm_scheduling',
image : plugin_url + '/scheduling.gif'
});
// Register a new TinyMCE command
editor.addCommand('itm_scheduling', this.<API key>, {
editor: editor,
plugin: editor.plugins.<API key>
});
},
createControl : function(n, cm) {
return null;
},
getInfo : function() {
return {
longname : 'ItStream Scheduling Button',
author : 'It-Marketing',
authorurl : 'http:
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',
version : "0.1"
};
},
wm_close_event: function() {
// Restore scrolling for the main content window when the attach to post interface is closed
jQuery('html,body').css('overflow', 'auto');
tinyMCE.activeEditor.selection.select(tinyMCE.activeEditor.dom.select('p')[0]);
tinyMCE.activeEditor.selection.collapse(0);
},
<API key>: function() {
var attach_to_post_url = itstream_ajax.attach_to_post;
if (typeof(customer_id) != 'undefined') {
attach_to_post_url += "?id=" + itstream_ajax.customer_id;
}
var win = window;
while (win.parent != null && win.parent != win) {
win = win.parent;
}
win = jQuery(win);
var winWidth = win.width();
var winHeight = win.height();
var popupWidth = 680;
var popupHeight = 560;
var minWidth = 320;
var minHeight = 200;
var maxWidth = winWidth - (winWidth * 0.05);
var maxHeight = winHeight - (winHeight * 0.05);
if (maxWidth < minWidth) { maxWidth = winWidth - 10; }
if (maxHeight < minHeight) { maxHeight = winHeight - 10; }
if (popupWidth > maxWidth) { popupWidth = maxWidth; }
if (popupHeight > maxHeight) { popupHeight = maxHeight; }
// Open a window
this.editor.windowManager.open({
url: attach_to_post_url,
id: '<API key>',
width: popupWidth,
height: popupHeight,
title: 'ItStream - Embed Player',
inline: 1
/*buttons: [{
text: 'Close',
onclick: 'close'
}]*/
});
// Ensure that the window cannot be scrolled - XXX actually allow scrolling in the main window and disable it for the inner-windows/frames/elements as to create a single scrollbar
jQuery('html,body').css('overflow', 'hidden');
jQuery('#<API key>').css('overflow-y', 'auto');
jQuery('#<API key>').css('overflow-x', 'hidden');
}
});
// Register plugin
tinymce.PluginManager.add( 'itstream', tinymce.plugins.<API key> );
})(itstream_ajax.customer_id);
|
<?php
/* Changelog
* v1.20.0
*
* v1.0.0
* - raised to stable
* v0.1
* - initial release
*/
/**
* Base class for ExtendedEditBar extension
* @package <API key>
* @subpackage ExtendedEditBar
*/
class ExtendedEditBar extends BsExtensionMW {
/**
* Constructor of ExtendedEditBar class
*/
public function __construct() {
wfProfileIn( 'BS::'.__METHOD__ );
// Base settings
$this->mExtensionFile = __FILE__;
$this->mExtensionType = EXTTYPE::OTHER; //SPECIALPAGE/OTHER/VARIABLE/PARSERHOOK
$this->mInfo = array(
EXTINFO::NAME => 'ExtendedEditBar',
EXTINFO::DESCRIPTION => wfMessage( '<API key>' )->escaped(),
EXTINFO::AUTHOR => 'MediaWiki Extension, packaging by Markus Glaser',
EXTINFO::VERSION => 'default',
EXTINFO::STATUS => 'default',
EXTINFO::PACKAGE => 'default',
EXTINFO::URL => 'http:
EXTINFO::DEPS => array( 'bluespice' => '2.22.0' )
);
$this->mExtensionKey = 'MW::ExtendedEditBar';
wfProfileOut('BS::'.__METHOD__ );
}
/**
* Initialization of ExtendedEditBar extension
*/
protected function initExt() {
wfProfileIn( 'BS::'.__METHOD__ );
$this->setHook('<API key>');
wfProfileOut( 'BS::'.__METHOD__ );
}
/**
*
* @global type $wgStylePath
* @global type $wgContLang
* @global type $wgLang
* @global OutputPage $wgOut
* @global type $wgUseTeX
* @global type $wgEnableUploads
* @global type $wgForeignFileRepos
* @param string $toolbar
* @return boolean
*/
public function <API key>( &$toolbar ) {
$this->getOutput()->addModuleStyles( 'ext.bluespice.extendeditbar.styles' );
$this->getOutput()->addModules( 'ext.bluespice.extendeditbar' );
//This is copy-code from EditPage::getEditToolbar(). Sad but neccesary
//until we suppot WikiEditor and this get's obsolete.
global $wgContLang, $wgUseTeX, $wgEnableUploads, $wgForeignFileRepos;
$imagesAvailable = $wgEnableUploads || count( $wgForeignFileRepos );
$sNs = $this->getLanguage()->getNsText( NS_IMAGE );
$sCaption = wfMessage( '<API key>' )->plain();
$sPicture = wfMessage( '<API key>' )->plain();
$sGallery = "{$sNs}:{$sPicture}.jpg|{$sCaption}\n{$sNs}:{$sPicture}.jpg|{$sCaption}";
$sHeader = wfMessage( '<API key>' )->plain();
$sRow = wfMessage( '<API key>' )->plain();
$sCell = wfMessage( '<API key>' )->plain();
$sTable = "! {$sHeader} 1\n! {$sHeader} 2\n! {$sHeader} 3\n|-\n| {$sRow} 1, ".
"{$sCell} 1\n| {$sRow} 1, {$sCell} 2\n| {$sRow} 1, {$sCell} 3\n|-\n|".
" {$sRow} 2, {$sCell} 1\n| {$sRow} 2, {$sCell} 2\n| {$sRow} 2, {$sCell} 3";
$aMWButtonCfgs = array(
'mw-editbutton-bold' => array(
'open' => '\'\'\'',
'close' => '\'\'\'',
'sample' => wfMessage( 'bold_sample' )->text(),
'tip' => wfMessage( 'bold_tip' )->text(),
'key' => 'B'
),
'<API key>' => array(
'open' => '\'\'',
'close' => '\'\'',
'sample' => wfMessage( 'italic_sample' )->text(),
'tip' => wfMessage( 'italic_tip' )->text(),
'key' => 'I'
),
'mw-editbutton-link' => array(
'open' => '[[',
'close' => ']]',
'sample' => wfMessage( 'link_sample' )->text(),
'tip' => wfMessage( 'link_tip' )->text(),
'key' => 'L'
),
'<API key>' => array(
'open' => '[',
'close' => ']',
'sample' => wfMessage( 'extlink_sample' )->text(),
'tip' => wfMessage( 'extlink_tip' )->text(),
'key' => 'X'
),
'<API key>' => array(
'open' => "\n== ",
'close' => " ==\n",
'sample' => wfMessage( 'headline_sample' )->text(),
'tip' => wfMessage( 'headline_tip' )->text(),
'key' => 'H'
),
'mw-editbutton-image' => $imagesAvailable ? array(
'open' => '[[' . $wgContLang->getNsText( NS_FILE ) . ':',
'close' => ']]',
'sample' => wfMessage( 'image_sample' )->text(),
'tip' => wfMessage( 'image_tip' )->text(),
'key' => 'D',
) : false,
'mw-editbutton-media' => $imagesAvailable ? array(
'open' => '[[' . $wgContLang->getNsText( NS_MEDIA ) . ':',
'close' => ']]',
'sample' => wfMessage( 'media_sample' )->text(),
'tip' => wfMessage( 'media_tip' )->text(),
'key' => 'M'
) : false,
'mw-editbutton-math' => $wgUseTeX ? array(
'open' => "<math>",
'close' => "</math>",
'sample' => wfMessage( 'math_sample' )->text(),
'tip' => wfMessage( 'math_tip' )->text(),
'key' => 'C'
) : false,
'<API key>' => array(
'open' => '
'close' => '',
'sample' => '',
'tip' => wfMessage( 'sig_tip' )->text(),
'key' => 'Y'
),
);
$aBSButtonCfgs = array(
'<API key>' => array(
'tip' => wfMessage('<API key>')->plain(),
'open' => "#REDIRECT [[",
'close' => "]]",
'sample' => wfMessage('<API key>')->plain()
),
'<API key>' => array(
'tip' => wfMessage('<API key>')->plain(),
'open' => "<s>",
'close' => "</s>",
'sample' => wfMessage('<API key>')->plain()
),
'<API key>' => array(
'tip' => wfMessage('<API key>')->plain(),
'open' => "<br />\n",
'close' => "",
'sample' => ''
),
'bs-editbutton-sup' => array(
'tip' => wfMessage('<API key>')->plain(),
'open' => "<sup>",
'close' => "</sup>",
'sample' => wfMessage('<API key>')->plain()
),
'bs-editbutton-sub' => array(
'tip' => wfMessage('<API key>')->plain(),
'open' => "<sub>",
'close' => "</sub>",
'sample' => wfMessage('<API key>')->plain()
),
'bs-editbutton-small' => array(
'tip' => wfMessage('<API key>')->plain(),
'open' => "<small>",
'close' => "</small>",
'sample' => wfMessage('<API key>')->plain()
),
'<API key>' => array(
'tip' => wfMessage('<API key>')->plain(),
'open' => "<!
'close' => "
'sample' => wfMessage('<API key>')->plain()
),
'<API key>' => array(
'tip' => wfMessage('<API key>')->plain(),
'open' => "\n<gallery>\n",
'close' => "\n</gallery>",
'sample' => $sGallery
),
'<API key>' => array(
'tip' => wfMessage('<API key>')->plain(),
'open' => "\n<blockquote>\n",
'close' => "\n</blockquote>",
'sample' => wfMessage('<API key>')->plain()
),
'bs-editbutton-table' => array(
'tip' => wfMessage('<API key>')->plain(),
'open' => "{| class=\"wikitable\"\n|-\n",
'close' => "\n|}",
'sample' => $sTable
),
);
$aButtonCfgs = $aMWButtonCfgs + $aBSButtonCfgs;
$aRows = array(
array('editing' => array(), 'dialogs' => array(), 'table' => array( 10 => 'bs-editbutton-table' )), //this is reserverd for BlueSpice dialogs
array(
'formatting' => array(
10 => 'mw-editbutton-bold',
20 => '<API key>',
30 => '<API key>',
40 => '<API key>',
50 => '<API key>',
),
'content' => array(
//10 => 'mw-editbutton-link',
//20 => '<API key>',
30 => '<API key>',
//40 => 'mw-editbutton-image',
//50 => 'mw-editbutton-media',
60 => '<API key>',
),
'misc' => array(
10 => '<API key>',
20 => '<API key>',
30 => '<API key>',
)
)
);
wfRunHooks( '<API key>', array( &$aRows, &$aButtonCfgs ));
$aContent = array();
foreach( $aRows as $aRow ) {
$sRow = Html::openElement( 'div', array( 'class' => 'row' ) );
foreach( $aRow as $sGroupId => $aButtons ) {
$sGroup = Html::openElement( 'div', array( 'class' => 'group' ) );
ksort( $aButtons );
foreach ( $aButtons as $iButtonSort => $sButtonId ) {
if( !isset( $aButtonCfgs[$sButtonId] ) ) continue;
$aButtonCfg = $aButtonCfgs[$sButtonId];
if( !is_array( $aButtonCfg ) ) continue;
$aDefaultAttributes = array(
'href' => '
'class' => 'bs-button-32 <API key>'
);
$aAttributes = array(
'title' => $aButtonCfg['tip'],
'id' => $sButtonId
) + $aDefaultAttributes;
if( isset( $aButtonCfg['open'] ) ) $aAttributes['data-open'] = $aButtonCfg['open'];
if( isset( $aButtonCfg['close'] ) ) $aAttributes['data-close'] = $aButtonCfg['close'];
if( isset( $aButtonCfg['sample'] ) ) $aAttributes['data-sample'] = $aButtonCfg['sample'];
$sButton = Html::element(
'a',
$aAttributes,
$aButtonCfg['tip']
);
$sGroup .= $sButton;
}
$sGroup .= Html::closeElement('div');
$sRow.= $sGroup;
}
$sRow.= Html::closeElement('div');
$aContent[] = $sRow;
}
//We have to keep the old toolbar (the one with ugly icons) because
//some extensions (i.e. MsUpload) rely on it to add elements to the DOM.
//Unfortunately VisualEditor wil set it to visible when toggled.
//Therefore we move it out of sight using CSS positioning. Some buttons
//May be not visible though.
//TODO: Take contents of div#toolbar as base
$toolbar .= Html::rawElement(
'div',
array( 'id' => 'bs-extendededitbar' ),
implode( '', $aContent)
);
return true;
}
}
|
package org.wordpress.android.ui.notifications;
import com.android.volley.VolleyError;
import org.wordpress.android.models.Note;
import java.util.List;
public class NotificationEvents {
public static class <API key> {
final public boolean hasUnseenNotes;
public <API key>() {
this.hasUnseenNotes = false;
}
public <API key>(boolean hasUnseenNotes) {
this.hasUnseenNotes = hasUnseenNotes;
}
}
public static class <API key> {}
public static class <API key> {
final boolean isModerating;
final String noteId;
public <API key>(String noteId, boolean isModerating) {
this.noteId = noteId;
this.isModerating = isModerating;
}
}
public static class <API key> {
final String noteId;
public <API key>(String noteId) {
this.noteId = noteId;
}
}
public static class <API key> {
final boolean isHidden;
final String noteId;
public <API key>(String noteId, boolean isHidden) {
this.noteId = noteId;
this.isHidden = isHidden;
}
}
public static class <API key> {
final String mMessage;
public <API key>(String message) {
mMessage = message;
}
public String getMessage() {
return mMessage;
}
}
public static class <API key> {
final public boolean hasUnseenNotes;
public <API key>(boolean hasUnseenNotes) {
this.hasUnseenNotes = hasUnseenNotes;
}
}
public static class <API key> {
final List<Note> notes;
public <API key>(List<Note> notes) {
this.notes = notes;
}
}
public static class <API key> {
VolleyError error;
public <API key>(VolleyError error) {
this.error = error;
}
public <API key>() {
}
}
}
|
<?php
/**
* @ignore
*/
function mysql_table_exists($database, $tableName) {
global $tc_db;
$tables = array();
$tablesResults = $tc_db->GetAll("SHOW TABLES FROM `$database`;");
foreach ($tablesResults AS $row) $tables[] = $row[0];
return(in_array($tableName, $tables));
}
function pgsql_table_exists($database, $tableName) {
global $tc_db;
$tables = array();
$tablesResults = $tc_db->GetAll(" select table_name from information_schema.tables where table_schema='public' and table_type='BASE TABLE'");
foreach ($tablesResults AS $row) $tables[] = $row[0];
return(in_array($tableName, $tables));
}
function sqlite_table_exists($database, $tableName) {
global $tc_db;
$tables = array();
$tablesResults = $tc_db->GetAll("SELECT name FROM sqlite_master WHERE type = 'table'" );
foreach ($tablesResults AS $row) $tables[] = $row[0];
return(in_array($tableName, $tables));
}
function CreateSalt() {
$chars = '<API key>';
$salt = '';
for ($i = 0; $i < 3; ++$i) {
$salt .= $chars[mt_rand(0, strlen($chars) - 1)];
}
return $salt;
}
?>
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Kusaba B Installation</title>
<style type="text/css">
body { font-family: sans-serif; font-size: 75%; background: #ffe }
a { text-decoration: none; color: #550 }
h1,h2 { margin: 0px; background: #fca }
h1 { font-size: 150% }
h2 { font-size: 100%; margin-top: 1em }
.hl { font-style: italic }
.plus { float: right; font-size: 8px; font-weight: normal; padding: 1px 4px 2px 4px; margin: 0px 0px; background: #eb9; color: #000; border: 1px solid #da8; cursor: hand; cursor: pointer }
.plus:hover { background: #da8; border: 1px solid #c97 }
ul { list-style: none; padding-left: 0px; margin: 0px }
li { margin: 0px }
li:hover { background: #fec; }
li a { display: block; width: 100%; }
</style>
<link rel="shortcut icon" href="/favicon.ico" />
</head>
<body>
<div style="text-align:center;"><h1>Kusaba B Installation</h1></div>
<?php
echo '<h2>Checking configuration file...</h2>';
if (file_exists('../config.php')) {
require '../config.php';
require KU_ROOTDIR . 'inc/functions.php';
if (KU_RANDOMSEED!="ENTER RANDOM LETTERS/NUMBERS HERE"&&KU_RANDOMSEED!="") {
echo 'Configuration appears correct.';
echo '<h2>Checking database...</h2>';
$reqiredtables = array("ads","announcements","banlist","bannedhashes","blotter","boards","board_filetypes","embeds","events","filetypes","front","loginattempts","modlog","module_settings","posts","reports","sections","staff","watchedthreads","wordfilter");
foreach ($reqiredtables as $tablename) {
if (KU_DBTYPE == 'mysql' || KU_DBTYPE == 'mysqli') {
if (!mysql_table_exists(KU_DBDATABASE,KU_DBPREFIX.$tablename)) {
die("Couldn't find the table <strong>".KU_DBPREFIX.$tablename."</strong> in the database. Please <a href=\"install-mysql.php\"><strong><u>insert the mySQL dump</u></strong></a>.");
}
}
if (KU_DBTYPE == 'postgres7' || KU_DBTYPE == 'postgres8' || KU_DBTYPE == 'postgres') {
if (!pgsql_table_exists(KU_DBDATABASE,KU_DBPREFIX.$tablename)) {
die("Couldn't find the table <strong>".KU_DBPREFIX.$tablename."</strong> in the database. Please <a href=\"install-pgsql.php\"><strong><u>insert the PostgreSQL dump</u></strong></a>.");
}
}
if (KU_DBTYPE == 'sqlite') {
if (!sqlite_table_exists(KU_DBDATABASE,KU_DBPREFIX.$tablename)) {
die("Couldn't find the table <strong>".KU_DBPREFIX.$tablename."</strong> in the database. Please <a href=\"install-sqlite.php\"><strong><u>insert the SQLite dump</u></strong></a>.");
}
}
}
echo 'Database appears correct.';
echo '<h2>Inserting default administrator account...</h2>';
$result_exists = $tc_db->GetOne("SELECT COUNT(*) FROM `".KU_DBPREFIX."staff` WHERE `username` = 'admin'");
if ($result_exists==0) {
$salt = CreateSalt();
$result = $tc_db->Execute("INSERT INTO `".KU_DBPREFIX."staff` ( `username` , `salt`, `password` , `type` , `addedon` ) VALUES ( 'admin' , '".$salt."', '".md5("admin".$salt)."' , '1' , '".time()."' )");
echo 'Account inserted.';
$result = true;
} else {
echo 'There is already an administrator account inserted.';
$result = true;
}
if ($result) {
require_once KU_ROOTDIR . 'inc/classes/menu.class.php';
$menu_class = new Menu();
$menu_class->Generate();
echo '<h2>Done!</h2>Installation has finished! The default administrator account is <strong>admin</strong> with the password of <strong>admin</strong>.<br /><br />Delete this and the install-mysql.php file from the server, then <a href="manage.php">add some boards</a>!';
echo '<br /><br /><br /><h1><font color="red">DELETE THIS AND install-mysql.php RIGHT NOW!</font></h1>';
} else {
echo 'Error inserting SQL. Please add <strong>$tc_db->debug = true;</strong> just before ?> in config.php to turn on debugging, and check the error message.';
}
} else {
echo 'Please enter a random string into the <strong>KU_RANDOMSEED</strong> value.';
}
} else {
echo 'Unable to locate config.php';
}
?>
</body>
</html>
|
<?php
/**
* @file
* Teamwork15 sub theme template functions
*
*/
/**
* Implements <API key>().
*/
function <API key>(&$variables) {
backdrop_add_css(backdrop_get_path('theme', 'bartik') . '/css/maintenance-page.css');
}
/**
* Implements <API key>().
*/
function <API key>(&$variables) {
if ($variables['content']['header']) {
$variables['content']['header'] = '<div class="l-header-inner">' . $variables['content']['header'] . '</div>';
}
if (theme_get_setting('<API key>') > 0)
{
backdrop_add_css('http://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/pure-min.css', array('type' => 'external', 'every_page' => TRUE, 'group' => CSS_DEFAULT));
}
$var1 = theme_get_setting('<API key>');
$var2 = theme_get_setting('<API key>');
$var3 = theme_get_setting('<API key>');
$var4 = theme_get_setting('<API key>');
if ($var1 && $var3 > 0)
{
backdrop_add_css("@media screen and (min-width: 769px) { .juiced-main::before { content: ' '; width: 100%; height: 100%; display: block; position: absolute; z-index: -100; -webkit-filter: blur(20px); -moz-filter: blur(20px); -o-filter: blur(20px); -ms-filter: blur(20px); filter: blur(20px); opacity: 0.4; background: url($var1) no-repeat; background-size: cover; background-position: center; } }", array('type' => 'inline'));
}
if ($var1 && $var3 == 0)
{
backdrop_add_css("@media screen and (min-width: 769px) { .juiced-main { background: url($var1) no-repeat; background-size: cover; background-position: center; } }", array('type' => 'inline'));
}
if ($var2 && $var4 > 0)
{
backdrop_add_css("@media screen and (min-width: 769px) { .l-big-statement::before { content: ' '; width: 100%; height: 100%; display: block; position: absolute; z-index: -100; -webkit-filter: blur(20px); -moz-filter: blur(20px); -o-filter: blur(20px); -ms-filter: blur(20px); filter: blur(20px); opacity: 0.4; background: url($var2) no-repeat fixed; background-size: cover; background-position: center; } }", array('type' => 'inline'));
}
if ($var2 && $var4 == 0)
{
backdrop_add_css("@media screen and (min-width: 769px) { .l-big-statement { background: url($var2) no-repeat fixed; background-size: cover; background-position: center; } }", array('type' => 'inline'));
}
$var5 = theme_get_setting('<API key>');
$var6 = theme_get_setting('<API key>');
$var7 = theme_get_setting('<API key>');
$var8 = theme_get_setting('<API key>');
if ($var5 && $var7 > 0)
{
backdrop_add_css("@media screen and (min-width: 769px) { .layout::before { content: ' '; width: 100%; height: 100%; display: block; position: absolute; z-index: -100; -webkit-filter: blur(20px); -moz-filter: blur(20px); -o-filter: blur(20px); -ms-filter: blur(20px); filter: blur(20px); opacity: 0.4; background: url($var5) no-repeat; background-size: cover; background-position: center; } }", array('type' => 'inline'));
}
if ($var5 && $var7 == 0)
{
backdrop_add_css("@media screen and (min-width: 769px) { .layout { background: url($var5) no-repeat; background-size: cover; background-position: center; } }", array('type' => 'inline'));
}
if ($var6 && $var8 > 0)
{
backdrop_add_css("@media screen and (min-width: 769px) { footer.l-footer::before { content: ' '; width: 100%; height: 100%; display: block; position: absolute; z-index: -100; -webkit-filter: blur(20px); -moz-filter: blur(20px); -o-filter: blur(20px); -ms-filter: blur(20px); filter: blur(20px); opacity: 0.4; background: url($var6) no-repeat fixed; background-size: cover; background-position: center; } footer.l-footer { background: transparent; } }", array('type' => 'inline'));
}
if ($var6 && $var8 == 0)
{
backdrop_add_css("@media screen and (min-width: 769px) { footer.l-footer { background: url($var6) no-repeat fixed; background-size: cover; background-position: center; } }", array('type' => 'inline'));
}
if (theme_get_setting('<API key>') > 0)
{
backdrop_add_js("https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js", array('type' => 'external', 'scope' => 'footer', 'every_page' => TRUE, 'preprocess' => TRUE));
}
if (theme_get_setting('<API key>') > 0)
{
backdrop_add_js("https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.14.0/jquery.validate.min.js", array('type' => 'external', 'scope' => 'footer', 'every_page' => TRUE, 'preprocess' => TRUE));
}
if (theme_get_setting('<API key>') > 0)
{
backdrop_add_js("https://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js", array('type' => 'external', 'scope' => 'footer', 'every_page' => TRUE, 'preprocess' => TRUE));
}
if (theme_get_setting('<API key>') > 0)
{
backdrop_add_js("https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.4/hammer.min.js", array('type' => 'external', 'scope' => 'footer', 'every_page' => TRUE, 'preprocess' => TRUE));
}
backdrop_add_js("themes/<API key>/js/scripts.js", array('type' => 'file', 'scope' => 'footer', 'every_page' => TRUE, 'preprocess' => TRUE));
backdrop_add_js("document.write('<script src=\"http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1\"></' + 'script>')", array('type' => 'inline', 'scope' => 'footer', 'weight' => 9999));
}
/**
* Implements <API key>().
*/
function <API key>($variables) {
$output = '';
// Render the label, if it's not hidden.
if (!$variables['label_hidden']) {
$output .= '<h3 class="field-label">' . $variables['label'] . ': </h3>';
}
// Render the items.
$output .= ($variables['element']['#label_display'] == 'inline') ? '<ul class="links inline">' : '<ul class="links">';
foreach ($variables['items'] as $delta => $item) {
$item_attributes = (isset($variables['item_attributes'][$delta])) ? backdrop_attributes($variables['item_attributes'][$delta]) : '';
$output .= '<li class="<API key>-' . $delta . '"' . $item_attributes . '>' . backdrop_render($item) . '</li>';
}
$output .= '</ul>';
// Render the surrounding DIV with appropriate classes and attributes.
if (!in_array('clearfix', $variables['classes'])) {
$variables['classes'][] = 'clearfix';
}
$output = '<div class="' . implode(' ', $variables['classes']) . '"' . backdrop_attributes($variables['attributes']) . '>' . $output . '</div>';
return $output;
}
/**
* Implements <API key>().
*/
function <API key>(&$vars) {
$vars['attributes']['class'][] = 'pure-img';
}
function <API key>(&$vars) {
$classes = array('button-success', 'pure-button-primary', 'button-xlarge', 'pure-button');
if (!isset($vars['#attributes']['class'])) {
$vars['#attributes'] = array('class' => $classes);
}
else {
$vars['#attributes']['class'] = array_merge($vars['#attributes']['class'], $classes);
}
if (!isset($vars['element']['#attributes']['class'])) {
$vars['element']['#attributes'] = array('class' => $classes);
}
else {
$vars['element']['#attributes']['class'] = array_merge($vars['element']['#attributes']['class'], $classes);
}
return theme_button($vars);
}
function <API key>(&$css) {
$css_to_remove = array();
if (theme_get_setting('<API key>') > 0)
{
$css_to_remove[] = backdrop_get_path('theme','teamwork_15') . '/css/pure.min.css';
}
if (theme_get_setting('<API key>') > 0)
{
$css_to_remove[] = backdrop_get_path('theme','teamwork_15') . '/css/style.css';
$css_to_remove[] = backdrop_get_path('theme','teamwork_15') . '/css/pure.min.css';
}
foreach ($css_to_remove as $index => $css_file) {
unset($css[$css_file]);
}
}
/**
* Implements hook_form_alter()
*/
function <API key>(&$form, &$form_state, $form_id) {
$classes = array('pure-form', 'pure-form-aligned');
if (!isset($form['#attributes']['class'])) {
$form['#attributes'] = array('class' => $classes);
}
else {
$form['#attributes']['class'] = array_merge($form['#attributes']['class'], $classes);
}
}
function <API key>($variables) {
return '<ul class="menu">' . $variables['tree'] . '</ul>';
}
/**
* Overrides <API key>().
*/
function <API key>(&$variables) {
$element = $variables['element'];
$title = filter_xss_admin($element['#title']);
// If the element is required, a required marker is appended to the label.
$required = !empty($element['#required']) ? theme('<API key>', array('element' => $element)) : '';
// // This is also used in the installer, pre-database setup.
$t = get_t();
$attributes = array();
if (!empty($element['
$attributes['for'] = $element['
}
$output = '';
if (isset($variables['#children'])) {
if ($element['
{
$output .= $variables['#children'];
}
if ($element['
{
$output .= $variables['#children'];
}
}
return ' <label' . backdrop_attributes($attributes) . '></label><div>' . $t('!title', array('!title' => $title)) . "</div> \n";
}
/**
* Implements <API key>().
*/
function <API key>(array $variables) {
$element = $variables['element'];
$classes = array('pure-menu-item');
$element['#attributes']['class'] = array_merge($element['#attributes']['class'], $classes);
$sub_menu = '';
if ($element['#below']) {
$sub_menu = backdrop_render($element['#below']);
}
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
return '<li' . backdrop_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
|
#include "setup.h"
#include <curl/curl.h>
#include "urldata.h"
#include "getinfo.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include "memory.h"
#include "sslgen.h"
/* Make this the last #include */
#include "memdebug.h"
/*
* This is supposed to be called in the beginning of a perform() session
* and should reset all session-info variables
*/
CURLcode Curl_initinfo(struct SessionHandle *data)
{
struct Progress *pro = &data->progress;
struct PureInfo *info =&data->info;
pro->t_nslookup = 0;
pro->t_connect = 0;
pro->t_pretransfer = 0;
pro->t_starttransfer = 0;
pro->timespent = 0;
pro->t_redirect = 0;
info->httpcode = 0;
info->httpversion=0;
info->filetime=-1;
if (info->contenttype)
free(info->contenttype);
info->contenttype = NULL;
info->header_size = 0;
info->request_size = 0;
info->numconnects = 0;
return CURLE_OK;
}
CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
{
va_list arg;
long *param_longp=NULL;
double *param_doublep=NULL;
char **param_charp=NULL;
struct curl_slist **param_slistp=NULL;
va_start(arg, info);
switch(info&CURLINFO_TYPEMASK) {
default:
return <API key>;
case CURLINFO_STRING:
param_charp = va_arg(arg, char **);
if(NULL == param_charp)
return <API key>;
break;
case CURLINFO_LONG:
param_longp = va_arg(arg, long *);
if(NULL == param_longp)
return <API key>;
break;
case CURLINFO_DOUBLE:
param_doublep = va_arg(arg, double *);
if(NULL == param_doublep)
return <API key>;
break;
case CURLINFO_SLIST:
param_slistp = va_arg(arg, struct curl_slist **);
if(NULL == param_slistp)
return <API key>;
break;
}
switch(info) {
case <API key>:
*param_charp = data->change.url?data->change.url:(char *)"";
break;
case <API key>:
*param_longp = data->info.httpcode;
break;
case <API key>:
*param_longp = data->info.httpproxycode;
break;
case CURLINFO_FILETIME:
*param_longp = data->info.filetime;
break;
case <API key>:
*param_longp = data->info.header_size;
break;
case <API key>:
*param_longp = data->info.request_size;
break;
case CURLINFO_TOTAL_TIME:
*param_doublep = data->progress.timespent;
break;
case <API key>:
*param_doublep = data->progress.t_nslookup;
break;
case <API key>:
*param_doublep = data->progress.t_connect;
break;
case <API key>:
*param_doublep = data->progress.t_pretransfer;
break;
case <API key>:
*param_doublep = data->progress.t_starttransfer;
break;
case <API key>:
*param_doublep = (double)data->progress.uploaded;
break;
case <API key>:
*param_doublep = (double)data->progress.downloaded;
break;
case <API key>:
*param_doublep = (double)data->progress.dlspeed;
break;
case <API key>:
*param_doublep = (double)data->progress.ulspeed;
break;
case <API key>:
*param_longp = data->set.ssl.certverifyresult;
break;
case <API key>:
*param_doublep = (double)data->progress.size_dl;
break;
case <API key>:
*param_doublep = (double)data->progress.size_ul;
break;
case <API key>:
*param_doublep = data->progress.t_redirect;
break;
case <API key>:
*param_longp = data->set.followlocation;
break;
case <API key>:
*param_charp = data->info.contenttype;
break;
case CURLINFO_PRIVATE:
*param_charp = data->set.private_data;
break;
case <API key>:
*param_longp = data->info.httpauthavail;
break;
case <API key>:
*param_longp = data->info.proxyauthavail;
break;
case CURLINFO_OS_ERRNO:
*param_longp = data->state.os_errno;
break;
case <API key>:
*param_longp = data->info.numconnects;
break;
case <API key>:
*param_slistp = <API key>(data);
break;
case CURLINFO_COOKIELIST:
*param_slistp = Curl_cookie_list(data);
break;
case CURLINFO_LASTSOCKET:
if((data->state.lastconnect != -1) &&
(data->state.connects[data->state.lastconnect] != NULL))
*param_longp = data->state.connects[data->state.lastconnect]->
sock[FIRSTSOCKET];
else
*param_longp = -1;
break;
default:
return <API key>;
}
return CURLE_OK;
}
|
/**
* @test TestMemoryMXBeans
* @key gc
* @summary Test JMX memory beans
* @modules java.base/jdk.internal.misc
* java.management
* @run main/othervm -XX:+UseShenandoahGC -Xmx1g TestMemoryMXBeans -1 1024
* @run main/othervm -XX:+UseShenandoahGC -Xms1g -Xmx1g TestMemoryMXBeans 1024 1024
* @run main/othervm -XX:+UseShenandoahGC -Xms128m -Xmx1g TestMemoryMXBeans 128 1024
*/
import java.lang.management.*;
import java.util.*;
public class TestMemoryMXBeans {
public static void main(String[] args) throws Exception {
if (args.length < 2) {
throw new <API key>("Should provide expected heap sizes");
}
long initSize = 1L * Integer.parseInt(args[0]) * 1024 * 1024;
long maxSize = 1L * Integer.parseInt(args[1]) * 1024 * 1024;
testMemoryBean(initSize, maxSize);
}
public static void testMemoryBean(long initSize, long maxSize) {
MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
long heapInit = memoryMXBean.getHeapMemoryUsage().getInit();
long heapMax = memoryMXBean.getHeapMemoryUsage().getMax();
long nonHeapInit = memoryMXBean.<API key>().getInit();
long nonHeapMax = memoryMXBean.<API key>().getMax();
if (initSize > 0 && heapInit != initSize) {
throw new <API key>("Init heap size is wrong: " + heapInit + " vs " + initSize);
}
if (maxSize > 0 && heapMax != maxSize) {
throw new <API key>("Max heap size is wrong: " + heapMax + " vs " + maxSize);
}
}
}
|
typedef struct effect_uuid_s
{
uint32_t timeLow;
uint16_t timeMid;
uint16_t timeHiAndVersion;
uint16_t clockSeq;
uint8_t node[6];
} effect_uuid_t;
// Maximum length of character strings in structures defines by this API.
#define <API key> 64
// NULL UUID definition (matches SL_IID_NULL_)
#define <API key> { 0xec7178ec, 0xe5e1, 0x4432, 0xa3f4, \
{ 0x46, 0x57, 0xe6, 0x79, 0x52, 0x10 } }
static const effect_uuid_t EFFECT_UUID_NULL_ = <API key>;
static const effect_uuid_t * const EFFECT_UUID_NULL = &EFFECT_UUID_NULL_;
static const char * const <API key> = "<API key>";
// The effect descriptor contains necessary information to facilitate the enumeration of the effect
// engines present in a library.
typedef struct effect_descriptor_s
{
effect_uuid_t type; // UUID of to the OpenSL ES interface implemented by this effect
effect_uuid_t uuid; // UUID for this particular implementation
uint32_t apiVersion; // Version of the effect control API implemented
uint32_t flags; // effect engine capabilities/requirements flags (see below)
uint16_t cpuLoad; // CPU load indication (see below)
uint16_t memoryUsage; // Data Memory usage (see below)
char name[<API key>]; // human readable effect name
char implementor[<API key>]; // human readable effect implementor name
} effect_descriptor_t;
// CPU load and memory usage indication: each effect implementation must provide an indication of
// its CPU and memory usage for the audio effect framework to limit the number of effects
// instantiated at a given time on a given platform.
// The CPU load is expressed in 0.1 MIPS units as estimated on an ARM9E core (ARMv5TE) with 0 WS.
// The memory usage is expressed in KB and includes only dynamically allocated memory
// Definitions for flags field of effect descriptor.
// | description | bits | values
// | connection mode | 0..2 | 0 insert: after track process
// | | | 1 auxiliary: connect to track auxiliary
// | | | output and use send level
// | | | 2 replace: replaces track process function;
// | | | must implement SRC, volume and mono to stereo.
// | | | 3 pre processing: applied below audio HAL on input
// | | | 4 post processing: applied below audio HAL on output
// | | | 5 - 7 reserved
// | insertion preference | 3..5 | 0 none
// | | | 1 first of the chain
// | | | 2 last of the chain
// | | | 3 exclusive (only effect in the insert chain)
// | | | 4..7 reserved
// | Volume management | 6..8 | 0 none
// | | | 1 implements volume control
// | | | 2 requires volume indication
// | | | 4 reserved
// | Device indication | 9..11 | 0 none
// | | | 1 requires device updates
// | | | 2, 4 reserved
// | Sample input mode | 12..13 | 1 direct: process() function or <API key>
// | | | command must specify a buffer descriptor
// | | | 2 provider: process() function uses the
// | | | bufferProvider indicated by the
// | | | <API key> command to request input.
// | | | buffers.
// | | | 3 both: both input modes are supported
// | Sample output mode | 14..15 | 1 direct: process() function or <API key>
// | | | command must specify a buffer descriptor
// | | | 2 provider: process() function uses the
// | | | bufferProvider indicated by the
// | | | <API key> command to request output
// | | | buffers.
// | | | 3 both: both output modes are supported
// | Hardware acceleration | 16..17 | 0 No hardware acceleration
// | | | 1 non tunneled hw acceleration: the process() function
// | | | reads the samples, send them to HW accelerated
// | | | effect processor, reads back the processed samples
// | | | and returns them to the output buffer.
// | | | 2 tunneled hw acceleration: the process() function is
// | | | transparent. The effect interface is only used to
// | | | control the effect engine. This mode is relevant for
// | | | global effects actually applied by the audio
// | | | hardware on the output stream.
// | Audio Mode indication | 18..19 | 0 none
// | | | 1 requires audio mode updates
// | | | 2..3 reserved
// | Audio source indication | 20..21 | 0 none
// | | | 1 requires audio source updates
// | | | 2..3 reserved
// | Effect offload supported | 22 | 0 The effect cannot be offloaded to an audio DSP
// | | | 1 The effect can be offloaded to an audio DSP
// Insert mode
#define <API key> 0
#define <API key> 3
#define <API key> (((1 << <API key>) -1) \
<< <API key>)
#define <API key> (0 << <API key>)
#define <API key> (1 << <API key>)
#define <API key> (2 << <API key>)
#define <API key> (3 << <API key>)
#define <API key> (4 << <API key>)
// Insert preference
#define <API key> (<API key> + <API key>)
#define <API key> 3
#define <API key> (((1 << <API key>) -1) \
<< <API key>)
#define <API key> (0 << <API key>)
#define <API key> (1 << <API key>)
#define <API key> (2 << <API key>)
#define <API key> (3 << <API key>)
// Volume control
#define <API key> (<API key> + <API key>)
#define <API key> 3
#define <API key> (((1 << <API key>) -1) \
<< <API key>)
#define <API key> (1 << <API key>)
#define <API key> (2 << <API key>)
#define <API key> (0 << <API key>)
// Device indication
#define <API key> (<API key> + <API key>)
#define <API key> 3
#define <API key> (((1 << <API key>) -1) \
<< <API key>)
#define <API key> (1 << <API key>)
#define <API key> (0 << <API key>)
// Sample input modes
#define <API key> (<API key> + <API key>)
#define <API key> 2
#define <API key> (((1 << <API key>) -1) \
<< <API key>)
#define <API key> (1 << <API key>)
#define <API key> (2 << <API key>)
#define <API key> (3 << <API key>)
// Sample output modes
#define <API key> (<API key> + <API key>)
#define <API key> 2
#define <API key> (((1 << <API key>) -1) \
<< <API key>)
#define <API key> (1 << <API key>)
#define <API key> (2 << <API key>)
#define <API key> (3 << <API key>)
// Hardware acceleration mode
#define <API key> (<API key> + <API key>)
#define <API key> 2
#define <API key> (((1 << <API key>) -1) \
<< <API key>)
#define <API key> (1 << <API key>)
#define <API key> (2 << <API key>)
// Audio mode indication
#define <API key> (<API key> + <API key>)
#define <API key> 2
#define <API key> (((1 << <API key>) -1) \
<< <API key>)
#define <API key> (1 << <API key>)
#define <API key> (0 << <API key>)
// Audio source indication
#define <API key> (<API key> + <API key>)
#define <API key> 2
#define <API key> (((1 << <API key>) -1) \
<< <API key>)
#define <API key> (1 << <API key>)
#define <API key> (0 << <API key>)
// Effect offload indication
#define <API key> (<API key> + \
<API key>)
#define <API key> 1
#define <API key> (((1 << <API key>) -1) \
<< <API key>)
#define <API key> (1 << <API key>)
#define <API key>(M, m) (((M)<<16) | ((m) & 0xFFFF))
#define <API key>(v) ((v)>>16)
#define <API key>(v) ((m) & 0xFFFF)
// Effect control interface
// Effect control interface version 2.0
#define <API key> <API key>(2,0)
// Effect control interface structure: effect_interface_s
// The effect control interface is exposed by each effect engine implementation. It consists of
// a set of functions controlling the configuration, activation and process of the engine.
// The functions are grouped in a structure of type effect_interface_s.
// Effect control interface handle: effect_handle_t
// The effect_handle_t serves two purposes regarding the implementation of the effect engine:
// - 1 it is the address of a pointer to an effect_interface_s structure where the functions
// of the effect control API for a particular effect are located.
// - 2 it is the address of the context of a particular effect instance.
// A typical implementation in the effect library would define a structure as follows:
// struct effect_module_s {
// const struct effect_interface_s *itfe;
// effect_config_t config;
// effect_context_t context;
// The implementation of EffectCreate() function would then allocate a structure of this
// type and return its address as effect_handle_t
typedef struct effect_interface_s **effect_handle_t;
// Forward definition of type audio_buffer_t
typedef struct audio_buffer_s audio_buffer_t;
// Effect control interface definition
struct effect_interface_s
{
// Function: process
// Description: Effect process function. Takes input samples as specified
// (count and location) in input buffer descriptor and output processed
// samples as specified in output buffer descriptor. If the buffer descriptor
// is not specified the function must use either the buffer or the
// buffer provider function installed by the <API key> command.
// The effect framework will call the process() function after the EFFECT_CMD_ENABLE
// command is received and until the EFFECT_CMD_DISABLE is received. When the engine
// receives the EFFECT_CMD_DISABLE command it should turn off the effect gracefully
// and when done indicate that it is OK to stop calling the process() function by
// returning the -ENODATA status.
// NOTE: the process() function implementation should be "real-time safe" that is
// it should not perform blocking calls: malloc/free, sleep, read/write/open/close,
// pthread_cond_wait/pthread_mutex_lock...
// Input:
// self: handle to the effect interface this function
// is called on.
// inBuffer: buffer descriptor indicating where to read samples to process.
// If NULL, use the configuration passed by <API key> command.
// outBuffer: buffer descriptor indicating where to write processed samples.
// If NULL, use the configuration passed by <API key> command.
// Output:
// returned value: 0 successful operation
// -ENODATA the engine has finished the disable phase and the framework
// can stop calling process()
// -EINVAL invalid interface handle or
// invalid input/output buffer description
int32_t (*process)(effect_handle_t self,
audio_buffer_t *inBuffer,
audio_buffer_t *outBuffer);
// Function: command
// Description: Send a command and receive a response to/from effect engine.
// Input:
// self: handle to the effect interface this function
// is called on.
// cmdCode: command code: the command can be a standardized command defined in
// cmdSize: size of command in bytes
// pCmdData: pointer to command data
// pReplyData: pointer to reply data
// Input/Output:
// replySize: maximum size of reply data as input
// actual size of reply data as output
// Output:
// returned value: 0 successful operation
// -EINVAL invalid interface handle or
// invalid command/reply size or format according to command code
// The return code should be restricted to indicate problems related to the this
// API specification. Status related to the execution of a particular command should be
// indicated as part of the reply field.
// *pReplyData updated with command response
int32_t (*command)(effect_handle_t self,
uint32_t cmdCode,
uint32_t cmdSize,
void *pCmdData,
uint32_t *replySize,
void *pReplyData);
// Function: get_descriptor
// Description: Returns the effect descriptor
// Input:
// self: handle to the effect interface this function
// is called on.
// Input/Output:
// pDescriptor: address where to return the effect descriptor.
// Output:
// returned value: 0 successful operation.
// -EINVAL invalid interface handle or invalid pDescriptor
// *pDescriptor: updated with the effect descriptor.
int32_t (*get_descriptor)(effect_handle_t self,
effect_descriptor_t *pDescriptor);
// Function: process_reverse
// Description: Process reverse stream function. This function is used to pass
// a reference stream to the effect engine. If the engine does not need a reference
// stream, this function pointer can be set to NULL.
// This function would typically implemented by an Echo Canceler.
// Input:
// self: handle to the effect interface this function
// is called on.
// inBuffer: buffer descriptor indicating where to read samples to process.
// If NULL, use the configuration passed by <API key> command.
// outBuffer: buffer descriptor indicating where to write processed samples.
// If NULL, use the configuration passed by <API key> command.
// If the buffer and buffer provider in the configuration received by
// <API key> are also NULL, do not return modified reverse
// stream data
// Output:
// returned value: 0 successful operation
// -ENODATA the engine has finished the disable phase and the framework
// can stop calling process_reverse()
// -EINVAL invalid interface handle or
// invalid input/output buffer description
int32_t (*process_reverse)(effect_handle_t self,
audio_buffer_t *inBuffer,
audio_buffer_t *outBuffer);
};
enum effect_command_e
{
EFFECT_CMD_INIT, // initialize effect engine
<API key>, // configure effect engine (see effect_config_t)
EFFECT_CMD_RESET, // reset effect engine
EFFECT_CMD_ENABLE, // enable effect process
EFFECT_CMD_DISABLE, // disable effect process
<API key>, // set parameter immediately (see effect_param_t)
<API key>, // set parameter deferred
<API key>, // commit previous set parameter deferred
<API key>, // get parameter
<API key>, // set audio device (see audio.h, audio_devices_t)
<API key>, // set volume
<API key>, // set the audio mode (normal, ring, ...)
<API key>, // configure effect engine reverse stream(see effect_config_t)
<API key>, // set capture device (see audio.h, audio_devices_t)
<API key>, // read effect engine configuration
<API key>, // read configure effect engine reverse stream configuration
<API key>,// get all supported configurations for a feature.
<API key>, // get current feature configuration
<API key>, // set current feature configuration
<API key>, // set the audio source (see audio.h, audio_source_t)
EFFECT_CMD_OFFLOAD, // set if effect thread is an offload one,
// send the ioHandle of the effect thread
<API key> = 0x10000
};
// command: EFFECT_CMD_INIT
// description:
// Initialize effect engine: All configurations return to default
// command format:
// size: 0
// data: N/A
// reply format:
// size: sizeof(int)
// data: status
// command: <API key>
// description:
// Apply new audio parameters configurations for input and output buffers
// command format:
// size: sizeof(effect_config_t)
// data: effect_config_t
// reply format:
// size: sizeof(int)
// data: status
// command: EFFECT_CMD_RESET
// description:
// Reset the effect engine. Keep configuration but resets state and buffer content
// command format:
// size: 0
// data: N/A
// reply format:
// size: 0
// data: N/A
// command: EFFECT_CMD_ENABLE
// description:
// Enable the process. Called by the framework before the first call to process()
// command format:
// size: 0
// data: N/A
// reply format:
// size: sizeof(int)
// data: status
// command: EFFECT_CMD_DISABLE
// description:
// Disable the process. Called by the framework after the last call to process()
// command format:
// size: 0
// data: N/A
// reply format:
// size: sizeof(int)
// data: status
// command: <API key>
// description:
// Set a parameter and apply it immediately
// command format:
// size: sizeof(effect_param_t) + size of param and value
// data: effect_param_t + param + value. See effect_param_t definition below for value offset
// reply format:
// size: sizeof(int)
// data: status
// command: <API key>
// description:
// Set a parameter but apply it only when receiving <API key> command
// command format:
// size: sizeof(effect_param_t) + size of param and value
// data: effect_param_t + param + value. See effect_param_t definition below for value offset
// reply format:
// size: 0
// data: N/A
// command: <API key>
// description:
// Apply all previously received <API key> commands
// command format:
// size: 0
// data: N/A
// reply format:
// size: sizeof(int)
// data: status
// command: <API key>
// description:
// Get a parameter value
// command format:
// size: sizeof(effect_param_t) + size of param
// data: effect_param_t + param
// reply format:
// size: sizeof(effect_param_t) + size of param and value
// data: effect_param_t + param + value. See effect_param_t definition below for value offset
// command: <API key>
// description:
// Set the rendering device the audio output path is connected to. See audio.h, audio_devices_t
// for device values.
// The effect implementation must set <API key> flag in its descriptor to receive this
// command when the device changes
// command format:
// size: sizeof(uint32_t)
// data: uint32_t
// reply format:
// size: 0
// data: N/A
// command: <API key>
// description:
// Set and get volume. Used by audio framework to delegate volume control to effect engine.
// The effect implementation must set <API key> or <API key> flag in
// its descriptor to receive this command before every call to process() function
// If <API key> flag is set in the effect descriptor, the effect engine must return
// the volume that should be applied before the effect is processed. The overall volume (the volume
// actually applied by the effect engine multiplied by the returned value) should match the value
// indicated in the command.
// command format:
// size: n * sizeof(uint32_t)
// data: volume for each channel defined in effect_config_t for output buffer expressed in
// 8.24 fixed point format
// reply format:
// size: n * sizeof(uint32_t) / 0
// data: - if <API key> is set in effect descriptor:
// volume for each channel defined in effect_config_t for output buffer expressed in
// 8.24 fixed point format
// - if <API key> is not set in effect descriptor:
// delegated volume control to another effect
// command: <API key>
// description:
// Set the audio mode. The effect implementation must set <API key> flag in its
// descriptor to receive this command when the audio mode changes.
// command format:
// size: sizeof(uint32_t)
// data: audio_mode_t
// reply format:
// size: 0
// data: N/A
// command: <API key>
// description:
// Apply new audio parameters configurations for input and output buffers of reverse stream.
// An example of reverse stream is the echo reference supplied to an Acoustic Echo Canceler.
// command format:
// size: sizeof(effect_config_t)
// data: effect_config_t
// reply format:
// size: sizeof(int)
// data: status
// command: <API key>
// description:
// Set the capture device the audio input path is connected to. See audio.h, audio_devices_t
// for device values.
// The effect implementation must set <API key> flag in its descriptor to receive this
// command when the device changes
// command format:
// size: sizeof(uint32_t)
// data: uint32_t
// reply format:
// size: 0
// data: N/A
// command: <API key>
// description:
// Read audio parameters configurations for input and output buffers
// command format:
// size: 0
// data: N/A
// reply format:
// size: sizeof(effect_config_t)
// data: effect_config_t
// command: <API key>
// description:
// Read audio parameters configurations for input and output buffers of reverse stream
// command format:
// size: 0
// data: N/A
// reply format:
// size: sizeof(effect_config_t)
// data: effect_config_t
// command: <API key>
// description:
// Queries for supported configurations for a particular feature (e.g. get the supported
// combinations of main and auxiliary channels for a noise suppressor).
// The command parameter is the feature identifier (See effect_feature_e for a list of defined
// features) followed by the maximum number of configuration descriptor to return.
// The reply is composed of:
// - status (uint32_t):
// - 0 if feature is supported
// - -ENOSYS if the feature is not supported,
// - -ENOMEM if the feature is supported but the total number of supported configurations
// exceeds the maximum number indicated by the caller.
// - total number of supported configurations (uint32_t)
// - an array of configuration descriptors.
// The actual number of descriptors returned must not exceed the maximum number indicated by
// the caller.
// command format:
// size: 2 x sizeof(uint32_t)
// data: effect_feature_e + maximum number of configurations to return
// reply format:
// size: 2 x sizeof(uint32_t) + n x sizeof (<config descriptor>)
// data: status + total number of configurations supported + array of n config descriptors
// command: <API key>
// description:
// Retrieves current configuration for a given feature.
// The reply status is:
// - 0 if feature is supported
// - -ENOSYS if the feature is not supported,
// command format:
// size: sizeof(uint32_t)
// data: effect_feature_e
// reply format:
// size: sizeof(uint32_t) + sizeof (<config descriptor>)
// data: status + config descriptor
// command: <API key>
// description:
// Sets current configuration for a given feature.
// The reply status is:
// - 0 if feature is supported
// - -ENOSYS if the feature is not supported,
// - -EINVAL if the configuration is invalid
// command format:
// size: sizeof(uint32_t) + sizeof (<config descriptor>)
// data: effect_feature_e + config descriptor
// reply format:
// size: sizeof(uint32_t)
// data: status
// command: <API key>
// description:
// Set the audio source the capture path is configured for (Camcorder, voice recognition...).
// See audio.h, audio_source_t for values.
// command format:
// size: sizeof(uint32_t)
// data: uint32_t
// reply format:
// size: 0
// data: N/A
// command: EFFECT_CMD_OFFLOAD
// description:
// 1.indicate if the playback thread the effect is attached to is offloaded or not
// 2.update the io handle of the playback thread the effect is attached to
// command format:
// size: sizeof(<API key>)
// data: <API key>
// reply format:
// size: sizeof(uint32_t)
// data: uint32_t
// command: <API key>
// description:
// command and response fields is free in this case
// Audio buffer descriptor used by process(), bufferProvider() functions and buffer_config_t
// structure. Multi-channel audio is always interleaved. The channel order is from LSB to MSB with
// regard to the channel mask definition in audio.h, <API key> e.g :
// Stereo: left, right
// 5 point 1: front left, front right, front center, low frequency, back left, back right
// The buffer size is expressed in frame count, a frame being composed of samples for all
// channels at a given time. Frame size for unspecified format (AUDIO_FORMAT_OTHER) is 8 bit by
// definition
typedef struct audio_buffer_s {
size_t frameCount; // number of frames in buffer
union {
void* raw; // raw pointer to start of buffer
float* f32; // pointer to float 32 bit data at start of buffer
int32_t* s32; // pointer to signed 32 bit data at start of buffer
int16_t* s16; // pointer to signed 16 bit data at start of buffer
uint8_t* u8; // pointer to unsigned 8 bit data at start of buffer
};
} audio_buffer_t;
typedef int32_t (* buffer_function_t)(void *cookie, audio_buffer_t *buffer);
typedef struct buffer_provider_s
{
buffer_function_t getBuffer; // retrieve next buffer
buffer_function_t releaseBuffer; // release used buffer
void *cookie; // for use by client of buffer provider functions
} buffer_provider_t;
// The buffer_config_s structure specifies the input or output audio format
// to be used by the effect engine. It is part of the effect_config_t
// structure that defines both input and output buffer configurations and is
// passed by the <API key> or <API key> command.
typedef struct buffer_config_s
{
audio_buffer_t buffer; // buffer for use by process() function if not passed explicitly
uint32_t samplingRate; // sampling rate
uint32_t channels; // channel mask (see <API key> in audio.h)
buffer_provider_t bufferProvider; // buffer provider
uint8_t format; // Audio format (see audio_format_t in audio.h)
uint8_t accessMode; // read/write or accumulate in buffer (<API key>)
uint16_t mask; // indicates which of the above fields is valid
} buffer_config_t;
// Values for "accessMode" field of buffer_config_t:
// overwrite, read only, accumulate (read/modify/write)
typedef enum
{
<API key>,
<API key>,
<API key>
} <API key>;
// effect_config_s structure describes the format of the pCmdData argument of <API key>
// command to configure audio parameters and buffers for effect engine input and output.
typedef struct effect_config_s
{
buffer_config_t inputCfg;
buffer_config_t outputCfg;
} effect_config_t;
// effect_param_s structure describes the format of the pCmdData argument of <API key>
// command and pCmdData and pReplyData of <API key> command.
// psize and vsize represent the actual size of parameter and value.
// NOTE: the start of value field inside the data field is always on a 32 bit boundary:
// | status | sizeof(int)
// | psize | sizeof(int)
// | vsize | sizeof(int)
// ~ parameter ~ > psize |
// | | | > ((psize - 1)/sizeof(int) + 1) * sizeof(int)
// | padding | |
// ~ value ~ > vsize
typedef struct effect_param_s
{
int32_t status; // Transaction status (unused for command, used for reply)
uint32_t psize; // Parameter size
uint32_t vsize; // Value size
char data[]; // Start of Parameter + Value data
} effect_param_t;
// Effect library interface
// Effect library interface version 3.0
// Note that EffectsFactory.c only checks the major version component, so changes to the minor
// number can only be used for fully backwards compatible changes
#define <API key> <API key>(3,0)
#define <API key> ((('A') << 24) | (('E') << 16) | (('L') << 8) | ('T'))
// Every effect library must have a data structure named <API key>
// and the fields of this data structure must begin with <API key>
typedef struct <API key>
{
// tag must be initialized to <API key>
uint32_t tag;
// Version of the effect library API : 0xMMMMmmmm MMMM: Major, mmmm: minor
uint32_t version;
// Name of this library
const char *name;
// Author/owner/implementor of the library
const char *implementor;
// Function: create_effect
// Description: Creates an effect engine of the specified implementation uuid and
// returns an effect control interface on this engine. The function will allocate the
// resources for an instance of the requested effect engine and return
// a handle on the effect control interface.
// Input:
// uuid: pointer to the effect uuid.
// sessionId: audio session to which this effect instance will be attached. All effects
// created with the same session ID are connected in series and process the same signal
// stream. Knowing that two effects are part of the same effect chain can help the
// library implement some kind of optimizations.
// ioId: identifies the output or input stream this effect is directed to at audio HAL.
// For future use especially with tunneled HW accelerated effects
// Input/Output:
// pHandle: address where to return the effect interface handle.
// Output:
// returned value: 0 successful operation.
// -ENODEV library failed to initialize
// -EINVAL invalid pEffectUuid or pHandle
// -ENOENT no effect with this uuid found
// *pHandle: updated with the effect interface handle.
int32_t (*create_effect)(const effect_uuid_t *uuid,
int32_t sessionId,
int32_t ioId,
effect_handle_t *pHandle);
// Function: release_effect
// Description: Releases the effect engine whose handle is given as argument.
// All resources allocated to this particular instance of the effect are
// released.
// Input:
// handle: handle on the effect interface to be released.
// Output:
// returned value: 0 successful operation.
// -ENODEV library failed to initialize
// -EINVAL invalid interface handle
int32_t (*release_effect)(effect_handle_t handle);
// Function: get_descriptor
// Description: Returns the descriptor of the effect engine which implementation UUID is
// given as argument.
// Input/Output:
// uuid: pointer to the effect uuid.
// pDescriptor: address where to return the effect descriptor.
// Output:
// returned value: 0 successful operation.
// -ENODEV library failed to initialize
// -EINVAL invalid pDescriptor or uuid
// *pDescriptor: updated with the effect descriptor.
int32_t (*get_descriptor)(const effect_uuid_t *uuid,
effect_descriptor_t *pDescriptor);
} <API key>;
// Name of the hal_module_info
#define <API key> AELI
// Name of the hal_module_info as a string
#define <API key> "AELI"
// Values for bit field "mask" in buffer_config_t. If a bit is set, the corresponding field
// in buffer_config_t must be taken into account when executing the <API key> command
#define <API key> 0x0001 // buffer field must be taken into account
#define <API key> 0x0002 // samplingRate field must be taken into account
#define <API key> 0x0004 // channels field must be taken into account
#define <API key> 0x0008 // format field must be taken into account
#define <API key> 0x0010 // accessMode field must be taken into account
#define <API key> 0x0020 // bufferProvider field must be taken into account
#define EFFECT_CONFIG_ALL (<API key> | <API key> | \
<API key> | <API key> | \
<API key> | <API key>)
enum {
<API key> = 0,
<API key> = 0,
<API key> = 0,
<API key> = 0,
};
typedef enum {
<API key> = -1,
AUDIO_STREAM_MIN = 0,
<API key> = 0,
AUDIO_STREAM_SYSTEM = 1,
AUDIO_STREAM_RING = 2,
AUDIO_STREAM_MUSIC = 3,
AUDIO_STREAM_ALARM = 4,
<API key> = 5,
<API key> = 6,
<API key> = 7,
AUDIO_STREAM_DTMF = 8,
AUDIO_STREAM_TTS = 9,
<API key> = 10,
#ifndef <API key>
/** For dynamic policy output mixes. Only used by the audio policy */
<API key> = 11,
/** For audio flinger tracks volume. Only used by the audioflinger */
AUDIO_STREAM_PATCH = 12,
#endif // <API key>
} audio_stream_type_t;
typedef enum {
<API key> = 0,
AUDIO_SOURCE_MIC = 1,
<API key> = 2,
<API key> = 3,
<API key> = 4,
<API key> = 5,
<API key> = 6,
<API key> = 7,
<API key> = 8,
<API key> = 9,
<API key> = 1998,
#ifndef <API key>
/**
* A low-priority, preemptible audio source for for background software
* hotword detection. Same tuning as VOICE_RECOGNITION.
* Used only internally by the framework.
*/
<API key> = 1999,
#endif // <API key>
} audio_source_t;
typedef enum {
<API key> = -1,
<API key> = 0,
<API key> = 0,
AUDIO_SESSION_NONE = 0,
} audio_session_t;
typedef enum {
<API key> = 0xFFFFFFFFu,
<API key> = 0,
AUDIO_FORMAT_PCM = 0x00000000u,
AUDIO_FORMAT_MP3 = 0x01000000u,
AUDIO_FORMAT_AMR_NB = 0x02000000u,
AUDIO_FORMAT_AMR_WB = 0x03000000u,
AUDIO_FORMAT_AAC = 0x04000000u,
<API key> = 0x05000000u,
<API key> = 0x06000000u,
AUDIO_FORMAT_VORBIS = 0x07000000u,
AUDIO_FORMAT_OPUS = 0x08000000u,
AUDIO_FORMAT_AC3 = 0x09000000u,
AUDIO_FORMAT_E_AC3 = 0x0A000000u,
AUDIO_FORMAT_DTS = 0x0B000000u,
AUDIO_FORMAT_DTS_HD = 0x0C000000u,
<API key> = 0x0D000000u,
<API key> = 0x0E000000u,
AUDIO_FORMAT_EVRC = 0x10000000u,
AUDIO_FORMAT_EVRCB = 0x11000000u,
AUDIO_FORMAT_EVRCWB = 0x12000000u,
AUDIO_FORMAT_EVRCNW = 0x13000000u,
<API key> = 0x14000000u,
AUDIO_FORMAT_WMA = 0x15000000u,
<API key> = 0x16000000u,
<API key> = 0x17000000u,
AUDIO_FORMAT_MP2 = 0x18000000u,
AUDIO_FORMAT_QCELP = 0x19000000u,
AUDIO_FORMAT_DSD = 0x1A000000u,
AUDIO_FORMAT_FLAC = 0x1B000000u,
AUDIO_FORMAT_ALAC = 0x1C000000u,
AUDIO_FORMAT_APE = 0x1D000000u,
<API key> = 0x1E000000u,
AUDIO_FORMAT_SBC = 0x1F000000u,
AUDIO_FORMAT_APTX = 0x20000000u,
<API key> = 0x21000000u,
AUDIO_FORMAT_AC4 = 0x22000000u,
AUDIO_FORMAT_LDAC = 0x23000000u,
AUDIO_FORMAT_MAT = 0x24000000u,
<API key> = 0xFF000000u,
<API key> = 0x00FFFFFFu,
/* Subformats */
<API key> = 0x1u,
<API key> = 0x2u,
<API key> = 0x3u,
<API key> = 0x4u,
<API key> = 0x5u,
<API key> = 0x6u,
<API key> = 0x0u,
<API key> = 0x0u,
<API key> = 0x1u,
<API key> = 0x2u,
<API key> = 0x4u,
<API key> = 0x8u,
<API key> = 0x10u,
<API key> = 0x20u,
<API key> = 0x40u,
<API key> = 0x80u,
<API key> = 0x100u,
<API key> = 0x200u,
<API key> = 0x300u,
<API key> = 0x0u,
<API key> = 0x1u,
<API key> = 0x1u,
<API key> = 0x2u,
<API key> = 0x3u,
/* Aliases */
<API key> = 0x1u, // (PCM | PCM_SUB_16_BIT)
<API key> = 0x2u, // (PCM | PCM_SUB_8_BIT)
<API key> = 0x3u, // (PCM | PCM_SUB_32_BIT)
<API key> = 0x4u, // (PCM | PCM_SUB_8_24_BIT)
<API key> = 0x5u, // (PCM | PCM_SUB_FLOAT)
<API key> = 0x6u, // (PCM | <API key>)
<API key> = 0x4000001u, // (AAC | AAC_SUB_MAIN)
AUDIO_FORMAT_AAC_LC = 0x4000002u, // (AAC | AAC_SUB_LC)
<API key> = 0x4000004u, // (AAC | AAC_SUB_SSR)
<API key> = 0x4000008u, // (AAC | AAC_SUB_LTP)
<API key> = 0x4000010u, // (AAC | AAC_SUB_HE_V1)
<API key> = 0x4000020u, // (AAC | AAC_SUB_SCALABLE)
<API key> = 0x4000040u, // (AAC | AAC_SUB_ERLC)
AUDIO_FORMAT_AAC_LD = 0x4000080u, // (AAC | AAC_SUB_LD)
<API key> = 0x4000100u, // (AAC | AAC_SUB_HE_V2)
<API key> = 0x4000200u, // (AAC | AAC_SUB_ELD)
<API key> = 0x4000300u, // (AAC | AAC_SUB_XHE)
<API key> = 0x1e000001u, // (AAC_ADTS | AAC_SUB_MAIN)
<API key> = 0x1e000002u, // (AAC_ADTS | AAC_SUB_LC)
<API key> = 0x1e000004u, // (AAC_ADTS | AAC_SUB_SSR)
<API key> = 0x1e000008u, // (AAC_ADTS | AAC_SUB_LTP)
<API key> = 0x1e000010u, // (AAC_ADTS | AAC_SUB_HE_V1)
<API key> = 0x1e000020u, // (AAC_ADTS | AAC_SUB_SCALABLE)
<API key> = 0x1e000040u, // (AAC_ADTS | AAC_SUB_ERLC)
<API key> = 0x1e000080u, // (AAC_ADTS | AAC_SUB_LD)
<API key> = 0x1e000100u, // (AAC_ADTS | AAC_SUB_HE_V2)
<API key> = 0x1e000200u, // (AAC_ADTS | AAC_SUB_ELD)
<API key> = 0x1e000300u, // (AAC_ADTS | AAC_SUB_XHE)
<API key> = 0xA000001u, // (E_AC3 | E_AC3_SUB_JOC)
<API key> = 0x24000001u, // (MAT | MAT_SUB_1_0)
<API key> = 0x24000002u, // (MAT | MAT_SUB_2_0)
<API key> = 0x24000003u, // (MAT | MAT_SUB_2_1)
} audio_format_t;
enum {
FCC_2 = 2,
FCC_8 = 8,
};
enum {
<API key> = 0x0u,
<API key> = 0x2u,
AUDIO_CHANNEL_NONE = 0x0u,
<API key> = 0xC0000000u,
<API key> = 0x1u,
<API key> = 0x2u,
<API key> = 0x4u,
<API key> = 0x8u,
<API key> = 0x10u,
<API key> = 0x20u,
<API key> = 0x40u,
<API key> = 0x80u,
<API key> = 0x100u,
<API key> = 0x200u,
<API key> = 0x400u,
<API key> = 0x800u,
<API key> = 0x1000u,
<API key> = 0x2000u,
<API key> = 0x4000u,
<API key> = 0x8000u,
<API key> = 0x10000u,
<API key> = 0x20000u,
<API key> = 0x40000u,
<API key> = 0x80000u,
<API key> = 0x1u, // OUT_FRONT_LEFT
<API key> = 0x3u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT
<API key> = 0xBu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_LOW_FREQUENCY
<API key> = 0xC0003u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT
<API key> = 0xC000Bu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT | OUT_LOW_FREQUENCY
<API key> = 0xC0007u, // OUT_FRONT_LEFT | OUT_FRONT_CENTER | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT
<API key> = 0xC000Fu, // OUT_FRONT_LEFT | OUT_FRONT_CENTER | OUT_FRONT_RIGHT | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT | OUT_LOW_FREQUENCY
<API key> = 0x33u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_BACK_LEFT | OUT_BACK_RIGHT
<API key> = 0x33u, // OUT_QUAD
<API key> = 0x603u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_SIDE_LEFT | OUT_SIDE_RIGHT
<API key> = 0x107u, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_BACK_CENTER
<API key> = 0x37u, // OUT_QUAD | OUT_FRONT_CENTER
<API key> = 0x3Fu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT
<API key> = 0x3Fu, // OUT_5POINT1
<API key> = 0x60Fu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_SIDE_LEFT | OUT_SIDE_RIGHT
<API key> = 0xC003Fu, // OUT_5POINT1 | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT
<API key> = 0x2D03Fu, // OUT_5POINT1 | OUT_TOP_FRONT_LEFT | OUT_TOP_FRONT_RIGHT | OUT_TOP_BACK_LEFT | OUT_TOP_BACK_RIGHT
<API key> = 0x13Fu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT | OUT_BACK_CENTER
<API key> = 0x63Fu, // OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER | OUT_LOW_FREQUENCY | OUT_BACK_LEFT | OUT_BACK_RIGHT | OUT_SIDE_LEFT | OUT_SIDE_RIGHT
<API key> = 0xC063Fu, // OUT_7POINT1 | OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT
<API key> = 0x2D63Fu, // OUT_7POINT1 | OUT_TOP_FRONT_LEFT | OUT_TOP_FRONT_RIGHT | OUT_TOP_BACK_LEFT | OUT_TOP_BACK_RIGHT
<API key> = 0x4u,
<API key> = 0x8u,
<API key> = 0x10u,
<API key> = 0x20u,
<API key> = 0x40u,
<API key> = 0x80u,
<API key> = 0x100u,
<API key> = 0x200u,
<API key> = 0x400u,
<API key> = 0x800u,
<API key> = 0x1000u,
<API key> = 0x2000u,
<API key> = 0x10000u,
<API key> = 0x20000u,
<API key> = 0x40000u,
<API key> = 0x100000u,
<API key> = 0x200000u,
<API key> = 0x400000u,
<API key> = 0x4000u,
<API key> = 0x8000u,
<API key> = 0x10u, // IN_FRONT
<API key> = 0xCu, // IN_LEFT | IN_RIGHT
<API key> = 0x30u, // IN_FRONT | IN_BACK
AUDIO_CHANNEL_IN_6 = 0xFCu, // IN_LEFT | IN_RIGHT | IN_FRONT | IN_BACK | IN_LEFT_PROCESSED | IN_RIGHT_PROCESSED
<API key> = 0x60000Cu, // IN_LEFT | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT
<API key> = 0x70000Cu, // IN_LEFT | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT | IN_LOW_FREQUENCY
<API key> = 0x64000Cu, // IN_LEFT | IN_CENTER | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT
<API key> = 0x74000Cu, // IN_LEFT | IN_CENTER | IN_RIGHT | IN_TOP_LEFT | IN_TOP_RIGHT | IN_LOW_FREQUENCY
<API key> = 0x17000Cu, // IN_LEFT | IN_CENTER | IN_RIGHT | IN_BACK_LEFT | IN_BACK_RIGHT | IN_LOW_FREQUENCY
<API key> = 0x4010u, // IN_VOICE_UPLINK | IN_MONO
<API key> = 0x8010u, // IN_VOICE_DNLINK | IN_MONO
<API key> = 0xC010u, // <API key> | <API key>
<API key> = 30u,
<API key> = 0x80000000u, // <API key> << COUNT_MAX
<API key> = 0x80000001u, // INDEX_HDR | (1 << 1) - 1
<API key> = 0x80000003u, // INDEX_HDR | (1 << 2) - 1
<API key> = 0x80000007u, // INDEX_HDR | (1 << 3) - 1
<API key> = 0x8000000Fu, // INDEX_HDR | (1 << 4) - 1
<API key> = 0x8000001Fu, // INDEX_HDR | (1 << 5) - 1
<API key> = 0x8000003Fu, // INDEX_HDR | (1 << 6) - 1
<API key> = 0x8000007Fu, // INDEX_HDR | (1 << 7) - 1
<API key> = 0x800000FFu, // INDEX_HDR | (1 << 8) - 1
};
|
jQuery(function($) {
// META BOXES JS
jQuery('.repeatable-add').live('click', function() {
var field = jQuery(this).closest('td').find('.custom_repeatable li:last').clone(true);
var fieldLocation = jQuery(this).closest('td').find('.custom_repeatable li:last');
field.find('input.regular-text, textarea, select').val('');
field.find('input, textarea, select').attr('name', function(index, name) {
return name.replace(/(\d+)/, function(fullMatch, n) {
return Number(n) + 1;
});
});
field.insertAfter(fieldLocation, jQuery(this).closest('td'));
var fieldsCount = jQuery('.repeatable-remove').length;
if( fieldsCount > 1 ) {
jQuery('.repeatable-remove').css('display','inline');
}
return false;
});
var fieldsCount = jQuery('.repeatable-remove').length;
if( fieldsCount == 1 ) {
jQuery('.repeatable-remove').css('display','none');
}
jQuery('.repeatable-remove').live('click', function() {
jQuery(this).parent().remove();
var fieldsCount = jQuery('.repeatable-remove').length;
if( fieldsCount == 1 ) {
jQuery('.repeatable-remove').css('display','none');
}
return false;
});
jQuery('.custom_repeatable').sortable({
opacity: 0.6,
revert: true,
cursor: 'move',
handle: '.sort'
});
// the upload image button, saves the id and outputs a preview of the image
var imageFrame;
$('.<API key>').live('click', function(event) {
event.preventDefault();
var options, attachment;
$self = $(event.target);
$div = $self.closest('div.rg-bb_image');
// if the frame already exists, open it
if ( imageFrame ) {
imageFrame.open();
return;
}
// set our settings
imageFrame = wp.media({
title: 'Choose Image',
multiple: true,
library: {
type: 'image'
},
button: {
text: 'Use This Image'
}
});
// set up our select handler
imageFrame.on( 'select', function() {
selection = imageFrame.state().get('selection');
if ( ! selection )
return;
// loop through the selected files
selection.each( function( attachment ) {
console.log(attachment);
var src = attachment.attributes.sizes.full.url;
var id = attachment.id;
$div.find('.rg-bb_preview_image').attr('src', src);
$div.find('.rg-bb_upload_image').val(id);
} );
});
// open the frame
imageFrame.open();
});
// the remove image link, removes the image id from the hidden field and replaces the image preview
$('.<API key>').live('click', function() {
var defaultImage = $(this).parent().siblings('.rg-bb_default_image').text();
$(this).parent().siblings('.rg-bb_upload_image').val('');
$(this).parent().siblings('.rg-bb_preview_image').attr('src', defaultImage);
return false;
});
// function to create an array of input values
function ids(inputs) {
var a = [];
for (var i = 0; i < inputs.length; i++) {
a.push(inputs[i].val);
}
//$("span").text(a.join(" "));
}
// repeatable fields
$('.toggle').on("click", function() {
console.log($(this).parent().siblings().toggleClass('closed'));
});
$('.<API key>').live('click', function(e) {
e.preventDefault();
// clone
var row = $(this).closest('.meta_box_repeatable').find('tbody tr:last-child');
var clone = row.clone();
var defaultImage = clone.find('.<API key>').text();
clone.find('select.chosen').removeAttr('style', '').removeAttr('id', '').removeClass('chzn-done').data('chosen', null).next().remove();
// clone.find('input.regular-text, textarea, select').val('');
clone.find('.<API key>').attr('src', defaultImage).removeClass('loaded');
clone.find('input[type=checkbox], input[type=radio]').attr('checked', false);
row.after(clone);
// increment name and id
clone.find('input, textarea, select').attr('name', function(index, name) {
return name.replace(/(\d+)/, function(fullMatch, n) {
return Number(n) + 1;
});
});
var arr = [];
$('input.repeatable_id:text').each(function(){ arr.push($(this).val()); });
clone.find('input.repeatable_id')
.val(Number(Math.max.apply( Math, arr )) + 1);
if (!!$.prototype.chosen) {
clone.find('select.chosen')
.chosen({<API key>: true});
}
});
$('.<API key>').live('click', function(e){
e.preventDefault();
$(this).closest('tr').remove();
});
$('.meta_box_repeatable tbody').sortable({
opacity: 0.6,
revert: true,
cursor: 'move',
handle: '.hndle'
});
// post_drop_sort
$('.sort_list').sortable({
connectWith: '.sort_list',
opacity: 0.6,
revert: true,
cursor: 'move',
cancel: '.<API key>',
items: 'li:not(.<API key>)',
update: function(event, ui) {
var result = $(this).sortable('toArray');
var thisID = $(this).attr('id');
$('.store-' + thisID).val(result)
}
});
$('.sort_list').disableSelection();
// turn select boxes into something magical
if (!!$.prototype.chosen)
$('.chosen').chosen({ <API key>: true });
});
|
html {
font-size: 62.5%;
}
body {
font-size: 12px; /* ie < 9 sucks */
font-size: 1.2rem;
line-height: 1.5;
font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
margin: 0;
padding: 0;
}
*, *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#header {
background: #676e78;
color: #FFF;
border-bottom: 4px solid #A2CBE9;
width: 100%;
display: table;
position: relative;
}
#wrapper {
position: relative;
padding-top: 1.5em;
float: left;
width: 100%;
z-index: 10;
background: #F7F7F7 url(bg_wrapper.png) repeat-y 15em;
}
.with-js #wrapper {
padding-top: 0;
}
#main {
width: 100%;
float: right;
margin-left: -14em;
margin-top: 0;
}
#content {
margin: 0 0 0 14em;
padding: .5em 1.5em .75em 2.5em;
background: #fff;
}
#main-menu {
width: 14em;
float: left;
margin: 0;
padding-top: .5em;
padding-bottom: 1em;
overflow: hidden;
background: #f7f7f7;
}
#footer {
clear: both;
position: relative;
padding: .5em 1em .5em 0;
text-align: right;
border-top: 1px solid #ccc;
background-color: #fff;
}
/* to hide main-menu */
#collapser {
position: absolute;
top: 0;
left: 14em;
width: 15px;
height: 100%;
overflow: hidden;
display: block;
background: #f3f3f3 url(../images/collapser-hide.png) no-repeat center bottom;
border-right: double #dfdfdf;
z-index: 1;
}
.expand-mm {
display: none;
}
/* if main-menu is hidden */
#wrapper.hide-mm {
background: #fff;
}
.hide-mm #main {
margin-left: 0;
}
.hide-mm #content {
margin-left: 1em;
}
.hide-mm #main-menu {
display: none;
}
.hide-mm #collapser {
left: 0;
background: #e3e3e3 url(../images/collapser-show.png) no-repeat center bottom;
}
.hide-mm .collapse-mm {
display: none;
}
.hide-mm .expand-mm {
display: block;
}
.two-cols {
position: static;
}
.two-cols .col {
width: 48%;
margin-left: 2%;
float: left;
}
.two-cols .col70 {
width: 68%;
margin-left: 0;
float: left;
}
.col30 {
width: 28%;
margin-left: 2%;
float: left;
}
.two-cols .col:first-child,
.two-cols .col30.first-col {
margin-left: 0;
margin-right: 2%;
}
.two-cols .col:last-child,
.two-cols .col70.last-col {
margin-left: 2%;
margin-right: 0;
}
.two-cols table {
width: 90%;
}
.three-cols {
position: static;
}
.three-cols .col {
width: 32.3%;
float: left;
margin-left: 1%;
}
.three-cols .col:first-child {
margin-left: 0;
}
.one-box {
text-align: justify;
}
.two-boxes {
width: 48.5%;
}
.three-boxes {
width: 30%;
}
.two-boxes, .three-boxes {
display: inline-block;
vertical-align: top;
margin: 0 1.5% 1em;
text-align: left;
}
.two-boxes:nth-of-type(odd), .three-boxes:nth-of-type(3n+1) {
margin-left: 0;
}
.two-boxes:nth-of-type(even), .three-boxes:nth-of-type(3n) {
margin-right: 0;
}
.popup h1 {
display: block;
width: 100%;
margin: 0;
background: #676e78;
font-size: 1.5em;
text-indent: 1em;
line-height: 1.5em;
font-weight: normal;
color: #fff;
}
.popup #wrapper {
display: block;
float: none;
width: 100%;
margin: 0;
padding: 0;
background-position: 0 0;
}
.popup #main {
margin: 0;
padding: 0;
}
.popup #content {
margin: 0;
padding: 1em;
}
.popup #content h2 {
margin: 0 0 1em 0;
padding: 0;
}
.popup #footer p {
border: none;
}
.constrained {
margin: 0;
padding: 0;
border: none;
background: transparent;
}
.table {
display: table;
}
.cell {
display: table-cell;
vertical-align: top;
}
.clear {
clear: both;
}
.lclear {
clear: left;
}
.clearer {
height: 1px;
font-size: 1px;
}
/* Micro clearfix thx to Nicolas Gallagher */
.clearfix:before, .clearfix:after {
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}
.frame-shrink {
border: 1px solid #676e78;
padding: 0.5em;
margin-bottom: 1em;
height: 120px;
overflow: auto;
}
.box {
display: inline-block;
vertical-align: top;
margin: 0 10px 10px;
text-align: left;
}
.box.small {
width: 312px;
}
.box.medium {
width: 644px;
}
.box.large {
width: 100%;
}
.odd {
margin-left: 0;
}
.even {
margin-right: 0;
}
body {
color: #333;
background: #fff;
}
h1, h2, h3, .as_h3, h4, .as_h4, h5, h6 {
margin-top: 0;
margin-bottom: 1em;
}
h2 {
color: #676e78;
font-size: 1.5em;
padding: 0 0 1.5em;
font-weight: normal;
line-height: 1.25;
}
/* fil d'ariane */
#content > h2 {
padding: 0 1em .5em 1em;
margin: 0 -1em 1em -1em;
background: #fff url(bg_h2.png) repeat-x center bottom;
}
h2 a:link, h2 a:visited {
color: #676e78;
border-color: #000;
}
/* page courante dans le fil d'ariane */
.page-title {
color: #d30e60;
}
.page-title img {
padding-left: .5em;
vertical-align: middle;
}
/* autres titres */
h3, .as_h3 {
margin-top: 1em;
color: #D33800;
font-weight: normal;
font-size: 1.34em;
}
#main-menu h3 {
font-weight: bold;
}
h4, .as_h4 {
font-size: 1.16em;
color: #676e78;
}
.fieldset h3, .fieldset h4, .pretty-title {
color: #D33800;
font-size: 1em;
font-weight: bold;
}
.fieldset h3 {
font-size: 1.17em;
}
.fieldset h3.smart-title, .fieldset h4.smart-title, .smart-title {
font-size: 1em;
text-transform: uppercase;
font-weight: bold;
color: #333;
text-shadow: 0 1px 0 rgba(200, 200, 200, 0.6)
}
h5 {
font-size: 1em;
font-weight: bold;
color: #676e78;
}
#entry-sidebar h5 {
font-weight: normal;
color: #333;
}
.entry-status img.img_select_option {
padding-left: 4px;
vertical-align: text-top;
}
h4 label, h5 label {
color: #333;
}
h2:first-child, h3:first-child, h4:first-child, h5:first-child, ul:first-child, p:first-child {
margin-top: 0;
}
/* Pour autoriser le scroll sur les petites largeurs
envelopper les tableaux dans une div.table-outer */
.table-outer {
width: 100%;
overflow: auto;
}
table {
font-size: 1em;
border-collapse: collapse;
margin: 0 0 1em 0;
width: 100%;
}
caption {
color: #333;
font-weight: bold;
text-align: left;
margin-bottom: .5em;
}
th {
border-width: 1px 0 1px 0;
border-style: solid;
border-color: #dfdfdf;
background: #eef1ec;
padding: .4em 1em .4em .5em;
vertical-align: top;
text-align: left;
}
td {
border-width: 0 0 1px 0;
border-style: solid;
border-color: #e3e3e3;
padding: .4em 1em .4em .5em;
vertical-align: top;
}
p {
margin: 0 0 1em 0;
}
hr {
height: 1px;
border-width: 1px 0 0;
border-color: #dfdfdf;
background: #dfdfdf;
border-style: solid;
}
hr.clearer {
clear: both;
}
pre, code, #debug {
font: 100% "Andale Mono","Courier New",monospace;
}
code {
background: #fefacd;
}
pre {
white-space: pre;
white-space: -moz-pre-wrap;
white-space: pre-wrap;
white-space: pre-line;
word-wrap: break-word;
}
abbr {
cursor: help;
}
input, textarea, select, option, optgroup, legend,label {
font-size: 1em;
}
a, a:link, a:visited {
color: #2373A8;
text-decoration: none;
border-bottom: 1px dotted #999;
background-color: inherit;
outline: 0;
}
a:hover, a:active {
border-bottom-style: solid;
}
a img, a:link img, a:visited img {
border: none;
background: inherit;
}
h1 a:link, h1 a:visited {
border: none;
}
.discrete a {
color: #333;
}
a:link {
transition: .5s;
}
a:focus, a:focus img {
outline: 2px solid #bee74b;
border-bottom: none;
text-decoration: none;
}
input[type=text], input[type=password], input[type=submit],
input[type=button], input[type=reset], a.button, button, textarea, select, legend {
border-radius: 3px;
max-width: 100%;
}
form {
display: block;
margin: 0;
padding: 0;
}
fieldset {
display: block;
margin: 1em 0;
padding: 1em 0.5em;
border-width: 1px 0;
border-style: solid;
border-color: #ccc;
background: #f7f7f7;
}
input[type=text], textarea {
font: 100% "DejaVu Sans","Lucida Grande","Lucida Sans Unicode",Arial,sans-serif;
}
legend {
padding: 0.2em 0.6em;
border-width: 1px;
border-style: solid;
border-color: #676e78;
background: #fff;
margin-bottom: 0.5em;
}
label .maximal, textarea.maximal, input.maximal, select.maximal {
width: 99%;
}
input[type=text], input[type=password], textarea, select {
background: #fcfcfc;
color: #000;
border-width: 1px;
border-style: solid;
border-color: #dfdfdf;
box-shadow: 1px 1px 2px #f3f3f3 inset;
padding: 3px;
vertical-align: top;
}
input:focus, textarea:focus, select:focus {
border-color: #9bca1c;
}
textarea {
padding: 2px 0;
}
textarea.maximal {
resize: vertical;
}
.area textarea {
display: block;
width: 100%;
resize: vertical;
}
select {
padding: 2px 0;
vertical-align: middle;
}
select.l10n option {
padding-left: 16px;
}
option.avail10n {
background: transparent url(../images/check-on.png) no-repeat 0 50%;
}
option.sub-option1 {
margin-left: .5em;
}
option.sub-option2 {
margin-left: 1.5em;
}
option.sub-option3 {
margin-left: 2.5em;
}
option.sub-option4 {
margin-left: 3.5em;
}
option.sub-option5 {
margin-left: 4.5em;
}
option.sub-option6 {
margin-left: 5.5em;
}
option.sub-option7 {
margin-left: 6.5em;
}
option.sub-option8 {
margin-left: 7.5em;
}
option.sub-option1:before, option.sub-option2:before, option.sub-option3:before, option.sub-option4:before,
option.sub-option5:before, option.sub-option6:before, option.sub-option7:before, option.sub-option8:before {
content: "\002022\0000a0";
}
input.invalid, textarea.invalid, select.invalid {
border: 1px solid red;
background: #FFBABA;
color: #900;
box-shadow: 0 0 0 3px rgba(218, 62, 90, 0.3);
}
input[type=text], input[type=password], textarea {
margin-right: .3em;
}
input[type=checkbox], input[type=radio], input[type=file] {
border: none;
margin: 0 .33em 0 0;
padding: 0;
background: transparent;
}
input[type=file] {
margin-top: .3em;
margin-bottom: .3em;
}
optgroup {
font-weight: bold;
font-style: normal;
}
option {
font-weight: normal;
}
label, label span {
display: block;
}
label.ib, input.ib {
display: inline-block;
}
label.classic {
display: inline;
}
label.classic input, label span input, label.classic select, label span select {
display: inline;
}
label.required {
font-weight: bold;
}
label.required abbr {
color: #900;
font-size: 1.3em;
}
label.bold {
text-transform: uppercase;
font-weight: bold;
margin-top: 2em;
}
label.area, p.area {
width: inherit !important;
}
p.field {
position: relative;
}
p.field label {
display: inline-block;
width: 14em;
}
p.field.wide label {
width: 21em;
}
p.field input, p.field select {
display: inline-block;
}
.form-note {
font-style: italic;
font-weight: normal;
color: #676e78;
}
p.form-note {
margin-top: -.7em;
}
span.form-note {
text-transform: none;
}
/* Removes inner padding and border in FF3+ - Knacss */
button::-moz-focus-inner,
input[type=button]::-moz-focus-inner,
input[type=reset]::-moz-focus-inner,
input[type=submit]::-moz-focus-inner {
border: 0;
padding: 0;
}
/* tous les boutons */
button,
a.button,
input[type=button],
input[type=reset],
input[type=submit] {
border: 1px solid #ccc;
font-family: "DejaVu Sans","Lucida Grande","Lucida Sans Unicode",Arial,sans-serif;
padding: 3px 10px;
line-height: normal !important;
display: inline-block;
font-size: 100%;
text-align: center;
text-decoration: none;
cursor: pointer;
position: relative;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
border-style: solid;
border-width: 1px;
}
button,
input[type=button],
input[type=reset],
input[type=submit] {
-webkit-appearance: button;
}
/* validation */
input[type=submit], a.button.submit, input.button.start {
color: #fff;
background-color: #25A6E1;
background-image: -webkit-gradient(linear,left top,left bottom, from(#25A6E1), to(#188BC0));
background-image: linear-gradient(#25A6E1,#188BC0);
border-color: #25A6E1;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
input[type=submit]:hover, input[type=submit]:focus,
input.button.start:hover, input.button.start:focus,
a.button.submit:hover, a.button.submit:focus {
background-color: #188BC0;
background-image: -webkit-gradient(linear,left top,left bottom, from(#188BC0),to(#25A6E1));
background-image: linear-gradient(#188BC0,#25A6E1);
border-color: #188BC0;
}
/* suppression, reset, "neutres" fond gris */
button, input[type=button], input.button,
input[type=reset], input[type=submit].reset, input.reset,
input[type=submit].delete, input.delete,
a.button, a.button.delete, a.button.reset {
color: #000;
background-color: #EAEAEA;
background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#EAEAEA));
background-image: linear-gradient(#f9f9f9,#EAEAEA);
background-repeat: repeat-x;
border-color: #dfdfdf #dfdfdf #C5C5C5;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}
button:hover, input[type=button]:hover, input.button:hover,
button:focus, input[type=button]:focus, input.button:focus,
input[type=reset]:hover, input[type=submit].reset:hover, input.reset:hover,
input[type=reset]:focus, input[type=submit].reset:focus, input.reset:focus,
input[type=submit].delete:hover, input.delete:hover,
input[type=submit].delete:focus, input.delete:focus,
a.button.delete:hover, a.button.reset:hover, a.button:hover,
a.button.delete:focus, a.button.reset:focus, a.button:focus {
background-color: #DADADA;
background-image: -webkit-gradient( linear, left top, left bottom, from(#EAEAEA), to(#DADADA));
background-image: linear-gradient(#EAEAEA, #DADADA);
background-repeat: repeat-x;
border-color: #CCCCCC #CCCCCC #B5B5B5;
}
/* suppression */
input[type=submit].delete, input.delete, a.button.delete {
color: #900;
}
input[type=submit].delete:hover, input.delete:hover, a.button.delete:hover,
input[type=submit].delete:focus, input.delete:focus, a.button.delete:focus {
color: #FFFFFF;
background-color: #B33630;
background-image: -webkit-gradient( linear, left top, left bottom, from(#DC5F59), to(#B33630));
background-image: linear-gradient(#DC5F59, #B33630);
background-repeat: repeat-x;
border-color: #CD504A;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
}
#info-box a.button {
padding: 0 .5em;
margin-left: 2em;
}
.button.add {
color: #000;
background-color: #bee74b;
background-image: -webkit-gradient(linear, left top, left bottom, from(#bee74b), to(#9BCA1C));
background-image: linear-gradient(#bee74b, #9BCA1C);
border-color: #bee74b;
padding: .33em 1.33em .5em;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
font-weight: normal;
font-size: 1.16em;
}
.button.add:hover, .button.add:active, .button.add:focus {
background-color: #9BCA1C;
background-image: -webkit-gradient(linear, left top, left bottom, from(#9BCA1C), to(#bee74b));
background-image: linear-gradient(#9BCA1C, #bee74b);
border-color: #9BCA1C;
}
.button-add:focus {
outline: dotted 1px;
}
/* paragraphe pour bouton Nouveau bidule */
p.top-add {
text-align: right;
margin: 0;
}
/* disabled */
input.disabled, input[type=submit].disabled {
text-shadow: none;
color: #676e78;
background: #F5F5F5;
border: 1px solid #CCC;
}
input.disabled:hover, input[type=submit].disabled:hover {
color: #676e78;
background: #eee;
border: 1px solid #CCC;
}
.warn, .warning, .info {
font-style: normal;
padding: .2em .66em .2em;
text-indent: 24px;
color: #333;
display: inline-block;
line-height: 1.5em;
border-radius: 3px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6)
}
div.warn, div.warning, div.info {
display: block;
padding: 1em 1em .33em 1em;
margin-bottom: 1em;
}
.warn, .warning {
background: #FEFACD url(msg-warning.png) no-repeat .3em .3em;
border: 1px solid #ffd478;
}
.info {
background: #D9EDF7 url(msg-info.png) no-repeat .3em .3em;
border: 1px solid #BCE8F1;
}
span.warn, span.warning, span.info {
padding-top: 1px;
padding-bottom: 1px;
background-position: .3em .2em;
}
.error, .message, .static-msg, .success, .warning-msg {
padding: 1em 0.5em 0.5em 48px;
margin-bottom: 1em;
border-radius: 8px;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}
p.error, p.message, p.static-msg, p.success, p.warning-msg {
padding-top: 1em;
padding-bottom: 1em;
margin-top: .5em;
}
.error {
background: #FFBABA url(msg-error.png) no-repeat .7em .7em;
color: #000;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}
.message, .static-msg {
background: #676e78 url(msg-std.png) no-repeat .7em .7em;
color: #fff;
}
.message a, .static-msg a, .message h3, .static-msg h3 {
color: #fff;
}
.success, .warning-msg {
color: #000;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6)
}
.success {
background: #9bca1c url(msg-success.png) no-repeat .7em .7em;
}
.warning-msg {
background: #ffd478 url(msg-warning.png) no-repeat .7em .7em;
border: 1px solid #ffd478;
}
.success a, .warning-msg a, .info a {
color: #333;
}
.dc-update {
padding: 1em 48px 0.5em 48px;
margin-bottom: 1em;
border-radius: 8px;
background: #A2CBE9 url(msg-success.png) no-repeat .7em .7em;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
color: #000;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1)
}
.dc-update h3 {
margin-top: 0;
color: #000;
}
.dc-update p {
display: inline-block;
vertical-align: middle;
}
.dc-update a {
color: #000;
margin-right: 1em;
}
.dc-update a.button {
padding: .5em 1em;
}
.updt-info a {
margin-left: 2em;
border-color: #000;
font-weight: bold;
}
/* prelude */
#prelude {
line-height: 1.5;
margin: 0;
padding: 0;
overflow: hidden;
position: absolute;
top: 3em;
left: 0;
background: #A2CBE9;
width: 100%;
z-index: 100;
}
#prelude li {
list-style-type: none;
margin: 0;
background: transparent;
display: inline;
}
#prelude li a {
padding: 3px 16px 3px 8px;
background: #A2CBE9;
color: #000;
text-decoration: underline;
}
#prelude li a:hover, #prelude li a:focus {
background: #FFF;
}
#wrapper.with-prelude {
padding-top: 1em;
}
#help-button.with-prelude, #collapser.with-prelude {
top: 1em;
}
/* header global h1, form#top-info-blog, ul#top-info-user */
#header a {
color: #FFF;
}
#header img {
vertical-align: middle;
padding-left: .5em;
}
h1, #top-info-blog, #top-info-user {
display: table-cell;
padding: 8px 0;
margin: 0;
font-size: 1em;
vertical-align: top;
}
h1 {
text-indent: 100%;
width: 16.5em;
}
h1 a {
position: absolute;
top: 0;
left: 0;
width: 150px;
height: 3em;
color: #fff;
background: transparent url(dc_logos/b-dotclear120.png) no-repeat 0 6px;
transition: none;
}
h1 a:hover, h1 a:focus {
background-position: 0 -94px;
background-color: transparent;
transition: none;
}
/* top-info-blog */
#top-info-blog select {
max-width: 20em;
}
#top-info-blog a {
margin-left: 1.5em;
}
#top-info-blog input[type=submit] {
background: #000;
border-color: #999;
margin-left: .33em;
}
#top-info-blog input[type=submit]:hover {
background: #999;
}
#top-info-blog p {
display: inline-block;
margin: 0;
}
/* top-info-user */
#top-info-user {
padding-right: 18px;
list-style-type: none;
text-align: right;
}
#top-info-user li {
display: inline-block;
margin-left: .5em;
padding-left: .5em;
border-left: 1px solid #999;
}
#top-info-user li:first-child {
border-left: none;
}
#top-info-user a.active {
border-bottom-color: #fff;
margin: 0;
padding: 18px .5em;
background-color: #fff;
color: #333;
font-weight: bold;
}
#favorites-menu, #blog-menu, #system-menu, #plugins-menu {
border-bottom: 1px dashed #A2CBE9;
}
#main-menu h3 {
margin: 0;
padding: 10px 0 10px 8px;
color: #676e78;
font-size: 1.15em;
}
#favorites-menu h3 {
color: #000;
font-variant: small-caps;
padding-top: .2em;
}
#main-menu a {
color: #333;
border-bottom-color: #ccc;
}
#main-menu ul {
margin: 0 0 1.5em 0;
padding: 0;
list-style: none;
}
#main-menu li {
display: block;
margin: 0.5em 0 0;
padding: 4px 0 1px 32px;
background-repeat: no-repeat;
background-position: 8px .3em;
}
#main-menu ul li:first-child {
margin-top: 0;
}
#main-menu li.active {
background-color: #fff;
font-weight: bold;
}
#favorites-menu li.active {
background-color: transparent;
}
#main-menu .active a {
border-bottom: none;
color: #d30e60;
}
#favorites-menu .active a {
color: #000;
}
#search-menu {
padding: 4px 5px 0;
font-size: 100%
}
#search-menu * {
height: 2em;
display: inline-block;
vertical-align: top;
line-height: 24px;
}
#search-menu p {
border: 1px solid #999;
border-radius: .3em;
position: relative;
width: 95%;
overflow: hidden;
}
width: 80%;
<API key>: .3em;
<API key>: .3em;
background: transparent url(search.png) no-repeat 4px center;
text-indent: 18px;
padding: 0;
border: none;
height: 2em;
}
#qx:focus {
border: 1px solid #bee74b;
}
#search-menu input[type="submit"] {
padding: 0 .25em;
margin-left: .33em;
background: #dfdfdf;
border-color: #999;
color: #333;
<API key>: .3em;
<API key>: .3em;
<API key>: 0;
<API key>: 0;
text-shadow: none;
border: none;
border-left: 1px solid #999;
font-size: .91em;
float: right;
}
#search-menu input[type="submit"]:hover,
#search-menu input[type="submit"]:focus {
background: #676e78;
color: #fff;
}
.part-tabs ul {
padding: .5em 0 0 1em;
border-bottom: 1px solid #ccc;
line-height: 1.8;
}
.part-tabs li {
list-style: none;
margin: 0;
display: inline;
}
.part-tabs li:first-child a {
<API key>: 3px;
}
.part-tabs li:last-child a {
<API key>: 3px;
}
.part-tabs li a {
padding: .33em 1.5em;
margin-right: -1px;
border: 1px solid #ccc;
border-bottom: none;
text-decoration: none;
color: #333;
background-color: #ecf0f1;
display: inline-block;
}
.part-tabs li a:hover, .part-tabs li a:focus {
color: #000;
background: #fff;
border-bottom-color: #fff;
}
.part-tabs li.part-tabs-active a {
background: #fff;
font-weight: bold;
border-bottom-color: #fff;
}
.multi-part {
padding-left: 1em;
}
.pseudo-tabs {
margin: -.75em 0 2em 0;
border-bottom: 1px solid #bbb;
display: table;
width: 100%;
padding: 0;
line-height: 24px;
border-collapse: collapse;
}
.pseudo-tabs li {
display: table-cell;
border-width: 0 1px;
border-style: solid;
border-color: #ccc;
padding: 0;
margin: 0;
text-align: center;
}
.pseudo-tabs a {
display: block;
font-weight: bold;
padding: 0 24px;
border-bottom: none;
}
.pseudo-tabs a:hover, .pseudo-tabs a:focus {
background-color: #ecf0f1;
color: #333;
}
.pseudo-tabs a.active {
background-color: #ecf0f1;
color: #d30e60;
}
/* contextual help */
#help {
margin-top: 4em;
background: #f5f5f5;
z-index: 100;
clear: both;
padding: 0 1em;
}
#content.with-help #help {
display: block;
position: absolute;
top: 0;
right: 0;
width: 24em;
border-left: 2px solid #FFD478;
border-top: 2px solid #FFD478;
margin-top: 0;
padding: .5em 0 0 0;
overflow: auto;
}
#help-button {
background: transparent url(help-mini.png) no-repeat 6px center;
position: absolute;
top: 0;
right: 0;
padding: 0 1.5em 0 30px;
cursor: pointer;
color: #2373A8;
line-height: 3;
}
#help-button.floatable {
border-top: 2px solid #ccc;
border-left: 2px solid #ccc;
border-bottom: 2px solid #ccc;
<API key>: 1em;
<API key>: 1em;
background-color: #f5f5f5;
position: fixed;
top: 10px;
-webkit-transform:translateZ(0); /* Let GPU doing his job */
}
.no-js #help-button {
top: 1em;
}
#help-button span {
padding: .5em 0 .1em 0;
}
#content.with-help #help-button {
right: 24em;
background-color: #f5f5f5;
position: fixed;
top: 50px;
z-index: 100;
border-top: 2px solid #FFD478;
border-left: 2px solid #FFD478;
border-bottom: 2px solid #FFD478;
<API key>: 1em;
<API key>: 1em;
}
.help-box {
display: none;
}
.help-box ul {
padding-left: 20px;
margin-left: 0;
}
#content.with-help .help-content {
padding: 0 1em 1em;
}
.help-content dt {
font-weight: bold;
color: #676e78;
margin: 0;
}
.help-content dd {
margin: 0.3em 0 1.5em 0;
}
#helplink p {
padding: 0 0 0 .5em;
}
#footer p {
margin: 0;
padding: 0 1em;
font-size: 1em;
}
span.credit {
font-size: 1em;
font-weight: normal;
}
span.tooltip {
position: absolute;
padding: 0;
border: 0;
height: 1px;
width: 1px;
overflow: hidden;
}
#footer a:hover span.tooltip {
padding: 10px 10px 0 40px;
color: #d30e60;
height: auto;
width: auto;
right: 0;
bottom: 0;
background: #FFF;
z-index: 99;
font-family: monospace;
border: none;
text-align: left;
}
table .maximal, table.maximal {
width: 100%;
}
table .minimal {
width: 1px;
}
table .nowrap {
white-space: nowrap;
vertical-align: top;
}
table .count {
text-align: right;
padding-right: 1.5em;
}
th.first input {
padding-right: 34px;
}
.line img {
vertical-align: middle;
}
tr.line img.expand, th img.expand {
margin-right: 6px;
margin-bottom: -2px;
}
tr.line p {
margin: 0;
}
tr.line input[type=text] {
background: #FFF;
}
tr.line input, tr.line select {
vertical-align: middle;
-webkit-box-shadow: none;
box-shadow: none;
}
tr.line select {
width: 6em;
}
tr.line:hover {
background: #f3f3f3;
}
td.status {
vertical-align: middle;
}
td.status img {
margin-bottom: -2px;
}
td.status a {
border: none;
}
.noborder td, td.noborder, .noborder th, th.noborder {
border-width: 0 0 1px 0;
border-color: #dfdfdf;
line-height: 2em;
padding-bottom: 0;
}
.noborder p {
margin-bottom: 0;
}
table.posts-list {
min-width: 50%;
}
table.settings, table.prefs {
margin-bottom: 3em;
}
table.settings th:first-child, table.prefs th:first-child {
width: 20%;
}
table.settings th + th, table.prefs th + th {
width: 30%;
}
table.settings th + th + th, table.prefs th + th + th {
width: 10%;
}
table.settings th:last-child, table.prefs th:last-child {
width: 40%;
}
td.expand {
padding: 1em;
}
tr.expand td {
border-bottom: none;
}
.handle {
padding: 0;
}
.handler {
cursor: move;
background: transparent url(drag.png) no-repeat 0 50%;
padding-left: 15px;
}
a.form-control {
display: none;
background: url(../images/expand.png) no-repeat 4px center;
padding-left: 20px;
color: #000;
}
a.form-control.open {
background: url(../images/hide.png) no-repeat 4px center;
}
#filters-form {
border: 1px dashed #999;
border-radius: .3em;
margin-bottom: 2em;
padding: .5em 1em 0;
}
#filters-form .table {
width: 100%;
padding: 0;
margin-bottom: 1em;
margin-top: .5em;
}
#filters-form .cell {
padding: 0 2em 0 0;
}
#filters-form .<API key> {
padding-top: 3.8em;
}
#filters-form .filters-options {
padding-left: 2em;
border-left: 1px solid #ccc;
}
#filters-form label.ib, span.ib {
width: 7em;
}
#filters-form label.ibw, span.ibw {
width: 9em;
display: inline-block;
}
#filters-form select {
width: 14em;
vertical-align: middle;
}
#filters-form h4 {
margin-top: 0;
margin-bottom: 2em;
}
#login-screen {
display: block;
width: 20em;
margin: 1.5em auto 0;
font-size: 1.16em;
}
#login-screen h1 {
text-indent: -2000px;
background: transparent url(dc_logos/w-dotclear240.png) no-repeat top left;
height: 66px;
width: 20em;
margin-bottom: .5em;
margin-left: 0;
}
#login-screen .fieldset {
border: 1px solid #9bca1c;
padding: 1em 1em 0 1em;
background: #fff;
margin-bottom: 0;
margin-top: 1em;
}
#login-screen input[type=text], #login-screen input[type=password], #login-screen input[type=submit],
#login-screen input[type=text]:focus, #login-screen input[type=password]:focus, #login-screen input[type=submit]:focus {
width: 100%;
margin: 0;
padding: 5px 3px;
}
#login-screen input.login, #login-screen input.login:focus {
padding-top: 6px;
padding-bottom: 6px;
font-size: 1em;
}
#login-screen #issue {
margin-left: 1.33em;
font-size: .91em;
}
#issue p:first-child {
text-align: right;
}
#login-screen #issue strong {
font-weight: normal;
}
#dashboard-main {
padding: 1em;
text-align: center;
}
/* raccourcis */
#icons {
overflow: hidden;
padding-bottom: 1em;
text-align: center;
}
#icons p {
width: 14em;
text-align: center;
margin: 1em 0 2em;
padding: 1em 0;
display: inline-block;
vertical-align: top;
}
#icons a,
#icons a:link,
#icons a:visited,
#icons a:hover,
#icons a:focus {
border-bottom-width: 0;
text-decoration: none;
}
#icons a span {
border-bottom: 1px dotted #999;
color: #333;
}
#icons a img {
padding: 1.5em;
background-color: #f9f9f9;
border-radius: 8px;
border: 1px solid #dadada;
display: inline-block;
}
#icons a:focus img, #icons a:hover img {
background: #bee74b;
outline: 0;
border-color: #dadada;
}
#icons a:focus {
outline: 0;
border-color: #fff;
}
#icons a:hover span, #icons a:focus span {
border-bottom-style: solid;
}
#icons a:focus span {
border: 2px solid #bee74b;
}
/* billet rapide */
#quick {
padding: 1em;
max-width: 976px;
margin: 0 auto;
background: #f5f5f5;
box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
text-align: left;
}
#quick h3 {
margin-bottom: 0.2em;
font-size: 1.2em;
}
#quick p.qinfo {
margin: -.7em -1em 1em;
background: #D9EDF7 url(info.png) no-repeat .2em .2em;
border: 1px solid #BCE8F1;
padding: .2em 1em .1em 24px;
color: #000;
}
#quick #new_cat, .q-cat, .q-cat label {
display: inline-block;
vertical-align: top;
margin-right: 1em;
margin-top: 0;
}
.q-cat label {
margin-right: .3em;
}
#quick #new_cat {
margin-bottom: 2em;
}
/* modules additionnels */
#dashboard-boxes {
margin: 1em auto 1em;
padding-top: 2em;
}
.db-items, .db-contents {
display: inline-block;
text-align: center;
}
.no-js .outgoing img {
display: none;
}
#dashboard-boxes .box {
padding: 10px;
border: 1px solid #ccc;
border-radius: 3px;
min-height: 200px;
margin: 10px;
text-align: left;
}
.dc-box {
background: transparent url(dc_logos/sq-logo-32.png) no-repeat top right;
}
.db-items img, .db-contents img {
vertical-align: middle;
}
.db-items ul, .db-contents ul {
display: block;
padding-left: 1.5em;
list-style: square;
}
.db-items li, .db-contents li {
margin: 0.25em 0 0 0;
}
#news dt {
font-weight: bold;
margin: 0 0 0.4em 0;
}
#news dd {
margin: 0 0 1em 0;
}
#news dd p {
margin: 0.2em 0 0 0;
}
#upg-notify ul {
padding-left: 1.5em;
}
#upg-notify li {
color: #fff;
}
#<API key> {
margin-right: 1em;
}
.user-perm {
margin: 2em 0px;
background: transparent url(user.png) no-repeat left top;
width: 320px;
display: inline-block;
vertical-align: top;
}
.user-perm h4, .user-perm h5, .user-perm p, .user-perm ul, .user-perm li {
margin: .5em 0 .33em;
padding: 0;
}
.user-perm h4 {
padding-left: 28px;
}
.user-perm h5 {
margin: 1em 0 0 0;
}
.user-perm ul {
list-style-type: inside;
}
.user-perm li {
margin-left: 1em;
padding-left: 0;
}
li.user_super, li.user_admin {
margin-left: 0;
padding-left: 20px;
list-style: none;
background: transparent url(../images/superadmin.png) no-repeat 0 .3em;
}
li.user_admin {
background-image: url(../images/admin.png);
}
/* pour les alignements verticaux */
#theme-new, #theme-activate, #theme-deactivate, #theme-update {
margin-left: -10px;
margin-right: -10px;
}
.box.theme {
margin: 5px;
padding: 10px 10px 5px 10px;
border: 1px solid #dfdfdf;
position: relative;
}
.box.theme:hover {
background: #ecf0f1 url(texture.png);
}
.module-name, .module-name label {
margin-bottom: .5em;
color: #676e78;
}
.module-sshot {
text-align: center;
}
.module-sshot img {
padding: 5px;
background: #f7f7f7;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
border: 3px solid #fff;
max-width: 100%;
}
.module-actions {
margin-top: 1em;
}
.bloc-toggler {
text-align: right;
}
.bloc-toggler img {
opacity: .4;
}
.bloc-toggler img:hover {
opacity: 1;
}
.bloc-toggler a:focus img {
opacity: 1;
}
span.module-version:before {
content: "- ";
}
.toggle-bloc .mod-more {
display: block;
margin-left: 0;
}
.box.theme input {
margin-bottom: 1em;
}
.module-name input[type="checkbox"] {
margin-bottom: 0;
}
#theme-new .box.theme, #theme-update .box.theme {
width: 278px;
min-height: 275px;
}
#theme-new .module-sshot img { /* Pour ceux qui n'ont pas de miniature on contraint l'image */
max-width: 240px;
max-height: 210px;
overflow: hidden;
}
#theme-deactivate .box.theme {
width: 278px;
}
#theme-activate .box.theme {
width: 318px;
min-height: 304px;
max-width: 100%;
}
#theme-deactivate .box.theme:hover {
background: transparent url(dc_logos/sq-logo-32.png) no-repeat top right;
}
.with-js #theme-new .module-infos.toggle-bloc,
.with-js #theme-new .module-actions.toggle-bloc {
position: absolute;
left: 10px;
width: 239px;
margin: 0;
padding: 10px;
background: rgba(250, 250, 250, .95);
}
.with-js #theme-new .module-infos.toggle-bloc {
top: 128px;
height: 80px;
border-top: 1px solid #e3e3e3;
}
.with-js #theme-new .module-actions.toggle-bloc {
top: 208px;
height: 40px;
border-bottom: 1px solid #e3e3e3;
}
.with-js .module-sshot:hover {
cursor: pointer;
}
.box.current-theme {
width: 646px;
margin: 5px;
padding: 20px 18px 6px;
background: #fff url(texture.png);
border: 1px solid #eee;
border-radius: .5em;
min-height: 326px;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
position: relative;
}
.current-theme .module-sshot:hover {
cursor: auto;
}
.current-theme .module-sshot img {
float: left;
margin-right: 2em;
border: 9px solid #fff;
padding: 5px;
max-width: 308px;
max-height: 273px;
}
.current-theme .module-name {
color: #D33800;
font-size: 1.5em;
margin-bottom: 1em;
}
.current-actions {
width: auto;
overflow: hidden;
padding-top: 2em;
margin: 1.5em 0 2em;
background: transparent url(../images/minus-theme.png) no-repeat left top;
}
.current-theme .actions-buttons {
position: absolute;
bottom: 0;
right: 18px;
}
#categories {
margin: 1em 0;
}
#categories ul {
list-style: none;
margin-top: 2em;
padding: 0;
}
.cat-line {
position: relative;
margin: .66em 0;
padding: .66em 1em;
border: 1px solid #ccc;
border-radius: 3px;
}
.cat-line label {
margin-right: .25em;
}
.cat-line label a {
font-weight: bold;
}
.cat-line p, .cat-line label {
margin: 0;
display: inline-block;
}
p.cat-title {
margin-right: 1em;
}
.cat-nb-posts a {
color: #333;
}
.cat-url {
padding-left: 1em;
}
#categories .placeholder {
outline: 1px dashed #4183C4;
min-height: 2.5em;
}
.cat-buttons {
float: right;
margin-top: -.2em;
font-size: .91em;
}
.cat-buttons select {
padding: 1px 2px 3px 2px;
margin-right: .25em;
}
.cat-buttons .reset {
padding-left: 4px;
padding-right: 4px;
}
#categories ul ul {
margin-right: 2em;
margin-left: 2em;
}
.cat-line .cat-line {
border: 1px solid #dfdfdf;
}
.cat-actions {
line-height: 2;
}
#del_cat {
width: 100%;
}
.media-item {
position: relative;
border: 1px solid #dfdfdf;
margin: 9px;
padding: 10px 12px 6px;
width: 320px;
display: inline-block;
vertical-align: top;
min-height: 140px;
word-wrap: break-word;
}
.media-item p {
margin: 0 0 .5em;
}
.media-item object {
margin-top: .5em;
}
.media-item ul {
display: block;
list-style: none;
margin: 0;
padding: 0;
}
a.media-icon {
display: block;
border-bottom: none;
margin: 0 auto;
}
.media-icon img {
display: block;
}
.media-link {
font-size: 1.1em;
}
.media-action-box {
position: relative;
margin: 3em 3em 1em 1em;
display: inline-block;
vertical-align: top;
}
li.media-action {
display: block;
position: absolute;
bottom: 4px;
right: 8px;
height: 16px;
}
li.media-action a {
border: none;
}
li.media-action a.attach-media {
margin-right: 5px;
}
li.media-action form {
display: inline;
}
li.media-action input {
border: none;
}
#entry-sidebar .media-item {
width: 100%;
min-height: 0;
padding: 4px;
margin: .33em 0;
}
#entry-sidebar li.media-action {
top: 4px;
}
.folders-group .media-item {
min-height: 70px;
}
.folders-group .media-item p {
margin-bottom: 0;
}
.media-folder {
background: transparent url(bg_menu.png) repeat-y;
border-color: #eee;
}
.media-folder-up {
border-color: #fff;
padding-bottom: 6px;
}
.media-folder .media-link {
font-size: 1.25em;
margin-left: 2em;
color: #676e78;
border-bottom: none;
}
.medias-delete {
text-align: right;
}
/* upload multiple */
.enhanced_uploader .choose_files, .enhanced_uploader .cancel,
.enhanced_uploader .clean, .enhanced_uploader .start {
margin-right: .4em;
}
.enhanced_uploader #upfile {
visibility: hidden;
width: 0;
height: 0;
margin: 0;
opacity: 0;
filter: alpha(opacity=0);
cursor: pointer;
}
.button.clean, .button.cancel, .button.choose_files {
display: none;
}
.enhanced_uploader .button.choose_files {
display: inline-block;
}
.enhanced_uploader .max-size {
display: block;
}
.enhanced_uploader .one-file {
display: none;
}
label span.one-file {
display: inline;
}
.enhanced_uploader p.clear {
padding-top: 1em;
margin-bottom: 1em;
}
#add-file-f p.clear {
margin-top: 1em;
margin-bottom: 0;
clear: both;
}
.files {
list-style-type: none;
margin-left: 0;
padding-left: 0;
border-bottom: 1px solid #dfdfdf;
}
.files li {
margin-left: 0;
padding-left: 0;
}
.upload-msg {
font-weight: bold;
}
.upload-msg.upload-error {
color: #900;
}
.upload-files {
padding: 0 0.5em;
margin: 1em 0;
}
.upload-file {
margin: 0;
padding: .3em 0;
border-top: 1px solid #dfdfdf;
position: relative;
}
.upload-fileinfo {
margin-left: 0;
}
.upload-fileinfo input {
position: absolute;
top: .5em;
right: .5em;
}
.upload-fileinfo span {
padding-right: 8px;
}
.upload-fileinfo .upload-filecancel {
display: block;
padding-right: 0;
margin-top: 3px;
width: 20px;
height: 20px;
background: transparent url("cancel.png") no-repeat left top;
text-indent: -1000px;
cursor: pointer;
float: left;
}
.upload-filemsg {
font-weight: bold;
color: green;
}
.upload-filemsg.upload-error {
color: #900;
}
.upload-progress {
padding: .3em 0;
}
.upload-progress div {
width: 0;
height: 1.2em;
font-weight: bold;
line-height: 1.2em;
text-align: right;
background: green url(loader.png) repeat-x left top;
color: white;
border-radius: 3px;
}
div.template-upload {
clear: both;
}
.queue-message {
font-weight: bold;
}
#media-icon {
float: left;
}
.near-icon {
margin-left: 70px;
margin-bottom: 3em;
}
#media-details ul {
display: block;
margin-left: 0;
padding: 0;
}
#media-details li {
list-style: square inside;
margin: 0;
padding: 0;
}
#<API key> {
overflow: auto;
}
#<API key>.overheight {
height: 500px;
}
.modules td.module-actions, .modules td.module-icon {
vertical-align: middle;
}
.modules td.module-icon img:last-child {
width: 16px;
height: 16px;
}
.modules td.module-icon img.expand {
margin-bottom: 3px;
}
.modules td.module-distrib img {
display: block;
float: right;
}
.modules dt {
font-weight: bold;
}
.modules a.module-details {
background: transparent url(search.png) no-repeat 2px center;
padding: 4px 4px 0 20px;
}
.modules a.module-support {
background: transparent url(help12.png) no-repeat 2px center;
padding: 4px 4px 0 20px;
}
.modules a.module-config {
background: transparent url(settings.png) no-repeat 2px 6px;
padding: 4px 4px 0 18px;
}
#m_search {
background: transparent url(search.png) no-repeat 4px center;
padding-left: 20px;
}
.modules tr.expand, .modules td.expand {
background: #f7f7f7;
border-color: #bee74b;
}
.modules tr.expand td:first-child {
font-weight: bold;
background: #DFE5E7;
}
.modules td.expand {
padding: 0 0 1em;
border-top: 1px solid #eaeaea;
}
.modules td.expand div {
display: inline-block;
vertical-align: top;
margin-right: 3em;
}
.mod-more, .mod-more li {
margin: .25em 0 0 1em;
padding: 0;
list-style-type: none;
}
.mod-more {
padding-top: .5em;
}
#plugin-update td {
vertical-align: baseline;
}
#entry-wrapper {
float: left;
width: 100%;
margin-right: -16em;
}
#entry-content {
margin-right: 18em;
margin-left: 0;
}
#entry-sidebar {
width: 16em;
float: right;
}
#entry-sidebar h4 {
font-size: 1.08em;
margin-top: .3em;
}
#entry-sidebar select {
width: 100%;
}
#entry-sidebar input#post_position {
width: 4em;
}
.sb-box {
border-bottom: 1px solid #dfdfdf;
margin-bottom: 1em;
}
#tb_excerpt {
width: 100%;
}
.fav-list {
list-style-type: none;
margin-left: 0;
padding-left: 0;
}
#my-favs .fav-list {
border-top: 1px solid #eee;
}
.fav-list li {
margin-left: 0;
padding-left: 0;
padding-top: 3px;
padding-bottom: 3px;
position: relative;
}
#my-favs .fav-list li {
line-height: 2;
border-bottom: 1px solid #eee;
padding-top: 3px;
padding-bottom: 3px;
position: relative;
}
.fav-list img {
vertical-align: middle;
margin-right: .2em;
}
.fav-list li span.zoom {
display: none;
}
.fav-list li:hover span.zoom {
display: block;
position: absolute;
bottom: 0;
left: 10em;
background-color: #f7f7f7;
border: 1px solid #dfdfdf;
padding: .2em;
border-radius: .5em;
}
#my-favs {
border-color: #9bca1c;
}
#my-favs input.position {
margin: 0 0 .4em .2em;
}
#available-favs input, #available-favs label, #available-favs label span {
white-space: normal;
display: inline;
}
#available-favs label span.zoom {
display: none;
}
#available-favs li:hover label span.zoom {
display: block;
position: absolute;
bottom: 0;
left: 10em;
background-color: #f7f7f7;
border: 1px solid #dfdfdf;
padding: .2em;
border-radius: .5em;
}
#user-options label.ib {
display: inline-block;
width: 14em;
padding-right: 1em;
}
.blog-perm {
padding-top: 2em;
}
.blog-perm {
margin-top: 2em;
font-weight: bold;
}
.ul-perm {
list-style-type: square;
margin-left: 0;
padding-left: 3.5em;
margin-bottom: 0
}
.add-perm {
padding-top: .5em;
padding-left: 2.5em;
margin-left: 0;
}
.guideline #content h2 {
color: #D33800;
padding: 2em 0 0 0;
margin: 1em 0;
font-size: 2em;
}
.guideline #content h2:first-child {
margin-top: 0;
padding-top: .5em;
}
.guideline h3 {
margin-top: 2em;
}
.guideline .dc-update h3 {
margin-top: 0;
}
.guideline .one-box .box {
border: 1px solid #dfdfdf;
padding: 2px .5em;
}
.guideline #main-menu ul {
margin: 0;
padding: 0;
font-weight: normal;
}
.guideline #main-menu li {
padding-left: 1em;
}
/* jQuery Autocomplete plugin */
.ac_results {
padding: 0px;
border: 1px dotted #f90;
background-color: white;
overflow: hidden;
z-index: 99999;
}
.ac_results ul {
width: 100%;
list-style-position: outside;
list-style: none;
padding: 0;
margin: 0;
}
.ac_results li {
margin: 0px;
padding: 2px 5px;
cursor: default;
display: block;
font-size: 1em;
line-height: 16px;
overflow: hidden;
}
.ac_loading {
background: transparent url('loader.gif') right center no-repeat;
}
.ac_over {
background-color: #2373A8;
color: white;
}
/* password indicator */
.pw-table {
display: table;
margin-bottom: 1em;
}
.pw-cell {
display: table-cell;
margin-bottom: 1em;
}
#pwindicator {
display: table-cell;
vertical-align: bottom;
padding-left: 1.5em;
height: 3.8em;
}
#pwindicator .bar {
height: 6px;
margin-bottom: 4px;
}
.pw-very-weak .bar {
background: #b33630;
width: 30px;
}
.pw-weak .bar {
background: #b33630;
width: 60px;
}
.pw-mediocre .bar {
background: #f90;
width: 90px;
}
.pw-strong .bar {
background: #9bca1c;
width: 120px;
}
.pw-very-strong .bar {
background: #9bca1c;
width: 150px;
}
.anchor-nav {
background: #ecf0f1;
color: #000;
padding: 4px 1em;
}
.anchor-nav label {
vertical-align: bottom;
}
/* nav links */
.nav_prevnext {
margin-bottom: 2em;
color: #fff;
}
.nav_prevnext a, a.back {
color: #2373A8;
border: 1px solid #dfdfdf;
padding: 2px 1.5em;
border-radius: .75em;
background-color: #f3f3f3;
}
a.back:before {
content: "\ab\a0";
}
a.onblog_link {
color: #333;
float: right;
border: 1px solid #eee;
padding: 2px 1.5em;
border-radius: .75em;
background-color: #ECF0F1;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}
/* Pagination */
.pager {
margin: 2em 0 1em 0;
clear: left;
}
.pager ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.pager li, .pager input {
display: inline-block;
vertical-align: middle;
margin: 0 .33em 0 0;
padding: 0;
text-align: center;
}
.pager .btn {
border: 1px solid #dfdfdf;
background-color: #fcfcfc;
color: #676e78;
border-radius: 3px;
overflow: hidden;
}
.btn.no-link {
border-color: #dfdfdf;
background-color: #f9f9f9;
padding: 1px 3px 0;
}
.pager .active {
padding: 4px 12px;
color: #676e78;
}
.pager .direct-access {
margin-left: 2em;
}
.direct-access input[type=text] {
border: 1px solid #dfdfdf;
padding: 3px 8px;
margin-left: .25em;
background-color: #fff;
}
.direct-access input[type=submit] {
padding: 3px 6px;
}
.pager a {
display: block;
padding: 1px 3px 0;
border: none;
}
.pager a:hover, .pager a:focus {
background-color: #ecf0f1;
}
.index .btn.no-link, .index a {
padding: 2px 8px 3px;
font-variant: small-caps;
}
.index li {margin-bottom: 3px;}
.index a {
font-weight: bold;
}
.index .btn.no-link {
color: #ccc;
}
.index .active {
padding: 4px 8px;
color: #fff;
background: #676e78;
border-radius: 3px;
font-variant: small-caps;
}
/* Etapes */
.step {
display: inline-block;
float: left;
margin: 3px 10px 2px 0;
padding: 5px .5em;
background: #ecf0f1;
border-radius: 3px;
font-weight: bold;
border: 1px solid #c5c5c5;
color: #676e78;
}
.legible {
font-size: 1.16em;
max-width: 62em;
}
.fieldset {
background: #fff;
border: 1px solid #c5c5c5;
border-radius: 3px;
padding: 1em .7em .5em;
margin-bottom: 1em;
}
.fieldset h3 {
margin-top: 0;
}
.right, .txt-right {
text-align: right;
}
.txt-center {
text-align: center;
}
.txt-left {
text-align: left;
}
.no-margin, label.no-margin {
margin-top: 0;
margin-bottom: 0;
}
.vertical-separator {
margin-top: 2em;
}
p.clear.vertical-separator {
padding-top: 2em;
}
.border-top {
border-top: 1px solid #999;
padding-top: 1em;
margin-top: 1em;
}
.grid {
background: transparent repeat url('grid.png') 0 0;
}
ul.nice {
margin: 1em 0;
padding: 0 0 0 2em;
list-style: square;
}
ul.nice li {
margin: 0;
padding: 0;
}
ul.from-left {
list-style-type: none;
padding-left: 0;
margin: 1em 0;
}
ul.from-left > li {
margin-top: 1em;
margin-bottom: 1em;
}
ul.from-left ul {
list-style-type: square;
}
.offline {
color: #676e78;
}
.hide, .button.hide {
display: none !important;
}
.hidden, .with-js .out-of-screen-if-js {
position: absolute !important;
clip: rect(1px 1px 1px 1px);
/* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
padding: 0 !important;
border: 0 !important;
height: 1px !important;
width: 1px !important;
overflow: hidden;
}
.no-js .hidden-if-no-js {
display: none;
}
.with-js .hidden-if-js {
display: none;
}
/* debug */
#debug {
position: absolute;
top: 0;
width: 100%;
height: 4px;
background: #ffd478;
}
#debug div {
display: none;
padding: 3px 0.5em 2px;
}
#debug p {
margin: 0.5em 0;
}
#debug:hover {
height: auto;
padding: 2px 1em;
z-index: 100;
}
#debug:hover div {
display: block;
}
.debug {
background: #ffd478;
padding: 3px 0.5em 2px;
}
input[type=submit].delete.debug, a.delete.debug {
border-color: #ffd478;
}
input[type=submit].delete.debug:hover, a.delete.debug:hover {
background: #ffd478;
color: #900;
border-color: #ffd478;
}
/* color-picker.js */
/* _media_item.js */
@media screen and (min-width: 80em) {
#wrapper {
background: #F7F7F7 url(bg_wrapper.png) repeat-y 18em;
}
#main {
margin-left: -17em;
}
#content {
margin: 0 0 0 17em;
}
#main-menu {
width: 17em;
}
#collapser {
left: 17em;
}
h1 {
width: 19.5em;
}
}
@media screen and (max-width: 61em) {
#top-info-blog #switchblog {
max-width: 16em;
}
#top-info-blog a {
margin-left: 2em;
}
#header {
display: block;
width: 100%;
text-align: right;
background: #333;
}
#header h1, #header h1 a {
width: 120px;
padding: 0;
margin: 0;
}
h1, #top-info-blog {
display: inline-block;
vertical-align: top;
margin-right: 1em;
}
#top-info-user {
display: block;
width: 100%;
background: #676e78;
padding-right: 0;
}
#top-info-user li:last-child {
padding-right: 1em;
}
#top-info-user a.active {
padding: 2px 8px;
background: #999;
color: #FFF;
border-width: 0;
border-radius: 6px;
}
.three-boxes, .three-boxes .box,
.two-cols .col70, .two-cols .col30 {
width: 100%;
margin-left: 0;
margin-right: 0;
}
}
@media screen and (max-width: 48em) {
#dashboard-boxes .box.medium, .box.medium,
#dashboard-boxes .box.small, .box.small,
#dashboard-boxes .box.large, .box.large {
width: 95%;
margin: 10px auto;
}
}
@media screen and (max-width: 44em) {
#help-button {
height: 26px;
width: 26px;
background-color: #A2CBE9;
padding: 0;
margin: 0;
font-size: .83em;
line-height: 68px;
overflow: hidden;
}
#content.with-help #help-button {
top: 77px;
}
.one-box, .two-boxes, .box,
.two-cols .col {
width: 96%;
margin-left: 0;
margin-right: 0;
}
#entry-wrapper {
float: none;
width: 100%;
margin-right: 0;
}
#entry-content {
margin-right: 0;
margin-left: 0;
}
#entry-sidebar {
width: 100%;
float: none;
}
}
@media screen and (max-width: 38em) {
#header h1, #header h1 a {
width: 42px !important;
height: 42px;
}
h1 a:link {
background: transparent url(dc_logos/b-dotclear120.png) no-repeat -270px 6px;
border-right: 1px solid #ccc;
}
h1 a:hover, h1 a:focus {
background: url(dc_logos/b-dotclear120.png) no-repeat -270px -94px;
border-right: 1px solid #A2CBE9;
}
#wrapper, #main, #main-menu {
display: block;
float: none;
width: 100%;
margin: 0;
}
#dashboard-main {
padding: 0;
}
#main-menu a {
display: block;
width: 100%;
}
#main-menu h3 a {
display: inline;
}
#content, .hide-mm #content {
margin: 0;
padding: 0 .5em !important;
}
#collapser {
display: none;
}
#main #content > h2 {
margin: 0 -.5em 1em;
padding: 6px 30px 4px .5em;
}
#dashboard-boxes .box.medium, .box.medium,
#dashboard-boxes .box.small, .box.small,
#dashboard-boxes .box.large, .box.large {
width: 95%;
margin: 10px auto;
}
.cell, #filters-form .cell {
display: inline-block;
border: none;
padding: 1em;
vertical-align: bottom;
}
.pseudo-tabs li {
display: block;
float: left;
width: 50%;
border-top: 1px solid #ddd;
padding: .25em;
}
.pseudo-tabs li:first-child, .pseudo-tabs li:nth-of-type(2) {
border-top: none;
}
}
@media screen and (max-width: 26.5em) {
h1, h1 a {
padding: 0;
border-right: #333 !important;
}
#top-info-blog label, .nomobile {
display: none;
}
#top-info-blog {
margin-bottom: .5em;
max-width: 75%;
}
#top-info-blog select {
margin-bottom: .5em;
}
#wrapper {
font-size: 1.4em;
}
#content.with-help #help-button {
top: 120px;
right: 20.5em;
}
#content.with-help #help {
font-size: 12px;
}
p.top-add {
margin-bottom: .5em;
text-align: center;
}
.multi-part {
padding-left: 0;
}
.part-tabs ul {
margin: 1em 0;
padding: 0 .5em;
}
.part-tabs li a {
display: block;
width: 100%;
}
#icons p {
width: 9em;
padding: 1em .25em;
}
.media-item {
width: 90%;
}
#theme-new, #theme-activate, #theme-deactivate {
margin-left: 0;
margin-right: 0;
}
.box.current-theme {
margin: 5px;
padding: 10px;
width: 100%;
}
.current-theme .module-sshot img {
margin: 0;
float: none;
max-width: 100%;
}
table .maximal {
min-width: 14em;
}
th, td {
padding: 0.3em 1em 0.3em 0;
}
.pseudo-tabs li {
display: block;
width: 100%;
float: none;
border-top: 1px solid #ddd !important;
}
.pseudo-tabs li:first-child {
border-top: none;
}
}
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Poisson Distribution — SciPy v0.16.1 Reference Guide</title>
<link rel="stylesheet" type="text/css" href="../../static_/css/spc-bootstrap.css">
<link rel="stylesheet" type="text/css" href="../../static_/css/spc-extend.css">
<link rel="stylesheet" href="../../static_/scipy.css" type="text/css" >
<link rel="stylesheet" href="../../static_/pygments.css" type="text/css" >
<script type="text/javascript">
var <API key> = {
URL_ROOT: '../../',
VERSION: '0.16.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: false
};
</script>
<script type="text/javascript" src="../../static_/jquery.js"></script>
<script type="text/javascript" src="../../static_/underscore.js"></script>
<script type="text/javascript" src="../../static_/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=<API key>"></script>
<script type="text/javascript" src="../../static_/js/copybutton.js"></script>
<link rel="top" title="SciPy v0.16.1 Reference Guide" href="../../index.html" >
</head>
<body>
<div class="container">
<div class="header">
</div>
</div>
<div class="container">
<div class="main">
<div class="row-fluid">
<div class="span12">
<div class="spc-navbar">
<ul class="nav nav-pills pull-left">
<li class="active"><a href="../../index.html">SciPy v0.16.1 Reference Guide</a></li>
</ul>
<ul class="nav nav-pills pull-right">
<li class="active">
<a href="../../genindex.html" title="General Index"
accesskey="I">index</a>
</li>
<li class="active">
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a>
</li>
<li class="active">
<a href="../../<API key>.html" title="Python Module Index"
>modules</a>
</li>
</ul>
</div>
</div>
</div>
<div class="row-fluid">
<div class="spc-rightsidebar span3">
<div class="<API key>">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../static_/scipyshiny_small.png" alt="Logo">
</a></p>
</div>
</div>
<div class="span9">
<div class="bodywrapper">
<div class="body" id="spc-section-body">
<div class="section" id="<API key>">
<span id="discrete-poisson"></span><h1>Poisson Distribution<a class="headerlink" href="
<p>The Poisson random variable counts the number of successes in <span class="math">\(n\)</span> independent Bernoulli trials in the limit as <span class="math">\(n\rightarrow\infty\)</span> and <span class="math">\(p\rightarrow0\)</span> where the probability of success in each trial is <span class="math">\(p\)</span> and <span class="math">\(np=\lambda\geq0\)</span> is a constant. It can be used to approximate the Binomial random
variable or in it’s own right to count the number of events that occur
in the interval <span class="math">\(\left[0,t\right]\)</span> for a process satisfying certain “sparsity “constraints. The functions are</p>
<div class="math">
\[ \begin{eqnarray*} p\left(k;\lambda\right) & = & e^{-\lambda}\frac{\lambda^{k}}{k!}\quad k\geq0,\\ F\left(x;\lambda\right) & = & \sum_{n=0}^{\left\lfloor x\right\rfloor }e^{-\lambda}\frac{\lambda^{n}}{n!}=\frac{1}{\Gamma\left(\left\lfloor x\right\rfloor +1\right)}\int_{\lambda}^{\infty}t^{\left\lfloor x\right\rfloor }e^{-t}dt,\\ \mu & = & \lambda\\ \mu_{2} & = & \lambda\\ \gamma_{1} & = & \frac{1}{\sqrt{\lambda}}\\ \gamma_{2} & = & \frac{1}{\lambda}.\end{eqnarray*}\]</div><div class="math">
\[ M\left(t\right)=\exp\left[\lambda\left(e^{t}-1\right)\right].\]</div><p>Implementation: <a class="reference internal" href="../../generated/scipy.stats.poisson.html#scipy.stats.poisson" title="scipy.stats.poisson"><tt class="xref py py-obj docutils literal"><span class="pre">scipy.stats.poisson</span></tt></a></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container <API key>">
<div class="spc-navbar">
</div>
</div>
<div class="container">
<div class="footer">
<div class="row-fluid">
<ul class="inline pull-left">
<li>
© Copyright 2008-2014, The Scipy community.
</li>
<li>
Last updated on Oct 24, 2015.
</li>
<li>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.2.1.
</li>
</ul>
</div>
</div>
</div>
</body>
</html>
|
# Walldo - A wallpaper downloader
# This program is free software; you can redistribute it and/or
# as published by the Free Software Foundation; either version 2
# This program is distributed in the hope that it will be useful,
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import unittest
from walldo.parser import Parser;
class ParserTestCase(unittest.TestCase):
lines = ['<select class="select" style="margin: 0 2px 0 0; margin-top: 4px; float: left; width: 145px; max-width: 145px;" name="resolution" onChange="javascript:imgload(\'ithilien\', this,\'2949\')">']
expected = ['/wallpaper/7yz4ma1/<API key>.jpg']
def setUp(self):
self.parser = Parser()
def testParse(self):
current = self.parser.parse(self.lines, '1024x768')
for i in range(len(current)):
self.assertEquals(self.expected[i], current[i], 'Entry incorrect')
|
<?php
//don't allow other scripts to grab and execute our file
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
defined('S_APP_NAME') or define('S_APP_NAME', '<API key>');
// include the helper file
require_once(dirname(__FILE__).'/helper.php');
require_once(JPATH_SITE.'/components/<API key>/router.php');
require_once(JPATH_SITE.'/components/<API key>/helpers/constants.php');
require_once(JPATH_SITE.'/components/<API key>/helpers/helper.php');
// CJLib includes
$cjlib = JPATH_ROOT.'/components/com_cjlib/framework.php';
if(file_exists($cjlib)){
require_once $cjlib;
}else{
die('CJLib (CoreJoomla API Library) component not found. Please download and install it to continue.');
}
CJLib::import('corejoomla.framework.core');
// Get the properties
$show_latest = intval($params->get('show_latest','1'));
$show_popular = intval($params->get('show_most_popular','1'));
$show_tabs = intval($params->get('show_tabs','1'));
$tab_order = trim($params->get('tab_order', 'L,M'));
// Get the item id for community answers
$itemid = CJFunctions::get_active_menu_id(true, 'index.php?option='.S_APP_NAME.'&view=survey');
$document = JFactory::getDocument();
$document->addStyleSheet(JURI::base(true).'/modules/<API key>/assets/communitysurveys.css');
// get the items to display from the helper
$order = explode(',', $tab_order);
if($show_tabs == 1){
CJLib::import('corejoomla.ui.bootstrap', true);
echo '<div id="cj-wrapper">';
echo '<ul class="nav nav-tabs" data-tabs="tabs">';
foreach ($order as $i=>$tab){
if((strcmp($tab, "L") == 0) && $show_latest){
echo '<li'.($i == 0 ? ' class="active"' : '').'><a href="#cstab-1" data-toggle="tab">'.JText::_('LBL_LATEST_SURVEYS').'</a></li>';
}
if((strcmp($tab, 'M') == 0) && $show_popular){
echo '<li'.($i == 0 ? ' class="active"' : '').'><a href="#cstab-2" data-toggle="tab">'.JText::_('<API key>').'</a></li>';
}
}
echo '</ul>';
foreach ($order as $i=>$tab){
if((strcmp($tab,'L') == 0) && $show_latest){
$latest_surveys = <API key>::getLatestSurveys($params);
echo '<div id="cstab-1" class="tab-pane fade'.($i == 0 ? ' in active' : '').'">';
require(JModuleHelper::getLayoutPath('<API key>','latest_surveys'));
echo '</div>';
}
if((strcmp($tab,'M') == 0) && $show_popular){
$popular_surveys = <API key>::<API key>($params);
echo '<div id="cstab-2" class="tab-pane fade'.($i == 0 ? ' in active' : '').'">';
require(JModuleHelper::getLayoutPath('<API key>','most_popular'));
echo '</div>';
}
}
echo '</div>';
}else{
foreach ($order as $tab){
if((strcmp($tab,'L') == 0) && $show_latest){
$latest_surveys = <API key>::getLatestSurveys($params);
require(JModuleHelper::getLayoutPath('<API key>','latest_surveys'));
}
if((strcmp($tab,'M') == 0) && $show_popular){
$popular_surveys = <API key>::<API key>($params);
require(JModuleHelper::getLayoutPath('<API key>','most_popular'));
}
}
}
?>
|
#!/bin/sh
if [ $# -gt 0 ]; then
echo $1 > .version
fi
buildid=$(( $1 + 1 ))
zipfile="Chroma.Kernel-r$buildid.zip"
. ./env_setup.sh ${1} || exit 1;
if [ -e .config ]; then
rm .config
fi
cp arch/arm/configs/aosp_defconfig .config >> /dev/null
make aosp_defconfig >> /dev/null
make -j$NUMBEROFCPUS <API key>=y
cp arch/arm/boot/zImage-dtb ramdisk/
cd ramdisk/
./mkbootfs boot.img-ramdisk | gzip > ramdisk.gz
./mkbootimg --kernel zImage-dtb --cmdline 'console=ttyHSL0,115200,n8 androidboot.hardware=hammerhead user_debug=31 msm_watchdog_v2.enable=1' --base 0x00000000 --pagesize 2048 --ramdisk_offset 0x02900000 --tags_offset 0x02700000 --ramdisk ramdisk.gz --output ../boot.img
rm -rf ramdisk.gz
rm -rf zImage
cd ..
if [ -e arch/arm/boot/zImage ]; then
cp boot.img zip/
rm -rf ramdisk/boot.img
cd zip/
rm -f *.zip
zip -r -9 $zipfile *
|
using System;
using System.Collections.Generic;
using UnityEngine;
using YinYang.CodeProject.Projects.SimplePathfinding.PathFinders.AStar;
namespace YinYang.CodeProject.Projects.SimplePathfinding.PathFinders
{
public abstract class BaseGraphSearchMap<TNode, TValue> where TNode : BaseGraphSearchNode<TNode, TValue>
{
#region | Fields |
private Dictionary<TValue, TNode> nodes;
#endregion
#region | Properties |
<summary>
Gets the open nodes count.
</summary>
public Int32 OpenCount
{
get { return OnGetCount(); }
}
public Dictionary<TValue, TNode> Nodes
{
get { return nodes; }
}
#endregion
#region | Indexers |
<summary>
Gets the <see cref="AStarNode"/> on a given coordinates.
</summary>
public TNode this[TValue value]
{
get { return nodes[value]; }
}
#endregion
#region | Constructors |
<summary>
Initializes a new instance of the <see cref="BaseGraphSearchMap{TNode}"/> class.
</summary>
protected BaseGraphSearchMap()
{
nodes = new Dictionary<TValue, TNode>();
}
#endregion
#region | Helper methods |
private void OpenNodeInternal(TValue value, TNode result)
{
nodes[value] = result;
OnAddNewNode(result);
}
#endregion
#region | Virtual/abstract methods |
protected abstract TNode OnCreateFirstNode(TValue startPosition, TValue endPosition);
protected abstract TNode OnCreateNode(TValue position, TNode origin, params object[] arguments);
protected abstract Int32 OnGetCount();
protected abstract void OnAddNewNode(TNode result);
protected abstract TNode OnGetTopNode();
protected abstract void OnClear();
#endregion
#region | Methods |
<summary>
Creates new open node on a map at given coordinates and parameters.
</summary>
public void OpenNode(TValue value, TNode origin, params object[] arguments)
{
TNode result = OnCreateNode(value, origin, arguments);
OpenNodeInternal(value, result);
}
public void OpenFirstNode(TValue startPosition, TValue endPosition)
{
TNode result = OnCreateFirstNode(startPosition, endPosition);
OpenNodeInternal(startPosition, result);
}
<summary>
Creates the empty node at given point.
</summary>
<param name="position">The point.</param>
<returns></returns>
public TNode CreateEmptyNode(TValue position)
{
return OnCreateNode(position, null);
}
<summary>
Returns top node (best estimated score), and closes it.
</summary>
<returns></returns>
public TNode CloseTopNode()
{
TNode result = OnGetTopNode();
result.MarkClosed();
return result;
}
<summary>
Clears map for another round.
</summary>
public void Clear()
{
nodes.Clear();
OnClear();
}
#endregion
}
}
|
#ifndef <API key>
#define <API key>
#include "DICSmoother.H"
#include "GaussSeidelSmoother.H"
namespace Foam
{
class <API key>
:
public lduSmoother
{
// Private data
DICSmoother dicSmoother_;
GaussSeidelSmoother gsSmoother_;
public:
//- Runtime type information
TypeName("DICGaussSeidel");
// Constructors
//- Construct from matrix components
<API key>
(
const lduMatrix& matrix,
const FieldField<Field, scalar>& coupleBouCoeffs,
const FieldField<Field, scalar>& coupleIntCoeffs,
const <API key>& interfaces
);
// Member Functions
//- Execute smoothing
virtual void smooth
(
scalarField& psi,
const scalarField& Source,
const direction cmpt,
const label nSweeps
) const;
};
} // End namespace Foam
#endif
|
#include "soccerbase.h"
#include <oxygen/physicsserver/rigidbody.h>
#include <oxygen/physicsserver/spherecollider.h>
#include <oxygen/agentaspect/perceptor.h>
#include <oxygen/agentaspect/agentaspect.h>
#include <oxygen/sceneserver/sceneserver.h>
#include <oxygen/sceneserver/scene.h>
#include <oxygen/sceneserver/transform.h>
#include <oxygen/controlaspect/controlaspect.h>
#include <oxygen/gamecontrolserver/gamecontrolserver.h>
#include <gamestateaspect/gamestateaspect.h>
#include <soccerruleaspect/soccerruleaspect.h>
#include <agentstate/agentstate.h>
#include <ball/ball.h>
#include <oxygen/physicsserver/space.h>
#include <zeitgeist/leaf.h>
using namespace boost;
using namespace zeitgeist;
using namespace oxygen;
using namespace std;
using namespace salt;
bool
SoccerBase::GetSceneServer(const Leaf& base,
boost::shared_ptr<SceneServer>& scene_server)
{
scene_server = static_pointer_cast<SceneServer>
(base.GetCore()->Get("/sys/server/scene"));
if (scene_server.get() == 0)
{
base.GetLog()->Error()
<< "Error: (SoccerBase: " << base.GetName()
<< ") scene server not found.\n";
return false;
}
return true;
}
bool
SoccerBase::GetTransformParent(const Leaf& base,
boost::shared_ptr<Transform>& transform_parent)
{
transform_parent = <API key><Transform>
((base.<API key><Transform>()).lock());
if (transform_parent.get() == 0)
{
base.GetLog()->Error()
<< "Error: (SoccerBase: " << base.GetName()
<< ") parent node is not derived from TransformNode\n";
return false;
}
return true;
}
bool
SoccerBase::GetAgentState(const boost::shared_ptr<Transform> transform,
boost::shared_ptr<AgentState>& agent_state)
{
agent_state =
<API key><AgentState>(transform->GetChild("AgentState", true));
if (agent_state.get() == 0)
{
return false;
}
return true;
}
bool
SoccerBase::GetAgentBody(const boost::shared_ptr<Transform> transform,
boost::shared_ptr<RigidBody>& agent_body)
{
agent_body = transform-><API key><RigidBody>(true);
if (agent_body.get() == 0)
{
transform->GetLog()->Error()
<< "(SoccerBase) ERROR: " << transform->GetName()
<< " node has no Body child\n";
return false;
}
return true;
}
bool
SoccerBase::GetAgentBody(const Leaf& base, TTeamIndex idx,
int unum, boost::shared_ptr<RigidBody>& agent_body)
{
boost::shared_ptr<AgentState> agentState;
boost::shared_ptr<Transform> parent;
// get matching AgentState
if (!GetAgentState(base, idx, unum, agentState))
return false;
// get AgentAspect
if (!GetTransformParent(*agentState, parent))
return false;
// call GetAgentBody with matching AgentAspect
return GetAgentBody(parent, agent_body);
}
bool
SoccerBase::GetAgentState(const Leaf& base,
boost::shared_ptr<AgentState>& agent_state)
{
boost::shared_ptr<Transform> parent;
if (! GetTransformParent(base,parent))
{
return false;
}
return GetAgentState(parent,agent_state);
}
bool
SoccerBase::GetAgentState(const Leaf& base, TTeamIndex idx,
int unum, boost::shared_ptr<AgentState>& agentState)
{
static TAgentStateMap mAgentStateMapLeft;
static TAgentStateMap mAgentStateMapRight;
if (idx == TI_NONE)
return false;
// do we have a cached reference?
if (
idx == TI_LEFT &&
!mAgentStateMapLeft.empty()
)
{
TAgentStateMap::iterator iter = mAgentStateMapLeft.find(unum);
if (iter != mAgentStateMapLeft.end())
{
// is the pointer to the parent (AgentAspect) still valid
// (maybe the agent disconnected)?
if (!(iter->second)->GetParent().lock().get())
{
base.GetLog()->Error() << "(SoccerBase) WARNING: "
<< "AgentState has invalid parent! "
<< "The agent probably disconnected, removing from map."
<< "\n";
mAgentStateMapLeft.erase(iter);
}
else
{
agentState = (*iter).second;
return true;
}
}
}
else if (
idx == TI_RIGHT &&
!mAgentStateMapRight.empty()
)
{
TAgentStateMap::iterator iter = mAgentStateMapRight.find(unum);
if (iter != mAgentStateMapRight.end())
{
// is the pointer to the parent (AgentAspect) still valid
// (maybe the agent disconnected)?
if ((iter->second)->GetParent().lock().get() == 0)
{
base.GetLog()->Error() << "(SoccerBase) WARNING: "
<< "AgentState has invalid parent! "
<< "The agent probably disconnected, removing from map."
<< "\n";
mAgentStateMapRight.erase(iter);
}
else
{
agentState = (*iter).second;
return true;
}
}
}
// we have to get all agent states for this team
TAgentStateList agentStates;
GetAgentStates(base, agentStates, idx);
for (TAgentStateList::iterator iter = agentStates.begin();
iter != agentStates.end();
++iter)
{
if ((*iter)->GetUniformNumber() == unum)
{
agentState = *iter;
if (idx == TI_LEFT)
{
mAgentStateMapLeft[unum] = agentState;
}
else
{
mAgentStateMapRight[unum] = agentState;
}
return true;
}
}
return false;
}
bool
SoccerBase::GetAgentStates(const zeitgeist::Leaf& base,
TAgentStateList& agentStates,
TTeamIndex idx)
{
static boost::shared_ptr<GameControlServer> gameCtrl;
if (gameCtrl.get() == 0)
{
<API key>(base, gameCtrl);
if (gameCtrl.get() == 0)
{
base.GetLog()->Error() << "(SoccerBase) ERROR: can't get "
<< "GameControlServer\n";
return false;
}
}
GameControlServer::TAgentAspectList aspectList;
gameCtrl->GetAgentAspectList(aspectList);
GameControlServer::TAgentAspectList::iterator iter;
boost::shared_ptr<AgentState> agentState;
for (
iter = aspectList.begin();
iter != aspectList.end();
++iter
)
{
agentState = <API key><AgentState>((*iter)->GetChild("AgentState", true));
if (
agentState.get() != 0 &&
(
agentState->GetTeamIndex() == idx ||
idx == TI_NONE
)
)
{
agentStates.push_back(agentState);
}
}
return true;
}
bool
SoccerBase::GetGameState(const Leaf& base,
boost::shared_ptr<GameStateAspect>& game_state)
{
game_state = <API key><GameStateAspect>
(base.GetCore()->Get("/sys/server/gamecontrol/GameStateAspect"));
if (game_state.get() == 0)
{
base.GetLog()->Error()
<< "Error: (SoccerBase: " << base.GetName()
<< ") found no GameStateAspect\n";
return false;
}
return true;
}
bool
SoccerBase::GetSoccerRuleAspect(const Leaf& base,
boost::shared_ptr<SoccerRuleAspect> & soccer_rule_aspect)
{
soccer_rule_aspect = <API key><SoccerRuleAspect>
(base.GetCore()->Get("/sys/server/gamecontrol/SoccerRuleAspect"));
if (soccer_rule_aspect.get() == 0)
{
base.GetLog()->Error()
<< "Error: (SoccerBase: " << base.GetName()
<< " found no SoccerRuleAspect\n";
return false;
}
return true;
}
bool
SoccerBase::<API key>(const Leaf& base,
boost::shared_ptr<GameControlServer> & game_control_server)
{
static boost::shared_ptr<GameControlServer> gameControlServer;
if (gameControlServer.get() == 0)
{
gameControlServer = boost::<API key><GameControlServer>
(base.GetCore()->Get("/sys/server/gamecontrol"));
if (gameControlServer.get() == 0)
{
base.GetLog()->Error()
<< "Error: (SoccerBase: " << base.GetName()
<< " found no GameControlServer\n";
return false;
}
}
game_control_server = gameControlServer;
return true;
}
bool
SoccerBase::GetActiveScene(const Leaf& base,
boost::shared_ptr<Scene>& active_scene)
{
static boost::shared_ptr<SceneServer> sceneServer;
if (sceneServer.get() == 0)
{
if (! GetSceneServer(base,sceneServer))
{
base.GetLog()->Error()
<< "(SoccerBase) ERROR: " << base.GetName()
<< ", could not get SceneServer\n";
return false;
}
}
active_scene = sceneServer->GetActiveScene();
if (active_scene.get() == 0)
{
base.GetLog()->Error()
<< "ERROR: (SoccerBase: " << base.GetName()
<< ", SceneServer reports no active scene\n";
return false;
}
return true;
}
bool
SoccerBase::GetBody(const Leaf& base, boost::shared_ptr<RigidBody>& body)
{
boost::shared_ptr<Transform> parent;
if (! GetTransformParent(base,parent))
{
base.GetLog()->Error() << "(SoccerBase) ERROR: no transform parent "
<< "found in GetBody()\n";
return false;
}
body = <API key><RigidBody>(parent-><API key><RigidBody>());
if (body.get() == 0)
{
base.GetLog()->Error()
<< "ERROR: (SoccerBase: " << base.GetName()
<< ") parent node has no Body child.";
return false;
}
return true;
}
bool
SoccerBase::GetBall(const Leaf& base, boost::shared_ptr<Ball>& ball)
{
static boost::shared_ptr<Scene> scene;
static boost::shared_ptr<Ball> ballRef;
if (scene.get() == 0)
{
if (! GetActiveScene(base,scene))
{
base.GetLog()->Error()
<< "(SoccerBase) ERROR: " << base.GetName()
<< ", could not get active scene.\n";
return false;
}
}
if (ballRef.get() == 0)
{
ballRef = <API key><Ball>
(base.GetCore()->Get(scene->GetFullPath() + "Ball"));
if (ballRef.get() == 0)
{
base.GetLog()->Error()
<< "(SoccerBase) ERROR: " << base.GetName()
<< ", found no ball node\n";
return false;
}
}
ball = ballRef;
return true;
}
bool
SoccerBase::GetBallBody(const Leaf& base, boost::shared_ptr<RigidBody>& body)
{
static boost::shared_ptr<Scene> scene;
static boost::shared_ptr<RigidBody> bodyRef;
if (scene.get() == 0)
{
if (! GetActiveScene(base,scene))
{
base.GetLog()->Error()
<< "(SoccerBase) ERROR: " << base.GetName()
<< ", could not get active scene.\n";
return false;
}
}
if (bodyRef.get() == 0)
{
bodyRef = <API key><RigidBody>
(base.GetCore()->Get(scene->GetFullPath() + "Ball/physics"));
if (bodyRef.get() == 0)
{
base.GetLog()->Error()
<< "(SoccerBase) ERROR: " << base.GetName()
<< ", found no ball body node\n";
return false;
}
}
body = bodyRef;
return true;
}
bool
SoccerBase::GetBallCollider(const zeitgeist::Leaf& base,
boost::shared_ptr<oxygen::SphereCollider>& sphere)
{
static boost::shared_ptr<Scene> scene;
static boost::shared_ptr<SphereCollider> sphereRef;
if (scene.get() == 0)
{
if (! GetActiveScene(base,scene))
{
base.GetLog()->Error()
<< "(SoccerBase) ERROR: " << base.GetName()
<< ", could not get active scene.\n";
return false;
}
}
if (sphereRef.get() == 0)
{
sphereRef = <API key><SphereCollider>
(base.GetCore()->Get(scene->GetFullPath() + "Ball/geometry"));
if (sphereRef.get() == 0)
{
base.GetLog()->Error()
<< "(SoccerBase) ERROR:" << base.GetName()
<< ", Ball got no SphereCollider node\n";
return false;
}
}
sphere = sphereRef;
return true;
}
salt::Vector3f
SoccerBase::FlipView(const salt::Vector3f& pos, TTeamIndex ti)
{
salt::Vector3f newPos;
switch (ti)
{
case TI_RIGHT:
newPos[0] = -pos[0];
newPos[1] = -pos[1];
newPos[2] = pos[2];
break;
case TI_NONE:
case TI_LEFT:
newPos = pos;
break;
}
return newPos;
}
TTeamIndex
SoccerBase::OpponentTeam(TTeamIndex ti)
{
switch (ti)
{
case TI_RIGHT:
return TI_LEFT;
case TI_LEFT:
return TI_RIGHT;
default:
return TI_NONE;
}
}
string
SoccerBase::PlayMode2Str(const TPlayMode mode)
{
switch (mode)
{
case PM_BeforeKickOff:
return <API key>;
case PM_KickOff_Left:
return STR_PM_KickOff_Left;
case PM_KickOff_Right:
return <API key>;
case PM_PlayOn:
return STR_PM_PlayOn;
case PM_KickIn_Left:
return STR_PM_KickIn_Left;
case PM_KickIn_Right:
return STR_PM_KickIn_Right;
case PM_CORNER_KICK_LEFT:
return <API key>;
case <API key>:
return <API key>;
case PM_GOAL_KICK_LEFT:
return <API key>;
case PM_GOAL_KICK_RIGHT:
return <API key>;
case PM_OFFSIDE_LEFT:
return STR_PM_OFFSIDE_LEFT;
case PM_OFFSIDE_RIGHT:
return <API key>;
case PM_GameOver:
return STR_PM_GameOver;
case PM_Goal_Left:
return STR_PM_Goal_Left;
case PM_Goal_Right:
return STR_PM_Goal_Right;
case PM_FREE_KICK_LEFT:
return <API key>;
case PM_FREE_KICK_RIGHT:
return <API key>;
default:
return STR_PM_Unknown;
};
}
boost::shared_ptr<ControlAspect>
SoccerBase::GetControlAspect(const zeitgeist::Leaf& base,const string& name)
{
static const string gcsPath = "/sys/server/gamecontrol/";
boost::shared_ptr<ControlAspect> aspect = <API key><ControlAspect>
(base.GetCore()->Get(gcsPath + name));
if (aspect.get() == 0)
{
base.GetLog()->Error()
<< "ERROR: (SoccerBase: " << base.GetName()
<< ") found no ControlAspect " << name << "\n";
}
return aspect;
}
bool
SoccerBase::MoveAgent(boost::shared_ptr<Transform> agent_aspect, const Vector3f& pos)
{
Vector3f agentPos = agent_aspect->GetWorldTransform().Pos();
boost::shared_ptr<Transform> parent = <API key><Transform>
(agent_aspect-><API key><Transform>().lock());
if (parent.get() == 0)
{
agent_aspect->GetLog()->Error() << "(MoveAgent) ERROR: can't get parent node.\n";
return false;
}
Leaf::TLeafList leafList;
parent-><API key><RigidBody>(leafList, true);
if (leafList.size() == 0)
{
agent_aspect->GetLog()->Error()
<< "(MoveAgent) ERROR: agent aspect doesn't have "
<< "children of type Body\n";
return false;
}
Leaf::TLeafList::iterator iter = leafList.begin();
// move all child bodies
for (; iter != leafList.end(); ++iter)
{
boost::shared_ptr<RigidBody> childBody =
<API key><RigidBody>(*iter);
Vector3f childPos = childBody->GetPosition();
childBody->SetPosition(pos + (childPos-agentPos));
childBody->SetVelocity(Vector3f(0,0,0));
childBody->SetAngularVelocity(Vector3f(0,0,0));
}
return true;
}
bool
SoccerBase::MoveAndRotateAgent(boost::shared_ptr<Transform> agent_aspect, const Vector3f& pos, float angle)
{
boost::shared_ptr<Transform> parent = <API key><Transform>
(agent_aspect-><API key><Transform>().lock());
if (parent.get() == 0)
{
agent_aspect->GetLog()->Error() << "(MoveAndRotateAgent) ERROR: can't get parent node.\n";
return false;
}
Leaf::TLeafList leafList;
parent-><API key><RigidBody>(leafList, true);
if (leafList.size() == 0)
{
agent_aspect->GetLog()->Error()
<< "(MoveAndRotateAgent) ERROR: agent aspect doesn't have "
<< "children of type Body\n";
return false;
}
boost::shared_ptr<RigidBody> body;
GetAgentBody(agent_aspect, body);
const Vector3f& agentPos = body->GetPosition();
Matrix bodyR = body->GetRotation();
bodyR.<API key>();
Matrix mat;
mat.RotationZ(gDegToRad(angle));
mat *= bodyR;
Leaf::TLeafList::iterator iter = leafList.begin();
// move all child bodies
for (;
iter != leafList.end();
++iter
)
{
boost::shared_ptr<RigidBody> childBody =
<API key><RigidBody>(*iter);
Vector3f childPos = childBody->GetPosition();
Matrix childR = childBody->GetRotation();
childR = mat*childR;
childBody->SetPosition(pos + mat.Rotate(childPos-agentPos));
childBody->SetVelocity(Vector3f(0,0,0));
childBody->SetAngularVelocity(Vector3f(0,0,0));
childBody->SetRotation(childR);
}
return true;
}
AABB3 SoccerBase::GetAgentBoundingBox(const Leaf& base)
{
AABB3 boundingBox;
boost::shared_ptr<Space> parent = base.<API key><Space>().lock();
if (!parent)
{
base.GetLog()->Error()
<< "(GetAgentBoundingBox) ERROR: can't get parent node.\n";
return boundingBox;
}
/* We can't simply use the GetWorldBoundingBox of the space node, becuase
* (at least currently) it'll return a wrong answer. Currently, the space
* object is always at (0,0,0) which is encapsulated in the result of it's
* GetWorldBoundingBox method call.
*/
Leaf::TLeafList baseNodes;
parent-><API key><BaseNode>(baseNodes);
if (baseNodes.empty())
{
base.GetLog()->Error()
<< "(GetAgentBoundingBox) ERROR: space object doesn't have any"
<< " children of type BaseNode.\n";
}
for (Leaf::TLeafList::iterator i = baseNodes.begin(); i!= baseNodes.end(); ++i)
{
boost::shared_ptr<BaseNode> node = static_pointer_cast<BaseNode>(*i);
boundingBox.Encapsulate(node->GetWorldBoundingBox());
}
return boundingBox;
}
AABB2 SoccerBase::<API key>(const Leaf& base)
{
AABB2 boundingRect;
boost::shared_ptr<Space> parent = base.<API key><Space>().lock();
if (!parent)
{
base.GetLog()->Error()
<< "(GetAgentBoundingBox) ERROR: can't get parent node.\n";
return boundingRect;
}
/* We can't simply use the GetWorldBoundingBox of the space node, becuase
* (at least currently) it'll return a wrong answer. Currently, the space
* object is always at (0,0,0) which is encapsulated in the result of it's
* GetWorldBoundingBox method call.
*/
Leaf::TLeafList baseNodes;
parent-><API key><Collider>(baseNodes,true);
if (baseNodes.empty())
{
base.GetLog()->Error()
<< "(GetAgentBoundingBox) ERROR: space object doesn't have any"
<< " children of type BaseNode.\n";
}
for (Leaf::TLeafList::iterator i = baseNodes.begin(); i!= baseNodes.end(); ++i)
{
boost::shared_ptr<BaseNode> node = static_pointer_cast<BaseNode>(*i);
const AABB3 &box = node->GetWorldBoundingBox();
boundingRect.Encapsulate(box.minVec.x(), box.minVec.y());
boundingRect.Encapsulate(box.maxVec.x(), box.maxVec.y());
}
return boundingRect;
}
std::string SoccerBase::SPLState2Str(const spl::TSPLState state)
{
switch (state)
{
case spl::Initial:
return <API key>;
case spl::Ready:
return STR_SPL_STATE_READY;
case spl::Set:
return STR_SPL_STATE_SET;
case spl::Playing:
return <API key>;
case spl::Finished:
return <API key>;
case spl::Penalized:
return <API key>;
default:
return <API key>;
}
}
|
# -*- coding: utf-8 -*-
# HnTool rules - php
# This program is free software; you can redistribute it and/or modify
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import os
import ConfigParser
import HnTool.modules.util
from HnTool.modules.rule import Rule as MasterRule
class Rule(MasterRule):
def __init__(self, options):
MasterRule.__init__(self, options)
self.short_name="php"
self.long_name="Checks security problems on php config file"
self.type="config"
self.required_files = ['/etc/php5/apache2/php.ini', '/etc/php5/cli/php.ini', '/etc/php.ini']
def requires(self):
return self.required_files
def analyze(self, options):
check_results = self.check_results
conf_files = self.required_files
for php_conf in conf_files:
if os.path.isfile(php_conf):
config = ConfigParser.ConfigParser()
try:
config.read(php_conf)
except ConfigParser.ParsingError, (errno, strerror):
check_results['info'].append('Could not parse %s: %s' % (php_conf, strerror))
continue
if not config.has_section('PHP'):
check_results['info'].append('%s is not a PHP config file' % (php_conf))
continue
if config.has_option('PHP', 'register_globals'):
rg = config.get('PHP', 'register_globals').lower()
if rg == 'on':
check_results['medium'].append('Register globals is on (%s)' % (php_conf))
elif rg == 'off':
check_results['ok'].append('Register globals is off (%s)' % (php_conf))
else:
check_results['info'].append('Unknown value for register globals (%s)' % (php_conf))
else:
check_results['info'].append('Register globals not found (%s)' % (php_conf))
if config.has_option('PHP', 'safe_mode'):
sm = config.get('PHP', 'safe_mode').lower()
if sm == 'on':
check_results['low'].append('Safe mode is on (fake security) (%s)' % (php_conf))
elif sm == 'off':
check_results['info'].append('Safe mode is off (%s)' % (php_conf))
else:
check_results['info'].append('Unknown value for safe mode (%s)' % (php_conf))
else:
check_results['info'].append('Safe mode not found (%s)' % (php_conf))
if config.has_option('PHP', 'display_errors'):
de = config.get('PHP', 'display_errors').lower()
if de == 'on':
check_results['medium'].append('Display errors is on (stdout) (%s)' % (php_conf))
elif de == 'off':
check_results['ok'].append('Display errors is off (%s)' % (php_conf))
elif de == 'stderr':
check_results['info'].append('Display errors set to stderr (%s)' % (php_conf))
else:
check_results['info'].append('Unknown value for display errors (%s)' % (php_conf))
else:
check_results['info'].append('Display errors not found (%s)' % (php_conf))
if config.has_option('PHP', 'expose_php'):
ep = config.get('PHP', 'expose_php').lower()
if ep == 'on':
check_results['low'].append('Expose PHP is on (%s)' % (php_conf))
elif ep == 'off':
check_results['ok'].append('Expose PHP is off (%s)' % (php_conf))
else:
check_results['info'].append('Unknown value for expose PHP (%s)' % (php_conf))
else:
check_results['info'].append('Expose PHP not found (%s)' % (php_conf))
return check_results
|
#ifndef <API key>
#define <API key>
#include "<API key>.h"
#include <qcstring.h>
class <API key> : public <API key> {
public:
// the constructor, do not call it yourself !!!!!!!!!!
<API key>(void * id, const QCString & s) : <API key>(id, s) {
}
//returns a string indicating the king of the element
virtual QCString sKind();
//entry to produce the html code receiving chapter number
//path, rank in the mother and level in the browser tree
virtual void html(QCString pfix, unsigned int rank, unsigned int level);
};
#endif
|
/** Simple message box constructor
* @params type The message type: error, notice, info or success
* @params msg Message
*/
function UIMessage(type, msg) {
var undefined;
if(this instanceof arguments.callee) {
if(type === undefined) throw TypeError("type undefined");
if(msg === undefined) {
msg = type;
type = undefined;
}
this.type = type || "info";
this.msg = ""+msg;
} else {
return new UIMessage(type, msg);
}
}
/** Get the message as a string */
UIMessage.prototype.toString = function() {
return this.type + ": " + this.msg;
}
/** Convert to JSON using JSONObject extension */
UIMessage.prototype.toJSON = function() {
return new JSONObject("UIMessage", this.type + ":" + this.msg );
};
/* Setup reviver for JSONObject */
JSONObject.revivers.UIMessage = function(value) {
var parts = (""+value).split(":");
return new UIMessage(parts.shift(), parts.join(":"));
};
/* EOF */
|
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace PlaneGame
{
class ProgressBar
{
public Rectangle rc, fon;
protected int maxValue;
protected int value;
protected Texture2D texture;
protected int step;
public int maxLenght;
public ProgressBar(Texture2D textur, int height = 30, int value = 0, int maxValue = 100, int maxLenght = 200)
{
this.texture = textur;
this.value = value;
this.maxValue = maxValue;
this.maxLenght = maxLenght;
step = maxLenght / maxValue;
rc = new Rectangle(0, 0, 1, height);
fon = new Rectangle(0, 0, this.maxLenght, height);
}
public void setValue(int val)
{
this.value = val;
this.rc.Width = (int)(value * step);
if (this.rc.Width > this.maxLenght)
{
this.rc.Width = this.maxLenght;
}
if (this.rc.Width < 1)
{
this.rc.Width = 1;
}
}
public void Draw(SpriteBatch sb,bool powernut, Color color, Color fonColor,float alpha,int x = 0, int y = 0)
{
if (powernut == true)
{
fon.X = rc.X = x;
fon.Y = rc.Y = y;
sb.Draw(texture, fon, null, fonColor * alpha, 0, Vector2.Zero, SpriteEffects.None, 0.9f);
sb.Draw(texture, rc, null, color * alpha, 0, Vector2.Zero, SpriteEffects.None, 1);
}
else
{
fon.X = rc.X = x+this.maxLenght;
fon.Y = rc.Y = y + this.fon.Height;
sb.Draw(texture, fon, null, fonColor * alpha, MathHelper.Pi, new Vector2(0, 0), SpriteEffects.None, 0.9f);
sb.Draw(texture, rc, null, color * alpha, MathHelper.Pi, new Vector2(0, 0), SpriteEffects.None, 1);
}
}
}
}
|
<!DOCTYPE html>
<html class="no-js" <?php language_attributes(); ?>>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php wp_title(''); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php wp_head(); ?>
<!--[if lt IE 9]><script src="<?php echo <API key>(); ?>/assets/js/html5shiv.min.js"></script><![endif]-->
<link rel="alternate" type="application/rss+xml" title="<?php echo get_bloginfo('name'); ?> Feed" href="<?php echo home_url(); ?>/feed/">
</head>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.