text stringlengths 2 1.04M | meta dict |
|---|---|
package org.springframework.social.vkontakte.api.impl;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import org.springframework.social.MissingAuthorizationException;
import org.springframework.social.support.URIBuilder;
import org.springframework.social.vkontakte.api.ApiVersion;
import org.springframework.social.vkontakte.api.VKGenericResponse;
import org.springframework.social.vkontakte.api.VKResponse;
import org.springframework.social.vkontakte.api.VKontakteErrorException;
import org.springframework.social.vkontakte.api.impl.json.VKArray;
import org.springframework.util.Assert;
import org.springframework.util.MultiValueMap;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
* Generic class for operation templates.
* @author vkolodrevskiy
*/
class AbstractVKontakteOperations {
private final static String VK_REST_URL = "https://api.vk.com/method/";
private final boolean isAuthorized;
private final String accessToken;
protected final ObjectMapper objectMapper;
public AbstractVKontakteOperations(boolean isAuthorized, String accessToken, ObjectMapper objectMapper) {
this.isAuthorized = isAuthorized;
this.accessToken = accessToken;
this.objectMapper = objectMapper;
}
/**
* throws {@link MissingAuthorizationException} if not authorized.
*/
protected void requireAuthorization() {
if (!isAuthorized) {
throw new MissingAuthorizationException("vkontakte");
}
}
protected URI makeOperationURL(String method, Properties params, ApiVersion apiVersion) {
URIBuilder uri = URIBuilder.fromUri(VK_REST_URL + method);
preProcessURI(uri);
// add api version
// TODO: I think finally we should migrate to latest api
uri.queryParam("v", apiVersion.toString());
for (Map.Entry<Object, Object> objectObjectEntry : params.entrySet()) {
uri.queryParam(objectObjectEntry.getKey().toString(), objectObjectEntry.getValue().toString());
}
return uri.build();
}
protected URI makeOperationPOST(String method, MultiValueMap<String, Object> data, ApiVersion apiVersion) {
URIBuilder uri = URIBuilder.fromUri(VK_REST_URL + method);
data.set("access_token", accessToken);
data.set("v", apiVersion.toString());
return uri.build();
}
protected void preProcessURI(URIBuilder uri) {
// add access_token
// TODO: for some methods we do not need access token, so think about it.
uri.queryParam("access_token", accessToken);
}
// throw exception if VKontakte response contains error
// TODO: consider to throw specific exceptions for each error code.
// like for error code 113 that would be let's say InvalidUserIdVKException
protected <T extends VKResponse> void checkForError(T toCheck) {
if(toCheck.getError() != null) {
throw new VKontakteErrorException(toCheck.getError());
}
}
protected <T> VKArray<T> deserializeArray(VKGenericResponse response, Class<T> itemClass) {
checkForError(response);
Assert.isTrue(response.getResponse().isArray());
ArrayNode items = (ArrayNode) response.getResponse();
int count = items.get(0).asInt();
return new VKArray<T>(count, deserializeItems(items, itemClass));
}
/**
* for responses of VK API 5.0+
*
* @param response {@link VKGenericResponse response}
* @param itemClass class of the item
* @param <T> item type
* @return array
*/
protected <T> VKArray<T> deserializeVK50ItemsResponse(VKGenericResponse response, Class<T> itemClass) {
checkForError(response);
JsonNode jsonNode = response.getResponse();
JsonNode itemsNode = jsonNode.get("items");
Assert.isTrue(itemsNode.isArray());
int count = jsonNode.get("count").asInt();
return new VKArray<T>(count, deserializeItems((ArrayNode) itemsNode, itemClass));
}
protected <T> List<T> deserializeItems(ArrayNode items, Class<T> itemClass) {
List<T> elements = new ArrayList<T>();
for (int i = 0; i < items.size(); i++) {
elements.add(objectMapper.convertValue(items.get(i), itemClass));
}
return elements;
}
protected <T> T deserializeVK50Item( VKGenericResponse response, Class<T> itemClass) {
checkForError(response);
return objectMapper.convertValue(response.getResponse(), itemClass);
}
}
| {
"content_hash": "45787dbd19741b6fe7e92c2d8e72895a",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 111,
"avg_line_length": 37.91129032258065,
"alnum_prop": 0.6970857264411827,
"repo_name": "Klaxon77/spring-social-vkontakte",
"id": "d4d9fc273b784c169e55033bfe55c6fff392a267",
"size": "5316",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spring-social-vkontakte/src/main/java/org/springframework/social/vkontakte/api/impl/AbstractVKontakteOperations.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "9962"
},
{
"name": "HTML",
"bytes": "355"
},
{
"name": "Java",
"bytes": "279331"
},
{
"name": "XSLT",
"bytes": "31599"
}
],
"symlink_target": ""
} |
<bill session="115" type="s" number="166" updated="2017-07-20T18:46:15Z">
<state datetime="2017-01-17">REFERRED</state>
<status>
<introduced datetime="2017-01-17"/>
</status>
<introduced datetime="2017-01-17"/>
<titles>
<title type="short" as="introduced">Muhammad Ali Commemorative Coin Act</title>
<title type="short" as="introduced">Muhammad Ali Commemorative Coin Act</title>
<title type="official" as="introduced">A bill to require the Secretary of the Treasury to mint coins in commemoration of Muhammad Ali.</title>
<title type="display">Muhammad Ali Commemorative Coin Act</title>
</titles>
<sponsor bioguide_id="H000338"/>
<cosponsors>
<cosponsor bioguide_id="B001288" joined="2017-01-17"/>
<cosponsor bioguide_id="G000555" joined="2017-01-30"/>
<cosponsor bioguide_id="H001076" joined="2017-02-03"/>
<cosponsor bioguide_id="M000355" joined="2017-01-24"/>
</cosponsors>
<actions>
<action datetime="2017-01-17">
<text>Introduced in Senate</text>
</action>
<action datetime="2017-01-17" state="REFERRED">
<text>Read twice and referred to the Committee on Banking, Housing, and Urban Affairs.</text>
</action>
</actions>
<committees>
<committee subcommittee="" code="SSBK" name="Senate Banking, Housing, and Urban Affairs" activity="Referral"/>
</committees>
<relatedbills>
<bill type="h" session="115" relation="identical" number="579"/>
</relatedbills>
<subjects>
<term name="Finance and financial sector"/>
<term name="Athletes"/>
<term name="Currency"/>
<term name="Professional sports"/>
</subjects>
<amendments/>
<summary date="2017-01-17T05:00:00Z" status="Introduced in Senate">Muhammad Ali Commemorative Coin Act
This bill requires the Department of the Treasury to mint and issue commemorative coins that emblemize the life and legacy of Muhammad Ali. 
Surcharges received from the sale of these coins shall be paid to: (1) the Muhammad Ali Center in Louisville, Kentucky; (2) the Muhammad Ali Institute for Peace and Justice at the University of Louisville; and (3) the Muhammad Ali Parkinson Center and Movement Disorder Clinic.</summary>
<committee-reports/>
</bill>
| {
"content_hash": "b5a8911d0a0070fc5381e13834154980",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 287,
"avg_line_length": 47.255319148936174,
"alnum_prop": 0.7091400270148581,
"repo_name": "peter765/power-polls",
"id": "d35babdc2b49a316f1c74a10552791eab3d2d37d",
"size": "2221",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "db/bills/s/s166/data.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "58567"
},
{
"name": "JavaScript",
"bytes": "7370"
},
{
"name": "Python",
"bytes": "22988"
}
],
"symlink_target": ""
} |
package monitorx.controller.api;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import monitorx.domain.Forewarning;
import monitorx.domain.Node;
import monitorx.plugins.sync.ISync;
import monitorx.plugins.sync.ISyncConfig;
import monitorx.service.NodeService;
import org.pf4j.PluginManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Optional;
@RestController
@RequestMapping("/api/node")
public class NodeController {
@Autowired
NodeService nodeService;
@Autowired
ApplicationContext applicationContext;
@Autowired
PluginManager pluginManager;
@RequestMapping(value = "/", method = RequestMethod.POST)
public APIResponse addNode(HttpServletRequest request) {
String nodeJSON = request.getParameter("node");
Node node = JSON.parseObject(nodeJSON, Node.class);
List<ISync> syncs = pluginManager.getExtensions(ISync.class);
Optional<ISync> sync = syncs.stream().filter(o -> o.getCode().equalsIgnoreCase(node.getSync())).findFirst();
if (!sync.isPresent()) {
return APIResponse.buildErrorResponse("Invalid Sync");
}
JSONObject jsonObject = JSON.parseObject(nodeJSON);
ISyncConfig nodeConfig = JSON.parseObject(JSON.toJSONString(jsonObject.get("syncConfig")), sync.get().getSyncConfig().getClass());
node.setSyncConfig(nodeConfig);
nodeService.addNode(node);
return APIResponse.buildSuccessResponse();
}
@RequestMapping(value = "/{nodeCode}/{forewarning}/checkpoint/", method = RequestMethod.GET)
public APIResponse getNodeCheckPoints(@PathVariable("nodeCode") String nodeCode, @PathVariable("forewarning") String forewarning) {
Forewarning fw = nodeService.findForewarningByTitle(nodeCode, forewarning);
return APIResponse.buildSuccessResponse(fw.getCheckPoints());
}
@RequestMapping(value = "/{nodeCode}/", method = RequestMethod.DELETE)
public APIResponse removeNode(@PathVariable("nodeCode") String nodeCode) {
nodeService.removeNode(nodeCode);
return APIResponse.buildSuccessResponse();
}
} | {
"content_hash": "a2b4e5ebde2d495b094802483abada1e",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 138,
"avg_line_length": 38.95384615384615,
"alnum_prop": 0.7531595576619273,
"repo_name": "qianlifeng/MonitorX",
"id": "fdb94ced04153951460a9b517cbbcb151631b197",
"size": "2532",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "monitorx/src/main/java/monitorx/controller/api/NodeController.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "191"
},
{
"name": "Java",
"bytes": "111628"
},
{
"name": "JavaScript",
"bytes": "17656"
},
{
"name": "Vue",
"bytes": "46966"
}
],
"symlink_target": ""
} |
package javax.swing.tree;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Arrays;
import java.util.EventListener;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Vector;
import javax.swing.DefaultListSelectionModel;
import javax.swing.event.EventListenerList;
import javax.swing.event.SwingPropertyChangeSupport;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
/**
* The implementation of the default tree selection model. The installed
* listeners are notified about the path and not the row changes. If you
* specifically need to track the row changes, register the listener for the
* expansion events.
*
* @author Andrew Selkirk
* @author Audrius Meskauskas
*/
public class DefaultTreeSelectionModel
implements Cloneable, Serializable, TreeSelectionModel
{
/**
* Use serialVersionUID for interoperability.
*/
static final long serialVersionUID = 3288129636638950196L;
/**
* The name of the selection mode property.
*/
public static final String SELECTION_MODE_PROPERTY = "selectionMode";
/**
* Our Swing property change support.
*/
protected SwingPropertyChangeSupport changeSupport;
/**
* The current selection.
*/
protected TreePath[] selection;
/**
* Our TreeSelectionListeners.
*/
protected EventListenerList listenerList;
/**
* The current RowMapper.
*/
protected transient RowMapper rowMapper;
/**
* The current listSelectionModel.
*/
protected DefaultListSelectionModel listSelectionModel;
/**
* The current selection mode.
*/
protected int selectionMode;
/**
* The path that has been added last.
*/
protected TreePath leadPath;
/**
* The index of the last added path.
*/
protected int leadIndex;
/**
* The row of the last added path according to the RowMapper.
*/
protected int leadRow = -1;
/**
* Constructs a new DefaultTreeSelectionModel.
*/
public DefaultTreeSelectionModel()
{
setSelectionMode(DISCONTIGUOUS_TREE_SELECTION);
listenerList = new EventListenerList();
}
/**
* Creates a clone of this DefaultTreeSelectionModel with the same selection.
* The cloned instance will have the same registered listeners, the listeners
* themselves will not be cloned. The selection will be cloned.
*
* @exception CloneNotSupportedException should not be thrown here
* @return a copy of this DefaultTreeSelectionModel
*/
public Object clone() throws CloneNotSupportedException
{
DefaultTreeSelectionModel cloned =
(DefaultTreeSelectionModel) super.clone();
// Clone the selection and the list selection model.
cloned.selection = (TreePath[]) selection.clone();
if (listSelectionModel != null)
cloned.listSelectionModel
= (DefaultListSelectionModel) listSelectionModel.clone();
return cloned;
}
/**
* Returns a string that shows this object's properties.
* The returned string lists the selected tree rows, if any.
*
* @return a string that shows this object's properties
*/
public String toString()
{
if (isSelectionEmpty())
return "[selection empty]";
else
{
StringBuffer b = new StringBuffer("selected rows: [");
for (int i = 0; i < selection.length; i++)
{
b.append(getRow(selection[i]));
b.append(' ');
}
b.append(", lead " + getLeadSelectionRow());
return b.toString();
}
}
/**
* writeObject
*
* @param value0 TODO
* @exception IOException TODO
*/
private void writeObject(ObjectOutputStream value0) throws IOException
{
// TODO
}
/**
* readObject
*
* @param value0 TODO
* @exception IOException TODO
* @exception ClassNotFoundException TODO
*/
private void readObject(ObjectInputStream value0) throws IOException,
ClassNotFoundException
{
// TODO
}
/**
* Sets the RowMapper that should be used to map between paths and their rows.
*
* @param mapper the RowMapper to set
* @see RowMapper
*/
public void setRowMapper(RowMapper mapper)
{
rowMapper = mapper;
}
/**
* Returns the RowMapper that is currently used to map between paths and their
* rows.
*
* @return the current RowMapper
* @see RowMapper
*/
public RowMapper getRowMapper()
{
return rowMapper;
}
/**
* Sets the current selection mode. Possible values are
* {@link #SINGLE_TREE_SELECTION}, {@link #CONTIGUOUS_TREE_SELECTION} and
* {@link #DISCONTIGUOUS_TREE_SELECTION}.
*
* @param mode the selection mode to be set
* @see #getSelectionMode
* @see #SINGLE_TREE_SELECTION
* @see #CONTIGUOUS_TREE_SELECTION
* @see #DISCONTIGUOUS_TREE_SELECTION
*/
public void setSelectionMode(int mode)
{
selectionMode = mode;
insureRowContinuity();
}
/**
* Returns the current selection mode.
*
* @return the current selection mode
* @see #setSelectionMode
* @see #SINGLE_TREE_SELECTION
* @see #CONTIGUOUS_TREE_SELECTION
* @see #DISCONTIGUOUS_TREE_SELECTION
*/
public int getSelectionMode()
{
return selectionMode;
}
/**
* Sets this path as the only selection. If this changes the selection the
* registered TreeSelectionListeners are notified.
*
* @param path the path to set as selection
*/
public void setSelectionPath(TreePath path)
{
// The most frequently only one cell in the tree is selected.
TreePath[] ose = selection;
selection = new TreePath[] { path };
TreePath oldLead = leadPath;
leadIndex = 0;
leadRow = getRow(path);
leadPath = path;
TreeSelectionEvent event;
if (ose != null && ose.length > 0)
{
// The first item in the path list is the selected path.
// The remaining items are unselected pathes.
TreePath[] changed = new TreePath[ose.length + 1];
boolean[] news = new boolean[changed.length];
news[0] = true;
changed[0] = path;
System.arraycopy(ose, 0, changed, 1, ose.length);
event = new TreeSelectionEvent(this, changed, news, oldLead, path);
}
else
{
event = new TreeSelectionEvent(this, path, true, oldLead, path);
}
fireValueChanged(event);
}
/**
* Get the number of the tree row for the given path.
*
* @param path the tree path
* @return the tree row for this path or -1 if the path is not visible.
*/
int getRow(TreePath path)
{
RowMapper mapper = getRowMapper();
if (mapper instanceof AbstractLayoutCache)
{
// The absolute majority of cases, unless the TreeUI is very
// seriously rewritten
AbstractLayoutCache ama = (AbstractLayoutCache) mapper;
return ama.getRowForPath(path);
}
else
{
// Generic non optimized implementation.
int[] rows = mapper.getRowsForPaths(new TreePath[] { path });
if (rows.length == 0)
return - 1;
else
return rows[0];
}
}
/**
* Sets the paths as selection. This method checks for duplicates and removes
* them. If this changes the selection the registered TreeSelectionListeners
* are notified.
*
* @param paths the paths to set as selection
*/
public void setSelectionPaths(TreePath[] paths)
{
// Must be called, as defined in JDK API 1.4.
insureUniqueness();
clearSelection();
addSelectionPaths(paths);
}
/**
* Adds a path to the list of selected paths. This method checks if the path
* is already selected and doesn't add the same path twice. If this changes
* the selection the registered TreeSelectionListeners are notified.
*
* The lead path is changed to the added path. This also happen if the
* passed path was already selected before.
*
* @param path the path to add to the selection
*/
public void addSelectionPath(TreePath path)
{
if (! isPathSelected(path))
{
if (selectionMode == SINGLE_TREE_SELECTION || isSelectionEmpty()
|| ! canPathBeAdded(path))
setSelectionPath(path);
else
{
TreePath[] temp = new TreePath[selection.length + 1];
System.arraycopy(selection, 0, temp, 0, selection.length);
temp[temp.length - 1] = path;
selection = new TreePath[temp.length];
System.arraycopy(temp, 0, selection, 0, temp.length);
}
}
if (path != leadPath)
{
TreePath oldLead = leadPath;
leadPath = path;
leadRow = getRow(path);
leadIndex = selection.length - 1;
fireValueChanged(new TreeSelectionEvent(this, path, true, oldLead,
leadPath));
}
}
/**
* Adds the paths to the list of selected paths. This method checks if the
* paths are already selected and doesn't add the same path twice. If this
* changes the selection the registered TreeSelectionListeners are notified.
*
* @param paths the paths to add to the selection
*/
public void addSelectionPaths(TreePath[] paths)
{
// Must be called, as defined in JDK API 1.4.
insureUniqueness();
if (paths != null)
{
TreePath v0 = null;
for (int i = 0; i < paths.length; i++)
{
v0 = paths[i];
if (! isPathSelected(v0))
{
if (isSelectionEmpty())
setSelectionPath(v0);
else
{
TreePath[] temp = new TreePath[selection.length + 1];
System.arraycopy(selection, 0, temp, 0, selection.length);
temp[temp.length - 1] = v0;
selection = new TreePath[temp.length];
System.arraycopy(temp, 0, selection, 0, temp.length);
}
TreePath oldLead = leadPath;
leadPath = paths[paths.length - 1];
leadRow = getRow(leadPath);
leadIndex = selection.length - 1;
fireValueChanged(new TreeSelectionEvent(this, v0, true,
oldLead, leadPath));
}
}
insureRowContinuity();
}
}
/**
* Removes the path from the selection. If this changes the selection the
* registered TreeSelectionListeners are notified.
*
* @param path the path to remove
*/
public void removeSelectionPath(TreePath path)
{
if (isSelectionEmpty())
return;
int index = - 1;
if (isPathSelected(path))
{
for (int i = 0; i < selection.length; i++)
{
if (selection[i].equals(path))
{
index = i;
break;
}
}
TreePath[] temp = new TreePath[selection.length - 1];
System.arraycopy(selection, 0, temp, 0, index);
System.arraycopy(selection, index + 1, temp, index, selection.length
- index - 1);
selection = new TreePath[temp.length];
System.arraycopy(temp, 0, selection, 0, temp.length);
// If the removed path was the lead path, set the lead path to null.
TreePath oldLead = leadPath;
if (path != null && leadPath != null && path.equals(leadPath))
leadPath = null;
fireValueChanged(new TreeSelectionEvent(this, path, false, oldLead,
leadPath));
insureRowContinuity();
}
}
/**
* Removes the paths from the selection. If this changes the selection the
* registered TreeSelectionListeners are notified.
*
* @param paths the paths to remove
*/
public void removeSelectionPaths(TreePath[] paths)
{
if (isSelectionEmpty())
return;
if (paths != null)
{
int index = - 1;
TreePath v0 = null;
TreePath oldLead = leadPath;
for (int i = 0; i < paths.length; i++)
{
v0 = paths[i];
if (isPathSelected(v0))
{
for (int x = 0; x < selection.length; x++)
{
if (selection[i].equals(v0))
{
index = x;
break;
}
if (leadPath != null && leadPath.equals(v0))
leadPath = null;
}
TreePath[] temp = new TreePath[selection.length - 1];
System.arraycopy(selection, 0, temp, 0, index);
System.arraycopy(selection, index + 1, temp, index,
selection.length - index - 1);
selection = new TreePath[temp.length];
System.arraycopy(temp, 0, selection, 0, temp.length);
fireValueChanged(new TreeSelectionEvent(this, v0, false,
oldLead, leadPath));
}
}
insureRowContinuity();
}
}
/**
* Returns the first path in the selection. This is especially useful when the
* selectionMode is {@link #SINGLE_TREE_SELECTION}.
*
* @return the first path in the selection
*/
public TreePath getSelectionPath()
{
if ((selection == null) || (selection.length == 0))
return null;
else
return selection[0];
}
/**
* Returns the complete selection.
*
* @return the complete selection
*/
public TreePath[] getSelectionPaths()
{
return selection;
}
/**
* Returns the number of paths in the selection.
*
* @return the number of paths in the selection
*/
public int getSelectionCount()
{
if (selection == null)
return 0;
else
return selection.length;
}
/**
* Checks if a given path is in the selection.
*
* @param path the path to check
* @return <code>true</code> if the path is in the selection,
* <code>false</code> otherwise
*/
public boolean isPathSelected(TreePath path)
{
if (selection == null)
return false;
for (int i = 0; i < selection.length; i++)
{
if (selection[i].equals(path))
return true;
}
return false;
}
/**
* Checks if the selection is empty.
*
* @return <code>true</code> if the selection is empty, <code>false</code>
* otherwise
*/
public boolean isSelectionEmpty()
{
return (selection == null) || (selection.length == 0);
}
/**
* Removes all paths from the selection. Fire the unselection event.
*/
public void clearSelection()
{
if (! isSelectionEmpty())
{
TreeSelectionEvent event = new TreeSelectionEvent(
this, selection, new boolean[selection.length], leadPath, null);
leadPath = null;
selection = null;
fireValueChanged(event);
}
else
{
leadPath = null;
selection = null;
}
}
/**
* Adds a <code>TreeSelectionListener</code> object to this model.
*
* @param listener the listener to add
*/
public void addTreeSelectionListener(TreeSelectionListener listener)
{
listenerList.add(TreeSelectionListener.class, listener);
}
/**
* Removes a <code>TreeSelectionListener</code> object from this model.
*
* @param listener the listener to remove
*/
public void removeTreeSelectionListener(TreeSelectionListener listener)
{
listenerList.remove(TreeSelectionListener.class, listener);
}
/**
* Returns all <code>TreeSelectionListener</code> added to this model.
*
* @return an array of listeners
* @since 1.4
*/
public TreeSelectionListener[] getTreeSelectionListeners()
{
return (TreeSelectionListener[]) getListeners(TreeSelectionListener.class);
}
/**
* fireValueChanged
*
* @param event the event to fire.
*/
protected void fireValueChanged(TreeSelectionEvent event)
{
TreeSelectionListener[] listeners = getTreeSelectionListeners();
for (int i = 0; i < listeners.length; ++i)
listeners[i].valueChanged(event);
}
/**
* Returns all added listeners of a special type.
*
* @param listenerType the listener type
* @return an array of listeners
* @since 1.3
*/
public EventListener[] getListeners(Class listenerType)
{
return listenerList.getListeners(listenerType);
}
/**
* Returns the currently selected rows.
*
* @return the currently selected rows
*/
public int[] getSelectionRows()
{
if (rowMapper == null)
return null;
else
return rowMapper.getRowsForPaths(selection);
}
/**
* Returns the smallest row index from the selection.
*
* @return the smallest row index from the selection
*/
public int getMinSelectionRow()
{
if ((rowMapper == null) || (selection == null) || (selection.length == 0))
return - 1;
else
{
int[] rows = rowMapper.getRowsForPaths(selection);
int minRow = Integer.MAX_VALUE;
for (int index = 0; index < rows.length; index++)
minRow = Math.min(minRow, rows[index]);
return minRow;
}
}
/**
* Returns the largest row index from the selection.
*
* @return the largest row index from the selection
*/
public int getMaxSelectionRow()
{
if ((rowMapper == null) || (selection == null) || (selection.length == 0))
return - 1;
else
{
int[] rows = rowMapper.getRowsForPaths(selection);
int maxRow = - 1;
for (int index = 0; index < rows.length; index++)
maxRow = Math.max(maxRow, rows[index]);
return maxRow;
}
}
/**
* Checks if a particular row is selected.
*
* @param row the index of the row to check
* @return <code>true</code> if the row is in this selection,
* <code>false</code> otherwise
* @throws NullPointerException if the row mapper is not set (can only happen
* if the user has plugged in the custom incorrect TreeUI
* implementation.
*/
public boolean isRowSelected(int row)
{
// Return false if nothing is selected.
if (isSelectionEmpty())
return false;
RowMapper mapper = getRowMapper();
if (mapper instanceof AbstractLayoutCache)
{
// The absolute majority of cases, unless the TreeUI is very
// seriously rewritten
AbstractLayoutCache ama = (AbstractLayoutCache) mapper;
TreePath path = ama.getPathForRow(row);
return isPathSelected(path);
}
else
{
// Generic non optimized implementation.
int[] rows = mapper.getRowsForPaths(selection);
for (int i = 0; i < rows.length; i++)
if (rows[i] == row)
return true;
return false;
}
}
/**
* Updates the mappings from TreePaths to row indices.
*/
public void resetRowSelection()
{
// Nothing to do here.
}
/**
* getLeadSelectionRow
*
* @return int
*/
public int getLeadSelectionRow()
{
return leadRow;
}
/**
* getLeadSelectionPath
*
* @return TreePath
*/
public TreePath getLeadSelectionPath()
{
return leadPath;
}
/**
* Adds a <code>PropertyChangeListener</code> object to this model.
*
* @param listener the listener to add.
*/
public void addPropertyChangeListener(PropertyChangeListener listener)
{
changeSupport.addPropertyChangeListener(listener);
}
/**
* Removes a <code>PropertyChangeListener</code> object from this model.
*
* @param listener the listener to remove.
*/
public void removePropertyChangeListener(PropertyChangeListener listener)
{
changeSupport.removePropertyChangeListener(listener);
}
/**
* Returns all added <code>PropertyChangeListener</code> objects.
*
* @return an array of listeners.
* @since 1.4
*/
public PropertyChangeListener[] getPropertyChangeListeners()
{
return changeSupport.getPropertyChangeListeners();
}
/**
* Makes sure the currently selected paths are valid according to the current
* selectionMode. If the selectionMode is set to
* {@link #CONTIGUOUS_TREE_SELECTION} and the selection isn't contiguous then
* the selection is reset to the first set of contguous paths. If the
* selectionMode is set to {@link #SINGLE_TREE_SELECTION} and the selection
* has more than one path, the selection is reset to the contain only the
* first path.
*/
protected void insureRowContinuity()
{
if (selection == null || selection.length < 2)
return;
else if (selectionMode == CONTIGUOUS_TREE_SELECTION)
{
if (rowMapper == null)
// This is the best we can do without the row mapper:
selectOne();
else
{
int[] rows = rowMapper.getRowsForPaths(selection);
Arrays.sort(rows);
int i;
for (i = 1; i < rows.length; i++)
{
if (rows[i - 1] != rows[i] - 1)
// Break if no longer continuous.
break;
}
if (i < rows.length)
{
TreePath[] ns = new TreePath[i];
for (int j = 0; j < ns.length; j++)
ns[i] = getPath(j);
setSelectionPaths(ns);
}
}
}
else if (selectionMode == SINGLE_TREE_SELECTION)
selectOne();
}
/**
* Keep only one (normally last or leading) path in the selection.
*/
private void selectOne()
{
if (leadIndex > 0 && leadIndex < selection.length)
setSelectionPath(selection[leadIndex]);
else
setSelectionPath(selection[selection.length - 1]);
}
/**
* Get path for the given row that must be in the current selection.
*/
private TreePath getPath(int row)
{
if (rowMapper instanceof AbstractLayoutCache)
return ((AbstractLayoutCache) rowMapper).getPathForRow(row);
else
{
int[] rows = rowMapper.getRowsForPaths(selection);
for (int i = 0; i < rows.length; i++)
if (rows[i] == row)
return selection[i];
}
throw new InternalError(row + " not in selection");
}
/**
* Returns <code>true</code> if the paths are contiguous (take subsequent
* rows in the diplayed tree view. The method returns <code>true</code> if
* we have no RowMapper assigned.
*
* @param paths the paths to check for continuity
* @return <code>true</code> if the paths are contiguous or we have no
* RowMapper assigned
*/
protected boolean arePathsContiguous(TreePath[] paths)
{
if (rowMapper == null || paths.length < 2)
return true;
int[] rows = rowMapper.getRowsForPaths(paths);
// The patches may not be sorted.
Arrays.sort(rows);
for (int i = 1; i < rows.length; i++)
{
if (rows[i - 1] != rows[i] - 1)
return false;
}
return true;
}
/**
* Checks if the paths can be added. This returns <code>true</code> if:
* <ul>
* <li><code>paths</code> is <code>null</code> or empty</li>
* <li>we have no RowMapper assigned</li>
* <li>nothing is currently selected</li>
* <li>selectionMode is {@link #DISCONTIGUOUS_TREE_SELECTION}</li>
* <li>adding the paths to the selection still results in a contiguous set of
* paths</li>
*
* @param paths the paths to check
* @return <code>true</code> if the paths can be added with respect to the
* selectionMode
*/
protected boolean canPathsBeAdded(TreePath[] paths)
{
if (rowMapper == null || isSelectionEmpty()
|| selectionMode == DISCONTIGUOUS_TREE_SELECTION)
return true;
TreePath [] all = new TreePath[paths.length + selection.length];
System.arraycopy(paths, 0, all, 0, paths.length);
System.arraycopy(selection, 0, all, paths.length, selection.length);
return arePathsContiguous(all);
}
/**
* Checks if the single path can be added to selection.
*/
private boolean canPathBeAdded(TreePath path)
{
if (rowMapper == null || isSelectionEmpty()
|| selectionMode == DISCONTIGUOUS_TREE_SELECTION)
return true;
TreePath[] all = new TreePath[selection.length + 1];
System.arraycopy(selection, 0, all, 0, selection.length);
all[all.length - 1] = path;
return arePathsContiguous(all);
}
/**
* Checks if the paths can be removed without breaking the continuity of the
* selection according to selectionMode.
*
* @param paths the paths to check
* @return <code>true</code> if the paths can be removed with respect to the
* selectionMode
*/
protected boolean canPathsBeRemoved(TreePath[] paths)
{
if (rowMapper == null || isSelectionEmpty()
|| selectionMode == DISCONTIGUOUS_TREE_SELECTION)
return true;
HashSet set = new HashSet();
for (int i = 0; i < selection.length; i++)
set.add(selection[i]);
for (int i = 0; i < paths.length; i++)
set.remove(paths[i]);
TreePath[] remaining = new TreePath[set.size()];
Iterator iter = set.iterator();
for (int i = 0; i < remaining.length; i++)
remaining[i] = (TreePath) iter.next();
return arePathsContiguous(remaining);
}
/**
* Notify the installed listeners that the given patches have changed. This
* method will call listeners if invoked, but it is not called from the
* implementation of this class.
*
* @param vPathes the vector of the changed patches
* @param oldLeadSelection the old selection index
*/
protected void notifyPathChange(Vector vPathes, TreePath oldLeadSelection)
{
TreePath[] pathes = new TreePath[vPathes.size()];
for (int i = 0; i < pathes.length; i++)
pathes[i] = (TreePath) vPathes.get(i);
boolean[] news = new boolean[pathes.length];
for (int i = 0; i < news.length; i++)
news[i] = isPathSelected(pathes[i]);
TreeSelectionEvent event = new TreeSelectionEvent(this, pathes, news,
oldLeadSelection,
leadPath);
fireValueChanged(event);
}
/**
* Updates the lead selection row number after changing the lead selection
* path.
*/
protected void updateLeadIndex()
{
if (isSelectionEmpty())
{
leadRow = leadIndex = - 1;
}
else
{
leadRow = getRow(leadPath);
for (int i = 0; i < selection.length; i++)
{
if (selection[i].equals(leadPath))
{
leadIndex = i;
break;
}
}
leadIndex = leadRow;
}
}
/**
* This method exists due historical reasons and returns without action
* (unless overridden). For compatibility with the applications that override
* it, it is still called from the {@link #setSelectionPaths(TreePath[])} and
* {@link #addSelectionPaths(TreePath[])}.
*/
protected void insureUniqueness()
{
// Following the API 1.4, the method should return without action.
}
}
| {
"content_hash": "4657d743404ba2f109742ea1c3c532af",
"timestamp": "",
"source": "github",
"line_count": 988,
"max_line_length": 80,
"avg_line_length": 27.861336032388664,
"alnum_prop": 0.6056235695862244,
"repo_name": "shaotuanchen/sunflower_exp",
"id": "0684ef7665906e4e7a047e62d5bcc5af775cece2",
"size": "29291",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "tools/source/gcc-4.2.4/libjava/classpath/javax/swing/tree/DefaultTreeSelectionModel.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "459993"
},
{
"name": "Awk",
"bytes": "6562"
},
{
"name": "Batchfile",
"bytes": "9028"
},
{
"name": "C",
"bytes": "50326113"
},
{
"name": "C++",
"bytes": "2040239"
},
{
"name": "CSS",
"bytes": "2355"
},
{
"name": "Clarion",
"bytes": "2484"
},
{
"name": "Coq",
"bytes": "61440"
},
{
"name": "DIGITAL Command Language",
"bytes": "69150"
},
{
"name": "Emacs Lisp",
"bytes": "186910"
},
{
"name": "Fortran",
"bytes": "5364"
},
{
"name": "HTML",
"bytes": "2171356"
},
{
"name": "JavaScript",
"bytes": "27164"
},
{
"name": "Logos",
"bytes": "159114"
},
{
"name": "M",
"bytes": "109006"
},
{
"name": "M4",
"bytes": "100614"
},
{
"name": "Makefile",
"bytes": "5409865"
},
{
"name": "Mercury",
"bytes": "702"
},
{
"name": "Module Management System",
"bytes": "56956"
},
{
"name": "OCaml",
"bytes": "253115"
},
{
"name": "Objective-C",
"bytes": "57800"
},
{
"name": "Papyrus",
"bytes": "3298"
},
{
"name": "Perl",
"bytes": "70992"
},
{
"name": "Perl 6",
"bytes": "693"
},
{
"name": "PostScript",
"bytes": "3440120"
},
{
"name": "Python",
"bytes": "40729"
},
{
"name": "Redcode",
"bytes": "1140"
},
{
"name": "Roff",
"bytes": "3794721"
},
{
"name": "SAS",
"bytes": "56770"
},
{
"name": "SRecode Template",
"bytes": "540157"
},
{
"name": "Shell",
"bytes": "1560436"
},
{
"name": "Smalltalk",
"bytes": "10124"
},
{
"name": "Standard ML",
"bytes": "1212"
},
{
"name": "TeX",
"bytes": "385584"
},
{
"name": "WebAssembly",
"bytes": "52904"
},
{
"name": "Yacc",
"bytes": "510934"
}
],
"symlink_target": ""
} |
package gov.va.escreening.entity;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@Table(name = "note_title")
@NamedQueries({
@NamedQuery(name = "NoteTitle.findAll", query = "SELECT n FROM NoteTitle n") })
public class NoteTitle implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "note_title_id")
private Integer noteTitleId;
@Column(name = "vista_ien")
private String vistaIen;
@Column(name = "name")
private String name;
@Basic(optional = false)
@Column(name = "date_created")
@Temporal(TemporalType.TIMESTAMP)
private Date dateCreated;
@OneToMany(mappedBy = "noteTitle")
private List<VeteranAssessment> veteranAssessmentList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "noteTitle")
private List<NoteTitleMap> noteTitleMapList;
public NoteTitle() {
}
public NoteTitle(Integer noteTitleId) {
this.noteTitleId = noteTitleId;
}
public NoteTitle(Integer noteTitleId, Date dateCreated) {
this.noteTitleId = noteTitleId;
this.dateCreated = dateCreated;
}
public Integer getNoteTitleId() {
return noteTitleId;
}
public void setNoteTitleId(Integer noteTitleId) {
this.noteTitleId = noteTitleId;
}
public String getVistaIen() {
return vistaIen;
}
public void setVistaIen(String vistaIen) {
this.vistaIen = vistaIen;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
public List<VeteranAssessment> getVeteranAssessmentList() {
return veteranAssessmentList;
}
public void setVeteranAssessmentList(List<VeteranAssessment> veteranAssessmentList) {
this.veteranAssessmentList = veteranAssessmentList;
}
public List<NoteTitleMap> getNoteTitleMapList() {
return noteTitleMapList;
}
public void setNoteTitleMapList(List<NoteTitleMap> noteTitleMapList) {
this.noteTitleMapList = noteTitleMapList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (noteTitleId != null ? noteTitleId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof NoteTitle)) {
return false;
}
NoteTitle other = (NoteTitle) object;
if ((this.noteTitleId == null && other.noteTitleId != null)
|| (this.noteTitleId != null && !this.noteTitleId.equals(other.noteTitleId))) {
return false;
}
return true;
}
@Override
public String toString() {
return "gov.va.escreening.entity.NoteTitle[ noteTitleId=" + noteTitleId + " ]";
}
}
| {
"content_hash": "5b7118a6a253f47176c8893853d2099a",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 95,
"avg_line_length": 28.732824427480917,
"alnum_prop": 0.6522316684378321,
"repo_name": "VHAINNOVATIONS/Mental-Health-eScreening",
"id": "ae17b75c24ccad7a359d86422a260cecf33567f8",
"size": "3764",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "escreening/src/main/java/gov/va/escreening/entity/NoteTitle.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "8420"
},
{
"name": "CSS",
"bytes": "5863912"
},
{
"name": "FreeMarker",
"bytes": "95953"
},
{
"name": "HTML",
"bytes": "7483285"
},
{
"name": "Java",
"bytes": "3630842"
},
{
"name": "JavaScript",
"bytes": "4323611"
},
{
"name": "PLSQL",
"bytes": "1476"
},
{
"name": "PLpgSQL",
"bytes": "310"
},
{
"name": "SQLPL",
"bytes": "93612"
},
{
"name": "Scala",
"bytes": "3339"
},
{
"name": "Shell",
"bytes": "6295"
}
],
"symlink_target": ""
} |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Pk extends CI_Controller {
public function __construct() {
parent::__construct();
if(!$this->session->userdata('logged_in')) {
redirect('login', 'refresh');
}
elseif($this->session->userdata('tingkatan') != "kaprodi_tk" && $this->session->userdata('tingkatan') != "kaprodi_tk") {
redirect('login', 'refresh');
}
$this->load->model('Input_model');
}
public function index() {
$sessiondata = $this->session->userdata('id_user');
if($query = $this->Input_model->get_data_pk($sessiondata)) {
$data['proposale'] = $query;
}
else
$data['proposale'] = NULL;
$this->load->view('kaprodi_tk/cetak_pk',$data);
}
}
| {
"content_hash": "65438f1cba60e9b2537b20dc61a11d3f",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 125,
"avg_line_length": 22.37142857142857,
"alnum_prop": 0.5798212005108557,
"repo_name": "Avit22/proposal",
"id": "7bc4ed6d667615094de95be6e6febcac630f41b8",
"size": "783",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/controllers/kaprodi_tk/Pk.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1036"
},
{
"name": "CSS",
"bytes": "392242"
},
{
"name": "HTML",
"bytes": "3355670"
},
{
"name": "JavaScript",
"bytes": "60180"
},
{
"name": "PHP",
"bytes": "35672210"
},
{
"name": "PowerShell",
"bytes": "1028"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
Annls mycol. 4: 437 (1906)
#### Original name
Puccinia xanthosperma Syd. & P. Syd.
### Remarks
null | {
"content_hash": "ecc3440b21d1bbbbc59da06bd2d2b2f0",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 36,
"avg_line_length": 12.538461538461538,
"alnum_prop": 0.6809815950920245,
"repo_name": "mdoering/backbone",
"id": "b5cee14c67e4b80ab7d05e5ce5e3e0593426c07c",
"size": "223",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Basidiomycota/Pucciniomycetes/Pucciniales/Pucciniaceae/Puccinia/Puccinia xanthosperma/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
layout: post
published: true
title: Wraparound is coming
modified: 2019-08-22 14:57:22
categories: articles
author: doug_hunley
tags:
- pgcmh
- postgresql
comments: true
share: true
---
The August meeting will be held at **18:00 EST on Tues, the 27<sup>th</sup>**. Once again, we will be holding the meeting in the community space at CoverMyMeds. *Please RSVP on [MeetUp](https://www.meetup.com/postgresCMH/events/bjbmcmyzlbkc/) so we have an idea on the amount of food needed.*
What
----
Seal Software'is very own [Arlette](https://www.linkedin.com/in/arlette-garay-28075a2/) will be presenting this month. She's going to tell us all about transaction wraparound: what it is, why it happens, why you should care about, and how to prevent it. This talk will touch on MVCC, VACUUM FREEZE, and tuning autovacuum.
Where
-----
CoverMyMeds has graciously agreed to validate your parking if you use their garage so please park there:
<iframe src="https://www.google.com/maps/embed?pb=!1m0!3m2!1sen!2sus!4v1488389756992!6m8!1m7!1sLjB1moOcFPJm5UT4cdhnig!2m2!1d39.95415440342131!2d-83.0050335305906!3f321.1273220824533!4f-4.543767100369678!5f0.7820865974627469" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>
**You can safely ignore any sign saying to not park in the garage as long as it's after 17:30 when you arrive.**
_Park in any space that is not marked '24 hour reserved'._
Once parked, take the elevator/stairs to the 3<sup>rd</sup> floor to reach the Miranova lobby. Once in the lobby, the elevator bank is in the back (West side) of the building. Take a left and walk down the hall until you see the elevator bank on your right. Grab an elevator up to the 11<sup>th</sup> floor. _(If the elevator won't let you pick the 11<sup>th</sup> floor, contact Doug or CJ (info below))._ Once you exit the elevator, look to your left and right; one side will have visible cubicles, the other won't. Head to the side _without cubicles_. You're now in the community space:

The kitchen is to your right (grab yourself a drink) and the meeting will be held to your left. Walk down the room towards the stage.
**If you have any issues or questions with parking or the elevators, feel free to text/call Doug at +1.614.316.5079 or CJ at +1.740.407.7043**
| {
"content_hash": "1d06078d864794ff30fd2455916d9b68",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 589,
"avg_line_length": 60.325,
"alnum_prop": 0.7596353087443017,
"repo_name": "pgCMH/pgcmhblog",
"id": "b4bb8b83f804fb7fbda459dc4860a8a4755a8ac8",
"size": "2417",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/posts/2019-08-22-Wraparound-is-coming.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "50701"
},
{
"name": "HTML",
"bytes": "962996"
},
{
"name": "JavaScript",
"bytes": "78211"
},
{
"name": "Ruby",
"bytes": "2024"
}
],
"symlink_target": ""
} |
import greenfoot.*;
public class Smiley extends Actor
{
public void act()
{
if (!getWorld().getObjects(GameOver.class).isEmpty()) return;
if (Greenfoot.mouseClicked(this))
{
BackGround bg = (BackGround) getWorld();
// Bar bar = (Bar) bg.getObjects(Bar.class).get(0);
int change = Greenfoot.getRandomNumber(2) * 2 - 1;
setImage((change == -1) ? "smiley5.png" : "smiley4.png");
bg.bar.add(change);
}
}
}
| {
"content_hash": "2c5e17f068a77f4f06a546dd3e04d065",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 69,
"avg_line_length": 30.11764705882353,
"alnum_prop": 0.54296875,
"repo_name": "hirparikh/Team-Project-1",
"id": "350600a354bc2ad0e7bea8e14a3e0c76a025ee6e",
"size": "512",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Team/Samples/progress bar/Smiley.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "141038"
},
{
"name": "Makefile",
"bytes": "3313"
},
{
"name": "Shell",
"bytes": "13922"
}
],
"symlink_target": ""
} |
require 'spec_helper'
require 'hailstorm/model/helper/ami_provision_helper'
describe Hailstorm::Model::Helper::AmiProvisionHelper do
before(:each) do
@helper = Hailstorm::Model::Helper::AmiProvisionHelper.new(region: 'us-east-1',
user_home: '/home/ubuntu',
jmeter_version: '5.2.1')
end
context '#install_jmeter' do
it 'should execute installer commands' do
mock_ssh = instance_double(Hailstorm::Behavior::SshConnection)
output_with_return_status = Net::SSH::Connection::Session::StringWithExitstatus.new('', 0)
expect(mock_ssh).to receive(:exec!).at_least(:once).and_return(output_with_return_status)
@helper.install_jmeter(mock_ssh)
end
context 'when an error occurs' do
it 'should raise error' do
mock_ssh = instance_double(Hailstorm::Behavior::SshConnection)
output_with_return_status = Net::SSH::Connection::Session::StringWithExitstatus.new('', 1)
expect(mock_ssh).to receive(:exec!).at_least(:once).and_return(output_with_return_status)
expect { @helper.install_jmeter(mock_ssh) }.to raise_error(Hailstorm::JMeterInstallationException) do |error|
expect(error).to be_retryable
expect(error.diagnostics).to_not be_blank
end
end
end
end
context '#install_java' do
it 'should collect remote stdout' do
allow(@helper).to receive(:ssh_channel_exec_instr) do |_ssh, instr, cb|
cb.call("#{instr} ok")
true
end
expect(@helper.install_java(instance_double(Hailstorm::Behavior::SshConnection))).to_not be_empty
end
it 'should raise error if installation fails' do
allow(@helper).to receive(:ssh_channel_exec_instr).and_return(nil)
expect { @helper.install_java(instance_double(Hailstorm::Behavior::SshConnection)) }
.to raise_error(Hailstorm::JavaInstallationException) { |error| expect(error.diagnostics).to_not be_blank }
end
end
context '#ssh_channel_exec_instr' do
it 'should return instruction execution status' do
mock_channel = instance_double(Net::SSH::Connection::Channel)
allow(mock_channel).to receive(:on_data).and_yield(mock_channel, 'instruction output')
allow(mock_channel).to receive(:on_extended_data).and_yield(mock_channel, $stderr, nil)
allow(mock_channel).to receive(:wait)
allow(mock_channel).to receive(:exec) do |&block|
block.call(mock_channel, true)
end
mock_ssh = instance_double(Net::SSH::Connection::Session)
allow(mock_ssh).to receive(:open_channel) do |&block|
block.call(mock_channel)
mock_channel
end
out = ''
status = @helper.send(:ssh_channel_exec_instr, mock_ssh, 'ls', ->(s) { out += s.to_s })
expect(status).to be true
expect(out).to_not be_empty
end
end
end
| {
"content_hash": "12aca3f4cb36f28c82e36f0a70c184b4",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 117,
"avg_line_length": 42.57971014492754,
"alnum_prop": 0.646358066712049,
"repo_name": "3pillarlabs/hailstorm-sdk",
"id": "d5a325becca996d71470bbc5f2890622781f97ff",
"size": "2969",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "hailstorm-gem/spec/model/helper/ami_provision_helper_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "99"
},
{
"name": "Dockerfile",
"bytes": "2777"
},
{
"name": "Gherkin",
"bytes": "21548"
},
{
"name": "HTML",
"bytes": "52748"
},
{
"name": "Java",
"bytes": "84436"
},
{
"name": "JavaScript",
"bytes": "12680"
},
{
"name": "Makefile",
"bytes": "20859"
},
{
"name": "Ruby",
"bytes": "920329"
},
{
"name": "SCSS",
"bytes": "5640"
},
{
"name": "Shell",
"bytes": "7364"
},
{
"name": "TypeScript",
"bytes": "626556"
}
],
"symlink_target": ""
} |
define(function (require, exports, module) {(function(){
var ref$, chooseInt, choose, asGenerator, choice, frequency, sequence, recursive, size, label, transform, repeat, join, char, toInteger, toUnsignedInteger, toObject, Null, Undefined, Bool, Num, Byte, Char, Str, Int, UInt, Positive, Negative, NumChar, UpperChar, LowerChar, AlphaChar, AlphaNumChar, AlphaStr, NumStr, AlphaNumStr, Id, start, chars, rest, List, Map, Nothing, Falsy, Any, slice$ = [].slice;
ref$ = require('./random'), chooseInt = ref$.chooseInt, choose = ref$.choose;
ref$ = require('./generating'), asGenerator = ref$.asGenerator, choice = ref$.choice, frequency = ref$.frequency, sequence = ref$.sequence, recursive = ref$.recursive, size = ref$.size, label = ref$.label, transform = ref$.transform, repeat = ref$.repeat;
join = function(it){
return it.join('');
};
char = String.fromCharCode;
toInteger = function(n){
return n | 0;
};
toUnsignedInteger = function(n){
return n >>> 0;
};
toObject = function(as){
return as.reduce(function(r, arg$){
var k, v;
k = arg$[0], v = arg$[1];
return r[k + ""] = v, r;
}, {});
};
Null = asGenerator(null);
Undefined = asGenerator(void 8);
Bool = choice(true, false);
Num = label('num', asGenerator(function(s){
return choose(-s, s);
}));
Byte = label('byte', asGenerator(function(_){
return choose(0, 255);
}));
Char = label('char', transform(char, Byte));
Str = label('str', transform(join, repeat(Char)));
Int = label('int', transform(toInteger, Num));
UInt = label('uint', transform(toUnsignedInteger, Num));
Positive = label('positive', asGenerator(function(s){
return choose(1, s);
}));
Negative = label('negative', asGenerator(function(s){
return choose(-1, -s);
}));
NumChar = label('num-char', transform(char, function(){
return chooseInt(48, 57);
}));
UpperChar = label('upper-char', transform(char, function(){
return chooseInt(65, 90);
}));
LowerChar = label('lower-char', transform(char, function(){
return chooseInt(97, 122);
}));
AlphaChar = frequency([1, UpperChar], [9, LowerChar]);
AlphaNumChar = frequency([1, NumChar], [9, AlphaChar]);
AlphaStr = transform(join, repeat(AlphaChar));
NumStr = transform(join, repeat(NumChar));
AlphaNumStr = transform(join, repeat(AlphaNumChar));
Id = (start = frequency([1, '_'], [2, '$'], [9, AlphaChar]), chars = frequency([1, NumChar], [9, start]), rest = transform(join, repeat(chars)), label('id', transform(join, sequence(start, rest))));
List = function(){
var as;
as = slice$.call(arguments);
return repeat(choice.apply(null, as));
};
Map = function(){
var as;
as = slice$.call(arguments);
return transform(toObject, repeat(sequence(Id, choice.apply(null, as))));
};
Nothing = choice(Null, Undefined);
Falsy = choice(Nothing, false, 0, '');
Any = choice(Nothing, Bool, Num, Str, recursive(function(){
return List(Any);
}), recursive(function(){
return Map(Any);
}));
module.exports = {
Null: Null,
Undefined: Undefined,
Bool: Bool,
Num: Num,
Byte: Byte,
Char: Char,
Str: Str,
Int: Int,
UInt: UInt,
Positive: Positive,
Negative: Negative,
NumChar: NumChar,
UpperChar: UpperChar,
LowerChar: LowerChar,
AlphaChar: AlphaChar,
AlphaNumChar: AlphaNumChar,
AlphaStr: AlphaStr,
NumStr: NumStr,
AlphaNumStr: AlphaNumStr,
Id: Id,
Array: List,
Object: Map,
Nothing: Nothing,
Falsy: Falsy,
Any: Any
};
}).call(this);
});
| {
"content_hash": "fc19f8b8e78f385e4d8f9ae3f794b6a0",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 405,
"avg_line_length": 35.11764705882353,
"alnum_prop": 0.6334450027917364,
"repo_name": "arborbridge/solidstate.js",
"id": "895f909d324412dce348e5240fcd992c680c3ee9",
"size": "3582",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/vendor/claire-0.3.2/data.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "JavaScript",
"bytes": "133645"
}
],
"symlink_target": ""
} |
<component name="libraryTable">
<library name="Java EE 6-Java EE 6">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/javax.annotation.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/javax.servlet.jsp.jstl.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/javax.jms.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/javax.resource.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component> | {
"content_hash": "61e75e11a21a98b8eea381724b9c103e",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 73,
"avg_line_length": 35.5,
"alnum_prop": 0.5938967136150235,
"repo_name": "alexzhxin/SupRails",
"id": "a6ade52bba1490a4aa18b2c6991dc4877757d6ac",
"size": "426",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": ".idea/libraries/Java_EE_6_Java_EE_6.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "78275"
}
],
"symlink_target": ""
} |
Elastic Data Processing (EDP)
=============================
Overview
--------
Sahara's Elastic Data Processing facility or :dfn:`EDP` allows the execution
of jobs on clusters created from sahara. EDP supports:
* Hive, Pig, MapReduce, MapReduce.Streaming, Java, and Shell job types on
Hadoop clusters
* Spark jobs on Spark standalone clusters, MapR spark clusters, and CDH
clusters (v5.3.0 or higher)
* storage of job binaries in the OpenStack Object Storage service (swift),
the OpenStack Shared file systems service (manila), or sahara's own
database
* access to input and output data sources in
+ HDFS for all job types
+ swift for all types excluding Hive
+ manila (NFS shares only) for all types excluding Pig
* configuration of jobs at submission time
* execution of jobs on existing clusters or transient clusters
Interfaces
----------
The EDP features can be used from the sahara web UI which is described in the
:doc:`../horizon/dashboard.user.guide`.
The EDP features also can be used directly by a client through the
`REST api <http://developer.openstack.org/api-ref-data-processing-v1.1.html>`_
EDP Concepts
------------
Sahara EDP uses a collection of simple objects to define and execute jobs.
These objects are stored in the sahara database when they are created,
allowing them to be reused. This modular approach with database persistence
allows code and data to be reused across multiple jobs.
The essential components of a job are:
* executable code to run
* input and output data paths, as needed for the job
* any additional configuration values needed for the job run
These components are supplied through the objects described below.
Job Binaries
++++++++++++
A :dfn:`Job Binary` object stores a URL to a single script or Jar file and
any credentials needed to retrieve the file. The file itself may be stored
in the sahara internal database, in swift, or in manila.
Files in the sahara database are stored as raw bytes in a
:dfn:`Job Binary Internal` object. This object's sole purpose is to store a
file for later retrieval. No extra credentials need to be supplied for files
stored internally.
Sahara requires credentials (username and password) to access files stored in
swift unless swift proxy users are configured as described in
:doc:`../userdoc/advanced.configuration.guide`. The swift service must be
running in the same OpenStack installation referenced by sahara.
To reference a binary file stored in manila, create the job binary with the
URL ``manila//{share_id}/{path}``. This assumes that you have already stored
that file in the appropriate path on the share. The share will be
automatically mounted to any cluster nodes which require access to the file,
if it is not mounted already.
There is a configurable limit on the size of a single job binary that may be
retrieved by sahara. This limit is 5MB and may be set with the
*job_binary_max_KB* setting in the :file:`sahara.conf` configuration file.
Jobs
++++
A :dfn:`Job` object specifies the type of the job and lists all of the
individual Job Binary objects that are required for execution. An individual
Job Binary may be referenced by multiple Jos. A Job object specifies a main
binary and/or supporting libraries depending on its type:
+-------------------------+-------------+-----------+
| Job type | Main binary | Libraries |
+=========================+=============+===========+
| ``Hive`` | required | optional |
+-------------------------+-------------+-----------+
| ``Pig`` | required | optional |
+-------------------------+-------------+-----------+
| ``MapReduce`` | not used | required |
+-------------------------+-------------+-----------+
| ``MapReduce.Streaming`` | not used | optional |
+-------------------------+-------------+-----------+
| ``Java`` | not used | required |
+-------------------------+-------------+-----------+
| ``Shell`` | required | optional |
+-------------------------+-------------+-----------+
| ``Spark`` | required | optional |
+-------------------------+-------------+-----------+
Data Sources
++++++++++++
A :dfn:`Data Source` object stores a URL which designates the location of
input or output data and any credentials needed to access the location.
Sahara supports data sources in swift. The swift service must be running in
the same OpenStack installation referenced by sahara.
Sahara also supports data sources in HDFS. Any HDFS instance running on a
sahara cluster in the same OpenStack installation is accessible without
manual configuration. Other instances of HDFS may be used as well provided
that the URL is resolvable from the node executing the job.
Sahara supports data sources in manila as well. To reference a path on an NFS
share as a data source, create the data source with the URL
``manila//{share_id}/{path}``. As in the case of job binaries, the specified
share will be automatically mounted to your cluster's nodes as needed to
access the data source.
Some job types require the use of data source objects to specify input and
output when a job is launched. For example, when running a Pig job the UI will
prompt the user for input and output data source objects.
Other job types like Java or Spark do not require the user to specify data
sources. For these job types, data paths are passed as arguments. For
convenience, sahara allows data source objects to be referenced by name or id.
The section `Using Data Source References as Arguments`_ gives further
details.
Job Execution
+++++++++++++
Job objects must be *launched* or *executed* in order for them to run on the
cluster. During job launch, a user specifies execution details including data
sources, configuration values, and program arguments. The relevant details
will vary by job type. The launch will create a :dfn:`Job Execution` object in
sahara which is used to monitor and manage the job.
To execute Hadoop jobs, sahara generates an Oozie workflow and submits it to
the Oozie server running on the cluster. Familiarity with Oozie is not
necessary for using sahara but it may be beneficial to the user. A link to
the Oozie web console can be found in the sahara web UI in the cluster
details.
For Spark jobs, sahara uses the *spark-submit* shell script and executes the
Spark job from the master node. Logs of spark jobs run by sahara can be found
on the master node under the */tmp/spark-edp* directory.
.. _edp_workflow:
General Workflow
----------------
The general workflow for defining and executing a job in sahara is essentially
the same whether using the web UI or the REST API.
1. Launch a cluster from sahara if there is not one already available
2. Create all of the Job Binaries needed to run the job, stored in the sahara
database, in swift, or in manila
+ When using the REST API and internal storage of job binaries, the Job
Binary Internal objects must be created first
+ Once the Job Binary Internal objects are created, Job Binary objects may
be created which refer to them by URL
3. Create a Job object which references the Job Binaries created in step 2
4. Create an input Data Source which points to the data you wish to process
5. Create an output Data Source which points to the location for output data
6. Create a Job Execution object specifying the cluster and Job object plus
relevant data sources, configuration values, and program arguments
+ When using the web UI this is done with the
:guilabel:`Launch On Existing Cluster` or
:guilabel:`Launch on New Cluster` buttons on the Jobs tab
+ When using the REST API this is done via the */jobs/<job_id>/execute*
method
The workflow is simpler when using existing objects. For example, to
construct a new job which uses existing binaries and input data a user may
only need to perform steps 3, 5, and 6 above. Of course, to repeat the same
job multiple times a user would need only step 6.
Specifying Configuration Values, Parameters, and Arguments
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Jobs can be configured at launch. The job type determines the kinds of values
that may be set:
+--------------------------+---------------+------------+-----------+
| Job type | Configuration | Parameters | Arguments |
| | Values | | |
+==========================+===============+============+===========+
| ``Hive`` | Yes | Yes | No |
+--------------------------+---------------+------------+-----------+
| ``Pig`` | Yes | Yes | Yes |
+--------------------------+---------------+------------+-----------+
| ``MapReduce`` | Yes | No | No |
+--------------------------+---------------+------------+-----------+
| ``MapReduce.Streaming`` | Yes | No | No |
+--------------------------+---------------+------------+-----------+
| ``Java`` | Yes | No | Yes |
+--------------------------+---------------+------------+-----------+
| ``Shell`` | Yes | Yes | Yes |
+--------------------------+---------------+------------+-----------+
| ``Spark`` | Yes | No | Yes |
+--------------------------+---------------+------------+-----------+
* :dfn:`Configuration values` are key/value pairs.
+ The EDP configuration values have names beginning with *edp.* and are
consumed by sahara
+ Other configuration values may be read at runtime by Hadoop jobs
+ Currently additional configuration values are not available to Spark jobs
at runtime
* :dfn:`Parameters` are key/value pairs. They supply values for the Hive and
Pig parameter substitution mechanisms. In Shell jobs, they are passed as
environment variables.
* :dfn:`Arguments` are strings passed as command line arguments to a shell or
main program
These values can be set on the :guilabel:`Configure` tab during job launch
through the web UI or through the *job_configs* parameter when using the
*/jobs/<job_id>/execute* REST method.
In some cases sahara generates configuration values or parameters
automatically. Values set explicitly by the user during launch will override
those generated by sahara.
Using Data Source References as Arguments
+++++++++++++++++++++++++++++++++++++++++
Sometimes it's necessary or desirable to pass a data path as an argument to a
job. In these cases, a user may simply type out the path as an argument when
launching a job. If the path requires credentials, the user can manually add
the credentials as configuration values. However, if a data source object has
been created that contains the desired path and credentials there is no need
to specify this information manually.
As a convenience, sahara allows data source objects to be referenced by name
or id in arguments, configuration values, or parameters. When the job is
executed, sahara will replace the reference with the path stored in the data
source object and will add any necessary credentials to the job configuration.
Referencing an existing data source object is much faster than adding this
information by hand. This is particularly useful for job types like Java or
Spark that do not use data source objects directly.
There are two job configuration parameters that enable data source references.
They may be used with any job type and are set on the ``Configuration`` tab
when the job is launched:
* ``edp.substitute_data_source_for_name`` (default **False**) If set to
**True**, causes sahara to look for data source object name references in
configuration values, arguments, and parameters when a job is launched. Name
references have the form **datasource://name_of_the_object**.
For example, assume a user has a WordCount application that takes an input
path as an argument. If there is a data source object named **my_input**, a
user may simply set the **edp.substitute_data_source_for_name**
configuration parameter to **True** and add **datasource://my_input** as an
argument when launching the job.
* ``edp.substitute_data_source_for_uuid`` (default **False**) If set to
**True**, causes sahara to look for data source object ids in configuration
values, arguments, and parameters when a job is launched. A data source
object id is a uuid, so they are unique. The id of a data source object is
available through the UI or the sahara command line client. A user may
simply use the id as a value.
Generation of Swift Properties for Data Sources
+++++++++++++++++++++++++++++++++++++++++++++++
If swift proxy users are not configured (see
:doc:`../userdoc/advanced.configuration.guide`) and a job is run with data
source objects containing swift paths, sahara will automatically generate
swift username and password configuration values based on the credentials
in the data sources. If the input and output data sources are both in swift,
it is expected that they specify the same credentials.
The swift credentials may be set explicitly with the following configuration
values:
+------------------------------------+
| Name |
+====================================+
| fs.swift.service.sahara.username |
+------------------------------------+
| fs.swift.service.sahara.password |
+------------------------------------+
Setting the swift credentials explicitly is required when passing literal
swift paths as arguments instead of using data source references. When
possible, use data source references as described in
`Using Data Source References as Arguments`_.
Additional Details for Hive jobs
++++++++++++++++++++++++++++++++
Sahara will automatically generate values for the ``INPUT`` and ``OUTPUT``
parameters required by Hive based on the specified data sources.
Additional Details for Pig jobs
+++++++++++++++++++++++++++++++
Sahara will automatically generate values for the ``INPUT`` and ``OUTPUT``
parameters required by Pig based on the specified data sources.
For Pig jobs, ``arguments`` should be thought of as command line arguments
separated by spaces and passed to the ``pig`` shell.
``Parameters`` are a shorthand and are actually translated to the arguments
``-param name=value``
Additional Details for MapReduce jobs
+++++++++++++++++++++++++++++++++++++
**Important!**
If the job type is MapReduce, the mapper and reducer classes *must* be
specified as configuration values.
Note that the UI will not prompt the user for these required values; they must
be added manually with the ``Configure`` tab.
Make sure to add these values with the correct names:
+-------------------------+-----------------------------------------+
| Name | Example Value |
+=========================+=========================================+
| mapred.mapper.class | org.apache.oozie.example.SampleMapper |
+-------------------------+-----------------------------------------+
| mapred.reducer.class | org.apache.oozie.example.SampleReducer |
+-------------------------+-----------------------------------------+
Additional Details for MapReduce.Streaming jobs
+++++++++++++++++++++++++++++++++++++++++++++++
**Important!**
If the job type is MapReduce.Streaming, the streaming mapper and reducer
classes *must* be specified.
In this case, the UI *will* prompt the user to enter mapper and reducer
values on the form and will take care of adding them to the job configuration
with the appropriate names. If using the python client, however, be certain to
add these values to the job configuration manually with the correct names:
+-------------------------+---------------+
| Name | Example Value |
+=========================+===============+
| edp.streaming.mapper | /bin/cat |
+-------------------------+---------------+
| edp.streaming.reducer | /usr/bin/wc |
+-------------------------+---------------+
Additional Details for Java jobs
++++++++++++++++++++++++++++++++
Data Source objects are not used directly with Java job types. Instead, any
input or output paths must be specified as arguments at job launch either
explicitly or by reference as described in
`Using Data Source References as Arguments`_. Using data source references is
the recommended way to pass paths to Java jobs.
If configuration values are specified, they must be added to the job's
Hadoop configuration at runtime. There are two methods of doing this. The
simplest way is to use the **edp.java.adapt_for_oozie** option described
below. The other method is to use the code from
`this example <https://github.com/openstack/sahara/blob/master/etc/edp-examples/edp-java/README.rst>`_
to explicitly load the values.
The following special configuration values are read by sahara and affect how
Java jobs are run:
* ``edp.java.main_class`` (required) Specifies the full name of the class
containing ``main(String[] args)``
A Java job will execute the **main** method of the specified main class. Any
arguments set during job launch will be passed to the program through the
**args** array.
* ``oozie.libpath`` (optional) Specifies configuration values for the Oozie
share libs, these libs can be shared by different workflows
* ``edp.java.java_opts`` (optional) Specifies configuration values for the JVM
* ``edp.java.adapt_for_oozie`` (optional) Specifies that sahara should perform
special handling of configuration values and exit conditions. The default is
**False**.
If this configuration value is set to **True**, sahara will modify
the job's Hadoop configuration before invoking the specified **main** method.
Any configuration values specified during job launch (excluding those
beginning with **edp.**) will be automatically set in the job's Hadoop
configuration and will be available through standard methods.
Secondly, setting this option to **True** ensures that Oozie will handle
program exit conditions correctly.
At this time, the following special configuration value only applies when
running jobs on a cluster generated by the Cloudera plugin with the
**Enable Hbase Common Lib** cluster config set to **True** (the default value):
* ``edp.hbase_common_lib`` (optional) Specifies that a common Hbase lib
generated by sahara in HDFS be added to the **oozie.libpath**. This for use
when an Hbase application is driven from a Java job. Default is **False**.
The **edp-wordcount** example bundled with sahara shows how to use configuration
values, arguments, and swift data paths in a Java job type. Note that the
example does not use the **edp.java.adapt_for_oozie** option but includes the
code to load the configuration values explicitly.
Additional Details for Shell jobs
+++++++++++++++++++++++++++++++++
A shell job will execute the script specified as ``main``, and will place any
files specified as ``libs`` in the same working directory (on both the
filesystem and in HDFS). Command line arguments may be passed to the script
through the ``args`` array, and any ``params`` values will be passed as
environment variables.
Data Source objects are not used directly with Shell job types but data source
references may be used as described in
`Using Data Source References as Arguments`_.
The **edp-shell** example bundled with sahara contains a script which will
output the executing user to a file specified by the first command line
argument.
Additional Details for Spark jobs
+++++++++++++++++++++++++++++++++
Data Source objects are not used directly with Spark job types. Instead, any
input or output paths must be specified as arguments at job launch either
explicitly or by reference as described in
`Using Data Source References as Arguments`_. Using data source references
is the recommended way to pass paths to Spark jobs.
Spark jobs use some special configuration values:
* ``edp.java.main_class`` (required) Specifies the full name of the class
containing the Java or Scala main method:
+ ``main(String[] args)`` for Java
+ ``main(args: Array[String]`` for Scala
A Spark job will execute the **main** method of the specified main class.
Any arguments set during job launch will be passed to the program through the
**args** array.
* ``edp.spark.adapt_for_swift`` (optional) If set to **True**, instructs
sahara to modify the job's Hadoop configuration so that swift paths may be
accessed. Without this configuration value, swift paths will not be
accessible to Spark jobs. The default is **False**.
The **edp-spark** example bundled with sahara contains a Spark program for
estimating Pi.
Special Sahara URLs
--------------------
Sahara uses custom URLs to refer to objects stored in swift, in manila, or in
the sahara internal database. These URLs are not meant to be used outside of
sahara.
Sahara swift URLs passed to running jobs as input or output sources include a
".sahara" suffix on the container, for example:
``swift://container.sahara/object``
You may notice these swift URLs in job logs, however, you do not need to add
the suffix to the containers yourself. sahara will add the suffix if
necessary, so when using the UI or the python client you may write the above
URL simply as:
``swift://container/object``
Sahara internal database URLs have the form:
``internal-db://sahara-generated-uuid``
This indicates a file object in the sahara database which has the given uuid
as a key.
Manila NFS filesystem reference URLS take the form:
``manila://share-uuid/path``
This format should be used when referring to a job binary or a data source
stored in a manila NFS share.
EDP Requirements
================
The OpenStack installation and the cluster launched from sahara must meet the
following minimum requirements in order for EDP to function:
OpenStack Services
------------------
When a Hadoop job is executed, binaries are first uploaded to a cluster node
and then moved from the node local filesystem to HDFS. Therefore, there must
be an instance of HDFS available to the nodes in the sahara cluster.
If the swift service *is not* running in the OpenStack installation:
+ Job binaries may only be stored in the sahara internal database
+ Data sources require a long-running HDFS
If the swift service *is* running in the OpenStack installation:
+ Job binaries may be stored in swift or the sahara internal database
+ Data sources may be in swift or a long-running HDFS
Cluster Processes
-----------------
Requirements for EDP support depend on the EDP job type and plugin used for
the cluster. For example a Vanilla sahara cluster must run at least one
instance of these processes to support EDP:
* For Hadoop version 1:
+ jobtracker
+ namenode
+ oozie
+ tasktracker
+ datanode
* For Hadoop version 2:
+ namenode
+ datanode
+ resourcemanager
+ nodemanager
+ historyserver
+ oozie
EDP Technical Considerations
============================
There are several things in EDP which require attention in order
to work properly. They are listed on this page.
Transient Clusters
------------------
EDP allows running jobs on transient clusters. In this case the cluster is
created specifically for the job and is shut down automatically once the job
is finished.
Two config parameters control the behaviour of periodic clusters:
* periodic_enable - if set to 'False', sahara will do nothing to a transient
cluster once the job it was created for is completed. If it is set to
'True', then the behaviour depends on the value of the next parameter.
* use_identity_api_v3 - set it to 'False' if your OpenStack installation
does not provide keystone API v3. In that case sahara will not terminate
unneeded clusters. Instead it will set their state to 'AwaitingTermination'
meaning that they could be manually deleted by a user. If the parameter is
set to 'True', sahara will itself terminate the cluster. The limitation is
caused by lack of 'trusts' feature in Keystone API older than v3.
If both parameters are set to 'True', sahara works with transient clusters in
the following manner:
1. When a user requests for a job to be executed on a transient cluster,
sahara creates such a cluster.
2. Sahara drops the user's credentials once the cluster is created but
prior to that it creates a trust allowing it to operate with the
cluster instances in the future without user credentials.
3. Once a cluster is not needed, sahara terminates its instances using the
stored trust. sahara drops the trust after that.
| {
"content_hash": "f788089cf1067b038941091579b26df4",
"timestamp": "",
"source": "github",
"line_count": 583,
"max_line_length": 102,
"avg_line_length": 43.02401372212693,
"alnum_prop": 0.6699358131005063,
"repo_name": "zhangjunli177/sahara",
"id": "76c96806befec38171a8877e2e1d3a7b28d861e3",
"size": "25083",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "doc/source/userdoc/edp.rst",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "3609"
},
{
"name": "Mako",
"bytes": "29432"
},
{
"name": "PigLatin",
"bytes": "792"
},
{
"name": "Python",
"bytes": "3131969"
},
{
"name": "Shell",
"bytes": "60900"
}
],
"symlink_target": ""
} |
package org.apache.harmony.test.func.api.javax.management.remote.mbeans;
/**
*/
public interface TMBClassMBean{
public void setSomething(String str);
public String getMBeanNumber();
public void doOperation(String arg);
}
| {
"content_hash": "0eed6e109b960fa108ae8ab67d8d6a84",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 72,
"avg_line_length": 14.882352941176471,
"alnum_prop": 0.6956521739130435,
"repo_name": "freeVM/freeVM",
"id": "3111b600871bab339f87fcb2a35e7fbbc5efadda",
"size": "1065",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "enhanced/buildtest/tests/functional/src/test/functional/org/apache/harmony/test/func/api/javax/management/remote/mbeans/TMBClassMBean.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "116828"
},
{
"name": "C",
"bytes": "17860389"
},
{
"name": "C++",
"bytes": "19007206"
},
{
"name": "CSS",
"bytes": "217777"
},
{
"name": "Java",
"bytes": "152108632"
},
{
"name": "Objective-C",
"bytes": "106412"
},
{
"name": "Objective-J",
"bytes": "11029421"
},
{
"name": "Perl",
"bytes": "305690"
},
{
"name": "Scilab",
"bytes": "34"
},
{
"name": "Shell",
"bytes": "153821"
},
{
"name": "XSLT",
"bytes": "152859"
}
],
"symlink_target": ""
} |
#include "MomoLogic.h"
#include "SceneLogic.h"
#include "Common.h"
using namespace AsyncCalls;
namespace
{
const gkVector3 FORWARD(0, 1, 0);
const gkVector3 UP(0, 0, 1);
const gkVector3 SIDE(1, 0, 0);
enum STATES
{
CARRY,
CATCH,
CATCH_ENDED,
THROW_WITH,
WALK,
RUN,
RUN_FASTER,
WALK_BACK,
IDLE_NASTY,
IDLE_CAPOEIRA,
FALL,
FALL_UP,
KICK,
JUMP,
GLIDE,
FLY,
LAND
};
namespace velocity
{
gkScalar WALK = 1.5;
gkScalar WALK_BACK = -1;
gkScalar RUN = 3.5f;
gkScalar RUN_FASTER = 5;
gkScalar FLY = 6;
gkScalar NONE = 0;
}
namespace animation
{
gkString CARRY = "Momo_Carry";
gkString CATCH = "Momo_Catch";
gkString DEATH = "Momo_Death";
gkString DIE_LAVA = "Momo_DieLava";
gkString DJ = "Momo_dj";
gkString DROWNING = "Momo_Drowning";
gkString EDGE_CLIMB = "Momo_EdgeClimb";
gkString EDGE_IDLE = "Momo_EdgeIdle";
gkString FALL = "Momo_Fall";
gkString FALL_UP = "Momo_FallUp";
gkString GLIDE = "Momo_Glide";
gkString HIT_LIGHTLY = "Momo_Hit_Lightly";
gkString HIT_CARRY = "Momo_HitCarry";
gkString IDLE1 = "Momo_Idle1";
gkString IDLE_CAPOEIRA = "Momo_IdleCapoeira";
gkString IDLE_NASTY = "Momo_IdleNasty";
gkString JUMP = "Momo_Jump";
gkString KICK = "Momo_Kick";
gkString LAND = "Momo_Land";
gkString PICK = "Momo_Pick";
gkString REVIVE = "Momo_Revive";
gkString RUN = "Momo_Run";
gkString RUN_FASTER = "Momo_RunFaster";
gkString SHIMMY_L = "Momo_ShimmyL";
gkString SHIMMY_R = "Momo_ShimmyR";
gkString TAIL_WHIP = "Momo_TailWhip";
gkString THROW_1 = "Momo_Throw1";
gkString THROW_SHEEP = "Momo_ThrowSheep";
gkString THROW_WITH = "Momo_ThrowWith";
gkString THROW_WITHOUT = "Momo_ThrowWithout";
gkString TURN_L = "Momo_Turn.L";
gkString TURN_R = "Momo_Turn.R";
gkString WALK = "Momo_Walk";
gkString WALK_BACK = "Momo_WalkBack";
gkString WALK_FAST = "Momo_WalkFast";
gkString WALK_HAND = "Momo_WalkHand";
gkString WALK_SLOW = "Momo_WalkSlow";
gkString WALL_FLIP = "Momo_WallFlip";
}
}
namespace particle
{
gkString DUST_RUN = "DustRun";
gkString DUST_WALK = "DustWalk";
}
MomoLogic::MomoLogic(gkGameObject* obj, SceneLogic* scene)
: m_characterNode(0),
m_kickTestNode(0),
m_obj(obj),
m_scene(scene),
m_tree(scene->m_tree),
m_momoGrab(0),
m_cameraNode(0),
m_steeringObject(0),
m_ifSelectNode(0),
m_following(false),
m_hasImpactGround(false)
{
m_steeringObject = new gkSteeringPathFollowing(
obj,
velocity::RUN_FASTER + 1,
FORWARD,
UP,
SIDE,
gkVector3(2, 4, 2),
256,
0.00005f
);
m_steeringObject->setGoalRadius(m_steeringObject->radius());
m_steeringObject->setMaxForce(10);
m_momoGrab = m_tree->createNode<gkGrabNode>();
m_kickTestNode = m_tree->createNode<gkRayTestNode>();
m_cameraNode = m_tree->createNode<gkCameraNode>();
m_obj->getChildEntity()->addAnimation(animation::CARRY);
m_obj->getChildEntity()->addAnimation(animation::CATCH);
m_obj->getChildEntity()->addAnimation(animation::THROW_WITH);
m_obj->getChildEntity()->addAnimation(animation::WALK);
m_obj->getChildEntity()->addAnimation(animation::RUN);
m_obj->getChildEntity()->addAnimation(animation::RUN_FASTER);
m_obj->getChildEntity()->addAnimation(animation::WALK_BACK);
m_obj->getChildEntity()->addAnimation(animation::IDLE_NASTY);
m_obj->getChildEntity()->addAnimation(animation::IDLE_CAPOEIRA);
m_obj->getChildEntity()->addAnimation(animation::FALL);
m_obj->getChildEntity()->addAnimation(animation::FALL_UP);
m_obj->getChildEntity()->addAnimation(animation::KICK);
m_obj->getChildEntity()->addAnimation(animation::JUMP);
m_obj->getChildEntity()->addAnimation(animation::GLIDE);
m_obj->getChildEntity()->addAnimation(animation::LAND);
m_characterNode = m_tree->createNode<gkCharacterNode>();
m_characterNode->setObj(m_obj);
m_ifSelectNode = BOOL_AND_NODE(m_scene->m_shiftKeyNode->getIS_DOWN(),
m_scene->m_leftMouseNode->getPRESS());
m_screenTargetNode = m_tree->createNode<gkScreenRayTestNode>();
m_screenTargetNode->getENABLE()->link(m_ifSelectNode->getIS_TRUE());
m_screenTargetNode->getSCREEN_X()->link(m_scene->m_mouseNode->getABS_X());
m_screenTargetNode->getSCREEN_Y()->link(m_scene->m_mouseNode->getABS_Y());
m_characterNode->setForward(m_steeringObject->forward());
m_characterNode->getJUMP_SPEED()->setValue(15);
m_characterNode->getJUMP()->link(m_scene->m_spcKeyNode->getPRESS());
{
gkFunctionNode<MomoLogic, gkCharacterNode::STATE, FUNCTION_NODE_PARAM_ONE>* updateAINode = m_tree->createNode<gkFunctionNode<MomoLogic, gkCharacterNode::STATE, FUNCTION_NODE_PARAM_ONE> >();
updateAINode->getOBJECT()->setValue(this);
updateAINode->getFUNCTION_1()->setValue(&MomoLogic::updateAI);
m_characterNode->getINPUT_AI_STATE()->link(updateAINode->getRESULT());
}
{
gkFunctionNode<MomoLogic, gkScalar>* gravityNode = m_tree->createNode<gkFunctionNode<MomoLogic, gkScalar> >();
gravityNode->getOBJECT()->setValue(this);
gravityNode->getFUNCTION_0()->setValue(&MomoLogic::getGravity);
m_characterNode->getGRAVITY()->link(gravityNode->getRESULT());
}
CreateStateMachine();
gkCharacterNode::MAP map;
typedef gkCharacterNode::StateData StateData;
map[CARRY] = StateData(CARRY, animation::CARRY, true, false, velocity::NONE, true);
map[CATCH] = StateData(CATCH, animation::CATCH, true, false, velocity::NONE, true);
map[CATCH_ENDED] = StateData(CATCH, animation::CATCH, true, false, velocity::NONE, true);
map[THROW_WITH] = StateData(THROW_WITH, animation::THROW_WITH, true, false, velocity::NONE, true);
map[WALK] = StateData(WALK, animation::WALK, true, false, velocity::WALK, true);
map[RUN] = StateData(RUN, animation::RUN, true, false, velocity::RUN, true);
map[RUN_FASTER] = StateData(RUN_FASTER, animation::RUN_FASTER, true, false, velocity::RUN_FASTER, true);
map[WALK_BACK] = StateData(WALK_BACK, animation::WALK_BACK, true, false, velocity::WALK_BACK, true);
map[IDLE_NASTY] = StateData(IDLE_NASTY, animation::IDLE_NASTY, true, false, velocity::NONE, false);
map[IDLE_CAPOEIRA] = StateData(IDLE_CAPOEIRA, animation::IDLE_CAPOEIRA, true, false, velocity::NONE, false);
map[FALL] = StateData(FALL, animation::FALL, false, true, velocity::NONE, true);
map[FALL_UP] = StateData(FALL_UP, animation::FALL_UP, true, true, velocity::NONE, true);
map[KICK] = StateData(KICK, animation::KICK, true, false, velocity::NONE, false);
map[JUMP] = StateData(JUMP, animation::JUMP, false, true, velocity::NONE, true);
map[GLIDE] = StateData(GLIDE, animation::GLIDE, true, true, velocity::NONE, true);
map[FLY] = StateData(FLY, animation::GLIDE, true, false, velocity::FLY, true);
map[LAND] = StateData(LAND, animation::LAND, false, false, velocity::NONE, false);
m_characterNode->setMapping(map);
m_characterNode->addStartTrigger(LAND, new gkFSM::LogicTrigger<MomoLogic>(this, &MomoLogic::StartLand));
m_characterNode->addEndTrigger(LAND, new gkFSM::LogicTrigger<MomoLogic>(this, &MomoLogic::EndLand));
m_characterNode->getENABLE_ROTATION()->setValue(true);
m_characterNode->getROTATION_VALUE()->link(m_cameraNode->getCURRENT_ROLL());
CreateKick();
CreateGrab();
CreateDustTrail();
CreateImpactGroundFX();
CreateCamera();
}
MomoLogic::~MomoLogic()
{
delete m_steeringObject;
}
void MomoLogic::CreateKick()
{
m_kickTestNode->getENABLE()->link(m_characterNode->isCurrentStatus(KICK)->getIS_TRUE());
m_kickTestNode->getTARGET()->setValue(m_obj);
m_kickTestNode->getRAY_ORIGIN_OFFSET()->setValue(gkVector3(0, 0, -0.1f));
m_kickTestNode->getRAY_DIRECTION()->setValue(gkVector3(0, 0.5f, 0));
}
void MomoLogic::CreateGrab()
{
m_momoGrab->getUPDATE()->setValue(true);
m_momoGrab->getTARGET()->setValue(m_obj);
m_momoGrab->getGRAB_DIRECTION()->setValue(gkVector3(0, 0.6f, 0));
m_momoGrab->getTHROW_VEL()->setValue(gkVector3(0, 10, 0));
m_momoGrab->getRELATED_OFFSET_POSITION()->setValue(gkVector3(0, -0.6f, 0.5f));
m_momoGrab->getCREATE_PICK()->link(
IS_TRUE(BOOL_AND_NODE(m_scene->m_rightMouseNode->getPRESS(), m_scene->m_ctrlKeyNode->getNOT_IS_DOWN()))
);
m_momoGrab->getRELEASE_PICK()->link(
IS_TRUE(BOOL_AND_NODE(m_scene->m_rightMouseNode->getRELEASE(), m_scene->m_ctrlKeyNode->getNOT_IS_DOWN()))
);
m_momoGrab->getTHROW_OBJECT()->link(
IS_TRUE(
BOOL_AND_NODE(
m_characterNode->isCurrentStatus(THROW_WITH)->getIS_TRUE(),
IS_TRUE(REAL_GREATER_NODE(m_characterNode->getANIM_TIME_POSITION(), 20.13f))
)
)
);
}
void MomoLogic::CreateDustTrail()
{
gkParticleNode* particle = m_tree->createNode<gkParticleNode>();
particle->getPARTICLE_SYSTEM_NAME()->setValue(particle::DUST_RUN);
particle->getCREATE()->link(IS_TRUE(INT_EQUAL_NODE(m_characterNode->getCURRENT_STATE(), RUN_FASTER)));
particle->getPOSITION()->link(m_characterNode->getPOSITION());
particle->getORIENTATION()->link(m_characterNode->getROTATION());
}
void MomoLogic::CreateImpactGroundFX()
{
gkParticleNode* particle = m_tree->createNode<gkParticleNode>();
particle->getPARTICLE_SYSTEM_NAME()->setValue(particle::DUST_WALK);
particle->getPOSITION()->link(m_characterNode->getPOSITION());
gkFunctionNode<MomoLogic, bool>* hasImpactGroundNode = m_tree->createNode<gkFunctionNode<MomoLogic, bool> >();
hasImpactGroundNode->getOBJECT()->setValue(this);
hasImpactGroundNode->getFUNCTION_0()->setValue(&MomoLogic::hasImpactGround);
particle->getCREATE()->link(hasImpactGroundNode->getRESULT());
}
void MomoLogic::CreateStateMachine()
{
// Initial state
m_characterNode->getCURRENT_STATE()->setValue(IDLE_NASTY);
// Transitions
// IDLE_NASTY TRANSITIONS
m_characterNode->addTransition(CATCH, IDLE_NASTY);
m_characterNode->addTransition(CATCH_ENDED, IDLE_NASTY);
m_characterNode->addTransition(CARRY, IDLE_NASTY);
m_characterNode->addTransition(THROW_WITH, IDLE_NASTY);
m_characterNode->addTransition(WALK, IDLE_NASTY);
m_characterNode->addTransition(WALK_BACK, IDLE_NASTY);
m_characterNode->addTransition(KICK, IDLE_NASTY);
m_characterNode->addTransition(FALL_UP, IDLE_NASTY);
m_characterNode->addTransition(IDLE_CAPOEIRA, IDLE_NASTY, 11000);
m_characterNode->addTransition(JUMP, IDLE_NASTY);
gkFSM::LogicTrigger<MomoLogic>* land2idleTrigger = new gkFSM::LogicTrigger<MomoLogic>(this, &MomoLogic::handleLand2IdleTranstion);
m_characterNode->addTransition(LAND, IDLE_NASTY, 0, land2idleTrigger);
// IDLE_CAPOEIRA TRANSITIONS
m_characterNode->addTransition(IDLE_NASTY, IDLE_CAPOEIRA, 70000);
//WALK TRANSITIONS
INT_EQUAL_NODE_TYPE* wantToWalk = INT_EQUAL_NODE(m_characterNode->getOUTPUT_AI_STATE(), WALK);
BOOL_OR_NODE_TYPE* walkConditionNode = BOOL_OR_NODE(m_scene->m_wKeyNode->getIS_DOWN(), IS_TRUE(wantToWalk));
walkConditionNode->getIS_TRUE()->link(m_characterNode->addTransition(IDLE_NASTY, WALK));
walkConditionNode->getIS_TRUE()->link(m_characterNode->addTransition(IDLE_CAPOEIRA, WALK));
walkConditionNode->getIS_TRUE()->link(m_characterNode->addTransition(WALK, WALK));
walkConditionNode->getIS_TRUE()->link(m_characterNode->addTransition(KICK, WALK));
IS_TRUE(wantToWalk)->link(m_characterNode->addTransition(RUN, WALK));
m_characterNode->addTransition(RUN, WALK);
// WALK_BACK TRANSITIONS
m_scene->m_sKeyNode->getIS_DOWN()->link(m_characterNode->addTransition(WALK, WALK_BACK));
m_scene->m_sKeyNode->getIS_DOWN()->link(m_characterNode->addTransition(IDLE_NASTY, WALK_BACK));
m_scene->m_sKeyNode->getIS_DOWN()->link(m_characterNode->addTransition(IDLE_CAPOEIRA, WALK_BACK));
m_scene->m_sKeyNode->getIS_DOWN()->link(m_characterNode->addTransition(WALK_BACK, WALK_BACK));
m_scene->m_sKeyNode->getIS_DOWN()->link(m_characterNode->addTransition(KICK, WALK_BACK));
BOOL_AND_NODE_TYPE* ifKick = BOOL_AND_NODE(
BOOL_AND_NODE(m_scene->m_leftMouseNode->getPRESS(), m_scene->m_ctrlKeyNode->getNOT_IS_DOWN())->getIS_TRUE(),
m_scene->m_shiftKeyNode->getNOT_IS_DOWN());
// KICK TRANSITIONS
IS_TRUE(ifKick)->link(m_characterNode->addTransition(WALK, KICK));
IS_TRUE(ifKick)->link(m_characterNode->addTransition(WALK_BACK, KICK));
IS_TRUE(ifKick)->link(m_characterNode->addTransition(IDLE_NASTY, KICK));
IS_TRUE(ifKick)->link(m_characterNode->addTransition(IDLE_CAPOEIRA, KICK));
m_characterNode->getANIM_NOT_HAS_REACHED_END()->link(m_characterNode->addTransition(KICK, KICK));
// FALL_UP TRANSITIONS
m_characterNode->getFALLING()->link(m_characterNode->addTransition(WALK, FALL_UP));
m_characterNode->getFALLING()->link(m_characterNode->addTransition(RUN, FALL_UP));
m_characterNode->getFALLING()->link(m_characterNode->addTransition(FALL_UP, FALL_UP));
m_characterNode->getFALLING()->link(m_characterNode->addTransition(RUN_FASTER, FALL_UP));
m_characterNode->getFALLING()->link(m_characterNode->addTransition(WALK_BACK, FALL_UP));
m_characterNode->getFALLING()->link(m_characterNode->addTransition(IDLE_NASTY, FALL_UP));
BOOL_AND_NODE_TYPE* ifFallingAfterJump = BOOL_AND_NODE(
m_characterNode->getFALLING(),
m_characterNode->getANIM_HAS_REACHED_END());
IS_TRUE(ifFallingAfterJump)->link(m_characterNode->addTransition(FALL, FALL_UP));
// RUN TRANSITIONS
INT_EQUAL_NODE_TYPE* wantToRun = INT_EQUAL_NODE(m_characterNode->getOUTPUT_AI_STATE(), RUN);
m_scene->m_wKeyNode->getIS_DOWN()->link(m_characterNode->addTransition(WALK, RUN, 1500));
IS_TRUE(wantToRun)->link(m_characterNode->addTransition(WALK, RUN));
IS_TRUE(wantToRun)->link(m_characterNode->addTransition(IDLE_NASTY, RUN));
IS_TRUE(wantToRun)->link(m_characterNode->addTransition(IDLE_CAPOEIRA, RUN));
m_scene->m_wKeyNode->getIS_DOWN()->link(m_characterNode->addTransition(RUN, RUN));
IS_TRUE(wantToRun)->link(m_characterNode->addTransition(RUN, RUN));
m_characterNode->addTransition(RUN_FASTER, RUN);
// RUN_FASTER TRANSITIONS
{
BOOL_AND_NODE_TYPE* ifNode = BOOL_AND_NODE(m_scene->m_shiftKeyNode->getIS_DOWN(), m_scene->m_wKeyNode->getIS_DOWN());
BOOL_OR_NODE_TYPE* wantToRunFaster = BOOL_OR_NODE(
IS_TRUE(INT_EQUAL_NODE(m_characterNode->getOUTPUT_AI_STATE(), RUN_FASTER)),
IS_TRUE(ifNode));
IS_TRUE(wantToRunFaster)->link(m_characterNode->addTransition(RUN, RUN_FASTER));
IS_TRUE(wantToRunFaster)->link(m_characterNode->addTransition(RUN_FASTER, RUN_FASTER));
IS_TRUE(wantToRunFaster)->link(m_characterNode->addTransition(WALK, RUN_FASTER));
IS_TRUE(wantToRunFaster)->link(m_characterNode->addTransition(IDLE_NASTY, RUN_FASTER));
IS_TRUE(wantToRunFaster)->link(m_characterNode->addTransition(IDLE_CAPOEIRA, RUN_FASTER));
}
// CATCH TRANSITIONS
{
BOOL_AND_NODE_TYPE* ifNode = BOOL_AND_NODE(m_scene->m_ctrlKeyNode->getNOT_IS_DOWN(), m_scene->m_rightMouseNode->getPRESS());
ifNode->getIS_TRUE()->link(m_characterNode->addTransition(IDLE_NASTY, CATCH));
ifNode->getIS_TRUE()->link(m_characterNode->addTransition(IDLE_CAPOEIRA, CATCH));
m_characterNode->getANIM_NOT_HAS_REACHED_END()->link(m_characterNode->addTransition(CATCH, CATCH));
}
// CATCH_ENDED TRANSITIONS
m_characterNode->getANIM_HAS_REACHED_END()->link(m_characterNode->addTransition(CATCH, CATCH_ENDED));
// CARRY TRANSITIONS
m_momoGrab->getCAUGHT_TRUE()->link(m_characterNode->addTransition(CATCH_ENDED, CARRY));
m_momoGrab->getCAUGHT_TRUE()->link(m_characterNode->addTransition(CARRY, CARRY));
// THROW_WITH TRANSITIONS
IS_TRUE(BOOL_AND_NODE(m_scene->m_leftMouseNode->getPRESS(), m_scene->m_ctrlKeyNode->getNOT_IS_DOWN()))->link(
m_characterNode->addTransition(CARRY, THROW_WITH));
m_characterNode->getANIM_NOT_HAS_REACHED_END()->link(m_characterNode->addTransition(THROW_WITH, THROW_WITH));
// JUMP TRANSITIONS
m_scene->m_spcKeyNode->getPRESS()->link(m_characterNode->addTransition(IDLE_NASTY, JUMP));
m_scene->m_spcKeyNode->getPRESS()->link(m_characterNode->addTransition(IDLE_CAPOEIRA, JUMP));
m_scene->m_spcKeyNode->getPRESS()->link(m_characterNode->addTransition(WALK, JUMP));
m_scene->m_spcKeyNode->getPRESS()->link(m_characterNode->addTransition(WALK_BACK, JUMP));
m_scene->m_spcKeyNode->getPRESS()->link(m_characterNode->addTransition(KICK, JUMP));
m_scene->m_spcKeyNode->getPRESS()->link(m_characterNode->addTransition(RUN, JUMP));
m_scene->m_spcKeyNode->getPRESS()->link(m_characterNode->addTransition(RUN_FASTER, JUMP));
BOOL_AND_NODE_TYPE* ifJumpContinueNode = BOOL_AND_NODE(
m_characterNode->getANIM_NOT_HAS_REACHED_END(),
m_characterNode->getFALLING());
IS_TRUE(ifJumpContinueNode)->link(m_characterNode->addTransition(JUMP, JUMP));
// FALL TRANSITION
IS_TRUE(ifFallingAfterJump)->link(m_characterNode->addTransition(JUMP, FALL));
BOOL_AND_NODE_TYPE* ifFallContinueNode = BOOL_AND_NODE(
m_characterNode->getANIM_NOT_HAS_REACHED_END(),
m_characterNode->getFALLING());
IS_TRUE(ifFallContinueNode)->link(m_characterNode->addTransition(FALL, FALL));
// GLIDE TRANSITION
m_scene->m_spcKeyNode->getIS_DOWN()->link(m_characterNode->addTransition(JUMP, GLIDE, 1000));
BOOL_AND_NODE_TYPE* ifGlideContinueNode = BOOL_AND_NODE(
BOOL_AND_NODE(
m_scene->m_wKeyNode->getNOT_IS_DOWN(),
m_scene->m_spcKeyNode->getIS_DOWN())->getIS_TRUE(),
m_characterNode->getFALLING());
IS_TRUE(ifGlideContinueNode)->link(m_characterNode->addTransition(GLIDE, GLIDE));
IS_TRUE(ifGlideContinueNode)->link(m_characterNode->addTransition(FLY, GLIDE));
// FLY TRANSITION
m_scene->m_wKeyNode->getIS_DOWN()->link(m_characterNode->addTransition(GLIDE, FLY));
BOOL_AND_NODE_TYPE* ifFlyNode = BOOL_AND_NODE(
BOOL_AND_NODE(
m_scene->m_spcKeyNode->getIS_DOWN(),
m_characterNode->getFALLING())->getIS_TRUE(),
m_scene->m_wKeyNode->getIS_DOWN());
IS_TRUE(ifFlyNode)->link(m_characterNode->addTransition(FLY, FLY));
// LAND TRANSITION
IS_FALSE(ifGlideContinueNode)->link(m_characterNode->addTransition(GLIDE, LAND));
IS_TRUE(BOOL_AND_NODE(IS_FALSE(ifGlideContinueNode), IS_FALSE(ifFlyNode)))->link(m_characterNode->addTransition(FLY, LAND));
m_characterNode->getANIM_NOT_HAS_REACHED_END()->link(m_characterNode->addTransition(LAND, LAND));
}
void MomoLogic::CreateCamera()
{
gkScreenRayTestNode* centerObj0 = m_tree->createNode<gkScreenRayTestNode>();
centerObj0->getSCREEN_X()->link(m_scene->m_mouseNode->getABS_X());
centerObj0->getSCREEN_Y()->link(m_scene->m_mouseNode->getABS_Y());
centerObj0->getENABLE()->link(IS_TRUE(BOOL_AND_NODE(
m_scene->m_shiftKeyNode->getNOT_IS_DOWN(),
IS_TRUE(BOOL_AND_NODE(
m_scene->m_leftMouseNode->getPRESS(),
m_scene->m_ctrlKeyNode->getIS_DOWN())))));
gkObjectNode* centerObj1 = m_tree->createNode<gkObjectNode>();
centerObj1->getINPUT()->link(m_scene->m_ctrlKeyNode->getNOT_IS_DOWN());
centerObj1->setOtherObject(m_obj->getName());
gkMultiplexerNode<gkGameObject*>* selObj0 = m_tree->createNode<gkMultiplexerNode<gkGameObject*> >();
selObj0->getINPUT_FALSE()->setValue(0);
selObj0->getINPUT_TRUE()->setValue(m_obj);
selObj0->getSEL()->link(m_scene->m_ctrlKeyNode->getNOT_IS_DOWN());
gkMultiplexerNode<gkGameObject*>* selObj = m_tree->createNode<gkMultiplexerNode<gkGameObject*> >();
selObj->getINPUT_FALSE()->link(selObj0->getOUTPUT());
selObj->getINPUT_TRUE()->link(centerObj0->getHIT_OBJ());
selObj->getSEL()->link(
IS_TRUE(BOOL_AND_NODE(
m_scene->m_shiftKeyNode->getNOT_IS_DOWN(),
IS_TRUE(BOOL_AND_NODE(
m_scene->m_leftMouseNode->getIS_DOWN(),
m_scene->m_ctrlKeyNode->getIS_DOWN())))));
gkMultiplexerNode<gkVector3>* selPos = m_tree->createNode<gkMultiplexerNode<gkVector3> >();
selPos->getINPUT_FALSE()->link(centerObj0->getHIT_POSITION());
selPos->getINPUT_TRUE()->link(centerObj1->getOUT_POSITION());
selPos->getSEL()->link(m_scene->m_ctrlKeyNode->getNOT_IS_DOWN());
m_cameraNode->getCENTER_OBJ()->link(selObj->getOUTPUT());
m_cameraNode->getCENTER_POSITION()->link(selPos->getOUTPUT());
m_cameraNode->getAVOID_BLOCKING()->link(m_scene->m_ctrlKeyNode->getNOT_IS_DOWN());
m_cameraNode->getTARGET()->setValue(m_scene->m_camera);
m_cameraNode->getREL_X()->link(m_scene->m_mouseNode->getREL_X());
m_cameraNode->getREL_Y()->link(m_scene->m_mouseNode->getREL_Y());
m_cameraNode->getREL_Z()->link(m_scene->m_mouseNode->getWHEEL());
m_cameraNode->getMIN_Z()->setValue(0.5f);
m_cameraNode->getMAX_Z()->setValue(50);
}
gkCharacterNode::STATE MomoLogic::updateAI(gkScalar tick)
{
gkCharacterNode::STATE newState = gkCharacterNode::NULL_STATE;
bool userSelectPos = m_ifSelectNode->getIS_TRUE()->getValue() && m_screenTargetNode->getHIT()->getValue();
bool userMove = m_scene->m_sKeyNode->getIS_DOWN()->getValue() || m_scene->m_wKeyNode->getIS_DOWN()->getValue();
if (userSelectPos)
{
m_steeringObject->reset();
m_steeringObject->setGoalPosition(m_screenTargetNode->getHIT_POSITION()->getValue());
m_following = true;
m_scene->refreshNavigationMesh();
}
else if (userMove)
{
m_following = false;
}
if (m_following && m_steeringObject->getNavMesh().get())
{
if (m_steeringObject->update(tick))
{
gkScalar speed = m_steeringObject->speed();
if (speed == 0)
newState = IDLE_CAPOEIRA;
else if (speed < velocity::RUN)
newState = WALK;
else if (speed < velocity::RUN_FASTER)
newState = RUN;
else
newState = RUN_FASTER;
}
else
{
m_following = false;
}
}
return newState;
}
gkScalar MomoLogic::getGravity()
{
if (m_characterNode->getState() == GLIDE || m_characterNode->getState() == FLY)
return 2.5f;
else
return 9.81f;
}
bool MomoLogic::hasImpactGround()
{
if (!m_hasImpactGround)
{
if (m_characterNode->getState(1) == FALL_UP && !m_characterNode->isFalling())
{
m_hasImpactGround = true;
return true;
}
}
else if (m_characterNode->getState(1) != FALL_UP)
{
m_hasImpactGround = false;
}
return false;
}
void MomoLogic::handleLand2IdleTranstion(int fromState, int toState)
{
GK_ASSERT(fromState == LAND && toState == IDLE_NASTY);
}
void MomoLogic::StartLand(int from, int to)
{
// gkLogMessage("Momo Start Land");
}
void MomoLogic::EndLand(int from, int to)
{
// gkLogMessage("Momo End Land");
}
| {
"content_hash": "dda3b3228850ac659d8c3407cff0d2ff",
"timestamp": "",
"source": "github",
"line_count": 589,
"max_line_length": 191,
"avg_line_length": 38.67062818336163,
"alnum_prop": 0.6907845633753348,
"repo_name": "Josiastech/vuforia-gamekit-integration",
"id": "2217abc6973e8144d6161b80d91798bb1d3007b5",
"size": "24037",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Gamekit/Samples/LogicDemo/MomoLogic.cpp",
"mode": "33261",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<config>
<server className="net.sf.j2ep.servers.BaseServer"
domainName="www.nytimes.com"
isRewriting="true">
<rule className="net.sf.j2ep.rules.DirectoryRule"
directory="/news"
/>
</server>
<server className="net.sf.j2ep.servers.BaseServer"
domainName="jakarta.apache.org"
isRewriting="true">
<rule className="net.sf.j2ep.rules.AcceptEverythingRule"/>
</server>
</config> | {
"content_hash": "1f98464b2d84eaf7f80a78d64b5a60f5",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 60,
"avg_line_length": 23.35,
"alnum_prop": 0.6616702355460385,
"repo_name": "jacarrichan/j2ep",
"id": "9d5c1217cc90e465627ff8869bcfa8e960a8f58b",
"size": "467",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/webapp/WEB-INF/config/data.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "3312"
},
{
"name": "Java",
"bytes": "211948"
}
],
"symlink_target": ""
} |
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1alpha1 "k8s.io/kube-deploy/ext-apiserver/pkg/apis/cluster/v1alpha1"
)
// FakeMachines implements MachineInterface
type FakeMachines struct {
Fake *FakeClusterV1alpha1
ns string
}
var machinesResource = schema.GroupVersionResource{Group: "cluster.k8s.io", Version: "v1alpha1", Resource: "machines"}
var machinesKind = schema.GroupVersionKind{Group: "cluster.k8s.io", Version: "v1alpha1", Kind: "Machine"}
// Get takes name of the machine, and returns the corresponding machine object, and an error if there is any.
func (c *FakeMachines) Get(name string, options v1.GetOptions) (result *v1alpha1.Machine, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(machinesResource, c.ns, name), &v1alpha1.Machine{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Machine), err
}
// List takes label and field selectors, and returns the list of Machines that match those selectors.
func (c *FakeMachines) List(opts v1.ListOptions) (result *v1alpha1.MachineList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(machinesResource, machinesKind, c.ns, opts), &v1alpha1.MachineList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.MachineList{}
for _, item := range obj.(*v1alpha1.MachineList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested machines.
func (c *FakeMachines) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(machinesResource, c.ns, opts))
}
// Create takes the representation of a machine and creates it. Returns the server's representation of the machine, and an error, if there is any.
func (c *FakeMachines) Create(machine *v1alpha1.Machine) (result *v1alpha1.Machine, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(machinesResource, c.ns, machine), &v1alpha1.Machine{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Machine), err
}
// Update takes the representation of a machine and updates it. Returns the server's representation of the machine, and an error, if there is any.
func (c *FakeMachines) Update(machine *v1alpha1.Machine) (result *v1alpha1.Machine, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(machinesResource, c.ns, machine), &v1alpha1.Machine{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Machine), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeMachines) UpdateStatus(machine *v1alpha1.Machine) (*v1alpha1.Machine, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(machinesResource, "status", c.ns, machine), &v1alpha1.Machine{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Machine), err
}
// Delete takes name of the machine and deletes it. Returns an error if one occurs.
func (c *FakeMachines) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(machinesResource, c.ns, name), &v1alpha1.Machine{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeMachines) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(machinesResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v1alpha1.MachineList{})
return err
}
// Patch applies the patch and returns the patched machine.
func (c *FakeMachines) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Machine, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(machinesResource, c.ns, name, data, subresources...), &v1alpha1.Machine{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Machine), err
}
| {
"content_hash": "129e39a2b892cfafe5738a147182eac6",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 147,
"avg_line_length": 35.21951219512195,
"alnum_prop": 0.7377654662973222,
"repo_name": "kris-nova/kubicorn",
"id": "57164562a2f07e2b03028bac23444a7f52f8cc5b",
"size": "4901",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vendor/k8s.io/kube-deploy/ext-apiserver/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/fake/fake_machine.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "460828"
},
{
"name": "Makefile",
"bytes": "5373"
},
{
"name": "Shell",
"bytes": "59112"
}
],
"symlink_target": ""
} |
<!--
~ Copyright (c) 2005-2011, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.wso2.carbon.registry</groupId>
<artifactId>registry.core-feature</artifactId>
<version>4.6.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.registry.core.ui.feature</artifactId>
<packaging>pom</packaging>
<name>WSO2 Carbon - Registry Core UI Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the bundles required for Front-end Registry Core functionality</description>
<dependencies>
<dependency>
<groupId>org.wso2.carbon.registry</groupId>
<artifactId>org.wso2.carbon.registry.common.ui</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.registry</groupId>
<artifactId>org.wso2.carbon.registry.resource.ui</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.registry</groupId>
<artifactId>org.wso2.carbon.registry.resource.stub</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<version>${carbon.p2.plugin.version}</version>
<executions>
<execution>
<id>4-p2-feature-generation</id>
<phase>package</phase>
<goals>
<goal>p2-feature-gen</goal>
</goals>
<configuration>
<id>org.wso2.carbon.registry.core.ui</id>
<propertiesFile>../../etc/feature.properties</propertiesFile>
<adviceFile>
<properties>
<propertyDef>org.wso2.carbon.p2.category.type:console</propertyDef>
<propertyDef>org.eclipse.equinox.p2.type.group:false</propertyDef>
</properties>
</adviceFile>
<bundles>
<bundleDef>org.wso2.carbon.registry:org.wso2.carbon.registry.common.ui</bundleDef>
<bundleDef>org.wso2.carbon.registry:org.wso2.carbon.registry.resource.ui</bundleDef>
<bundleDef>org.wso2.carbon.registry:org.wso2.carbon.registry.resource.stub</bundleDef>
</bundles>
<importFeatures>
<importFeatureDef>org.wso2.carbon.core.ui:${carbon.kernel.version}</importFeatureDef>
<importFeatureDef>org.wso2.carbon.registry.core.common:${carbon.registry.version}
</importFeatureDef>
</importFeatures>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
| {
"content_hash": "a80fecb80a8e279391da36d7ad3c5541",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 201,
"avg_line_length": 47.90588235294118,
"alnum_prop": 0.5611493123772102,
"repo_name": "laki88/carbon-registry",
"id": "bad138c236ed4fbdc188eb5ddf2c18e519214e57",
"size": "4072",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "features/registry-core/org.wso2.carbon.registry.core.ui.feature/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "62597"
},
{
"name": "CSS",
"bytes": "62539"
},
{
"name": "HTML",
"bytes": "47754"
},
{
"name": "Java",
"bytes": "5794542"
},
{
"name": "JavaScript",
"bytes": "334293"
},
{
"name": "PLSQL",
"bytes": "186568"
},
{
"name": "Shell",
"bytes": "70140"
},
{
"name": "XSLT",
"bytes": "78182"
}
],
"symlink_target": ""
} |
/*
* Name: Email.java
* Project: SensorAct-VPDS
* Version: 1.0
* Date: 2012-07-20
* Author: Pandarasamy Arjunan
*/
package edu.pc3.sensoract.vpds.tasklet;
import static org.quartz.JobBuilder.newJob;
import static org.quartz.JobKey.jobKey;
import static org.quartz.TriggerBuilder.newTrigger;
import static org.quartz.impl.matchers.KeyMatcher.keyEquals;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobKey;
import org.quartz.SchedulerException;
import org.quartz.Trigger;
/**
* @author samy
*
*/
// TODO: Email job
public class Email {
public String toEmail = null;
public String subject = null;
public String message = null;
public String attachment_path = null;
private static final String CLASSNAME = "Email";
public Email(String toEmail, String subject, String message, String attachment_path) {
this.toEmail = toEmail;
this.subject = subject;
this.message = message;
this.attachment_path = attachment_path;
}
public void sendNow(JobExecutionContext jobContext) {
String context = jobContext.getJobDetail().getKey().toString();
//System.out.println(context);
// straight forward way
// System.out.println("sending mail to " + toEmail);
SendEmailJob.sendMail(context, toEmail, subject, message, attachment_path);
// sendEmailViaJob(jobContext);
}
public void sendEmailViaJob(JobExecutionContext jobContext) {
JobKey jobKey = jobContext.getJobDetail().getKey();
String jobName = jobKey.getName();
String groupName = CLASSNAME + "_" + jobKey.getGroup();
JobDetail emailJob = newJob(SendEmailJob.class)
.withIdentity(jobName, groupName)
.usingJobData(SendEmailJob.TOEMAIL, toEmail)
.usingJobData(SendEmailJob.SUBJECT, subject)
.usingJobData(SendEmailJob.MESSAGE, message).build();
Trigger nowTrigger = newTrigger().withIdentity(jobName, groupName)
.startNow().build();
try {
TaskletScheduler.scheduler.getListenerManager().addJobListener(
TaskletScheduler.jobEventListener,
keyEquals(jobKey(jobName, groupName)));
TaskletScheduler.scheduler.scheduleJob(emailJob, nowTrigger);
} catch (SchedulerException e) {
e.printStackTrace();
}
}
}
| {
"content_hash": "7bc81b401c8967c4344d48f42b63a987",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 87,
"avg_line_length": 27.759493670886076,
"alnum_prop": 0.7441860465116279,
"repo_name": "iiitd-ucla-pc3/SensorActVPDS-2.0",
"id": "6ba14cf636728079737a41b8dfe4648450349dd3",
"size": "3974",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/edu/pc3/sensoract/vpds/tasklet/Email.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "0"
},
{
"name": "Java",
"bytes": "726879"
},
{
"name": "Python",
"bytes": "5560"
}
],
"symlink_target": ""
} |
import React, { Component, PropTypes } from 'react';
export default class About extends Component{
render(){
return (
<div>Welcome Buddy</div>
)
}
} | {
"content_hash": "09c9b7400cffe4c89c8566eb1737de31",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 52,
"avg_line_length": 17.555555555555557,
"alnum_prop": 0.6772151898734177,
"repo_name": "nverdhan/satticentre",
"id": "1cff36a609fa7499ebe7a41250316f2db53bfaf6",
"size": "158",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "scripts/pages/About.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "26"
},
{
"name": "CSS",
"bytes": "152098"
},
{
"name": "HTML",
"bytes": "1687"
},
{
"name": "JavaScript",
"bytes": "130695"
}
],
"symlink_target": ""
} |
@implementation FindViewCatalogueModel
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
if ([key isEqualToString:@"id"]) {
self.Id = value;
}
}
+ (void)getFindViewCatalogueModel:(FindViewCatalogueModelBlock)block{
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
[manager GET:@"http://mmmono.com/api/v3/domain_category/" parameters:nil progress:^(NSProgress * _Nonnull downloadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSMutableArray *array = [NSMutableArray array];
NSArray *arrayResponseObject = [responseObject objectForKey:@"category_list"];
for (NSDictionary *dicT in arrayResponseObject) {
FindViewCatalogueModel *model = [[FindViewCatalogueModel alloc] initWithDic:dicT];
[array addObject:model];
}
block(array);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
}];
}
@end
| {
"content_hash": "27615946d372452fbb07cdbc91f8f0a5",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 129,
"avg_line_length": 33.84375,
"alnum_prop": 0.6352723915050785,
"repo_name": "chilejiang1024/MONOV3",
"id": "3de1d600e760ad4e39c3fe09d20ab6015de2adb0",
"size": "1285",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MONOV3/Find/Model/FindViewCatalogueModel.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "981139"
}
],
"symlink_target": ""
} |
use std::fmt::Debug;
use std::hash::Hash;
use std::mem::size_of;
pub trait LFSRTrait: PartialEq + Eq + Clone + Hash + Debug {
fn clock(&mut self) -> usize;
fn multiclock(&mut self, clocks: usize) -> Vec<usize>;
fn get(&self) -> Vec<usize>;
fn set(&mut self, value: Vec<usize>);
fn taps(&self) -> Vec<usize>;
fn width(&self) -> usize;
}
fn width_in_usize_words(width: usize) -> usize {
let usize_bytes = size_of::<usize>();
let usize_bits = usize_bytes * 8;
(width + usize_bits - 1) / usize_bits
}
fn calculate_tapmasks(width: usize, taps: Vec<usize>) -> Result<Vec<usize>, String> {
let usize_bytes = size_of::<usize>();
let usize_bits = usize_bytes * 8;
let words = width_in_usize_words(width);
let mut tapmasks = Vec::with_capacity(words);
for _ in 0..words {
tapmasks.push(0);
}
for tap in taps {
if tap > width {
return Err(format!("Tap {} was outside of register width {}.", tap, width));
}
tapmasks[(tap - 1) / usize_bits] |= (1 as usize) << (tap - 1);
}
Ok(tapmasks)
}
pub mod naive;
pub mod count_ones;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub mod pop_cnt;
pub mod galois;
pub use naive::*;
pub use count_ones::*;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub use pop_cnt::*;
pub use galois::*;
| {
"content_hash": "edb805f83364a2c4f5a880c5fc17d73e",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 88,
"avg_line_length": 27.775510204081634,
"alnum_prop": 0.5900073475385745,
"repo_name": "46bit/rustyregisters",
"id": "a5648fe665ef909a46f5c657e4fe5e13034ad784",
"size": "1361",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/lfsr/mod.rs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Rust",
"bytes": "16489"
}
],
"symlink_target": ""
} |
/*
TODO: maybe make a util class and use this
https://designsystem.digital.gov/utilities/font-size-and-family/#utility-font-family
TODO: rems ?
*/
@font-face {
font-family: "Open Sans";
src: url("/assets/fonts/open-sans/opensans-regular.ttf");
}
/*
resets
*/
body.usa {
background-color: #f9f7f3;
}
/* Breadcrumbs */
nav#usa-breadcrumbs li + li::before {
display: inline-block;
margin: 0 0.6rem;
height: 0.8em;
content: "//";
color: #777678; /* was #939393 */
}
nav#usa-breadcrumbs li:last-child a { /* on 9/15/20 it was determined that 939393 was not 4.5:1 contrast - 3 months after launch. Need a more contrasty gray. */
color: #777678;
}
/* Alerts */
* + .usa-alert {
margin-top: 0;
}
.usa-alert--error {
background-color: #db001a;
background-image: none;
}
.usa-alert--error::before {
background-color: transparent;
}
.usa-alert .usa-alert__body {
padding-left: 0;
}
.usa-alert a.text-white:hover,
.usa-alert a.text-white:visited:hover {
color: #ffebeb;
}
.usa-alert button {
background-color: transparent;
border: none;
cursor: pointer;
}
b,
strong {
font-weight: bold;
}
.usa hr {
height: 5px;
outline: none;
border-top: solid 1px #dcdcdc;
border-bottom: solid 1px #dcdcdc;
border-left: 0;
border-right: 0;
/* margin-left: 2rem;
margin-right: 2rem; */
}
.usa hr.alt {
height: 1px;
border-top: solid 1px #979797;
border-bottom: 0;
opacity: 0.5;
}
/* default for all paragraphs */
main p {
/* 16px */
font-size: 1rem;
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
color: #444343;
line-height: 1.6rem;
}
/*
Grid
Our design exceeds the USWDS max width for desktop (768px)
*/
.usa-banner__inner,
.usa-banner__content,
.usa-header--basic .usa-nav-container,
.usa-header--basic .usa-navbar,
.usa-header--extended .usa-navbar,
.usa-footer__primary-container,
.grid-container {
max-width: 1388px;
}
.usa-header--basic .usa-nav-container {
padding-left: 4px;
}
.grid-container.margin-x-7 {
margin-left: 0;
margin-right: 0;
}
@media (min-width: 1023px) and (max-width: 1180px) {
.tablet-portrait\:display-none {
display: none;
}
}
#mapsvg svg {
background: url("/assets/images/map-texture-masked.png");
background-repeat: no-repeat;
background-size: cover;
background-position: top 1px right 0;
}
#map_tooltip {
pointer-events: none;
margin-left: -258px;
margin-top: -125px;
width: 250px;
}
/* Tooltip tail bottom right */
#map_tooltip:before,
.keyboard-map-infoboxes .map-infobox:before {
content: "";
position: absolute;
bottom: 0;
right: 10px;
width: 0;
height: 0;
border: 25px solid transparent;
border-top-color: #ffffff;
border-bottom: 0;
border-right: 0;
margin-left: -17.5px;
margin-bottom: -25px;
}
/* Tooltip tail top left */
/* #map_tooltip:before,
.keyboard-map-infoboxes .map-infobox:before {
content: "";
position: absolute;
top: 0;
left: 35px;
width: 0;
height: 0;
border: 25px solid transparent;
border-bottom-color: #ffffff;
border-top: 0;
border-left: 0;
margin-left: -17.5px;
margin-top: -25px;
} */
.keyboard-map-infoboxes .map-infobox {
display: none;
position: absolute;
background-color: white;
position: absolute;
border-radius: 4px;
margin-left: -60px;
margin-top: -10px;
padding: 4px 7px;
}
.keyboard-map-infoboxes .map-infobox.expanded {
display: block;
}
/*
Accessibility Overrides
*/
button:not([disabled]):focus,
input:not([disabled]):focus,
select:not([disabled]):focus,
textarea:not([disabled]):focus,
[contentEditable="true"]:focus,
[href]:focus,
[tabindex]:focus,
iframe:focus,
.usa-form a:focus,
.usa-accordion__button:focus,
.usa-alert__text a:focus {
outline: 0.125rem dotted #bcac88;
/*.25rem solid #2491ff is default*/
}
/*
Typography
*/
.usa h1,
/*.usa h2,*/
.usa h3,
.usa h4,
.usa h5,
.usa h6,
.usa-prose > h1,
/*.usa-prose > h2,*/
.usa-prose > h3,
.usa-prose > h4,
.usa-prose > h5,
.usa-prose > h6 {
font-weight: 100;
}
.usa h2,
.usa-prose > h2 {
font-weight: 500;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif; /* 11/5 - making all h2s Merriweather Web */
}
footer h1,
footer h2,
footer h3,
footer h4,
footer h5,
footer h6 {
line-height: 1.95rem;
font-weight: 100;
}
.usa h1,
.usa h2,
.usa h3,
.usa-prose > h1,
.usa-prose > h2,
.usa-prose > h3 {
/* font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times,
serif; */
}
.usa h4,
.usa h5,
.usa h6,
.usa-prose > h4,
.usa-prose > h5,
.usa-prose > h6 {
/* font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif; */
}
/*
TODO: re-evaluate default of all i element colors,
this is causing all font-awesome icons to be white
*/
i {
color: #fff;
}
.quote {
display: flex;
}
.quote span {
line-height: 0.2;
}
/* a:hover i {
color: inherit;
} */
.usa-header li ul li,
.usa-header li ol li {
padding: 0;
line-height: 1rem;
}
.font-header-arrow {
font-family: "Merriweather Web", Georgia, Cambria, Times New Roman, Times,
serif;
/* 18px */
font-size: 1.125rem;
font-weight: normal;
letter-spacing: 1.13px;
}
.font-heading-xl {
/* 18px */
font-size: 1.125rem;
font-weight: normal;
}
/* TODO: remove this when font-weight is removed from .font-heading-xl */
.font-heading-xl.text-light {
font-weight: 300;
}
.font-heading-xxl {
font-family: "Merriweather Web", Georgia, Cambria, Times New Roman, Times,
serif;
/* 32px */
font-size: 2rem;
font-weight: normal;
letter-spacing: normal;
}
.font-heading-2xl {
/* 36px */
font-size: 2.25rem;
}
.font-heading-3xl {
/* 48px */
font-size: 3rem;
letter-spacing: 1px;
}
.font-alt-xs {
/* 14px */
font-size: 0.875rem;
}
.font-alt-md {
/* 16px */
font-size: 1rem;
}
.font-size-12px {
font-size: 0.75rem;
}
.font-size-13px {
font-size: 0.8125rem;
}
.font-size-14px {
/* 14px */
font-size: 0.875rem;
}
.font-size-18px {
/* 18px */
font-size: 1.125rem;
}
.font-size-24px {
font-size: 1.5rem;
}
/* TODO: clean up media queries */
/* Mobile Portrait */
@media (min-width: 0) and (max-width: 480px) {
/* TODO: remove additional line after fixing font-heading-xl mobile size*/
.font-sans-md.mobile\:font-size-14px,
.mobile\:font-size-14px {
font-size: 0.875rem;
}
}
/* TODO: clean up media queries */
/* Mobile Portrait */
@media (min-width: 0) and (max-width: 480px) {
/* TODO: remove additional line after fixing font-heading-xl mobile size*/
.font-heading-xl.font-size-20px.mobile\:font-size-18px,
.font-heading-xl.mobile\:font-size-18px,
.mobile\:font-size-18px {
font-size: 1.125rem;
}
}
/* Tablet Portrait */
@media (min-width: 480px) {
.tablet\:font-size-18px {
font-size: 1.125rem;
}
.tablet\:font-size-24px {
font-size: 1.5rem;
}
}
/* Tablet Landscape */
@media (min-width: 640px) {
.tablet-lg\:font-size-18px {
font-size: 1.125rem;
}
.tablet-lg\:font-size-24px {
font-size: 1.5rem;
}
.tablet-lg\:font-size-25px {
font-size: 1.5625rem;
}
/* Show underline under active consumers/bankers/analysts tab only on 640px width and up */
.usa-tab .usa-accordion__button[aria-expanded="true"] {
text-decoration: underline;
}
}
/* TODO: remove additional .font-heading-xl when we fix font sizing */
.font-heading-xl.font-size-20px,
.font-size-20px {
/* 20px */
font-size: 1.25rem;
}
.font-alt-lg {
/* 24px */
font-size: 1.5rem;
}
.font-size-25px {
/* 25px */
font-size: 1.5625rem;
}
/* TODO: clean up media queries */
/* Mobile Portrait */
@media (min-width: 0) and (max-width: 480px) {
.mobile\:font-size-25px {
font-size: 1.5625rem;
}
}
.font-alt-xl {
/* 32px */
font-size: 2rem;
}
.font-alt-4xl {
font-size: 4rem;
}
.font-alt-5xl,
.tablet\:font-alt-5xl {
font-size: 5.5rem;
}
/* replace sans with open sans */
html,
.font-family-sans {
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
}
.font-sans-3xs {
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
}
.font-sans-2xs {
/* 14px */
font-size: 0.875rem;
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
}
.font-sans-xs {
/* 16px */
font-size: 1rem;
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
}
.font-sans-sm {
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
}
.font-sans-md {
/* 18px */
/* font-size: 1.125rem; */
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
}
.font-sans-20px {
/* 20px */
font-size: 1.25rem;
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
}
.font-sans-lg {
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
}
.font-sans-xl {
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
}
.font-sans-2xl {
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
}
.font-sans-3xl {
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
}
.bullet-links li {
margin-bottom: 0.8rem;
}
.bullet-links li:last-child {
margin-bottom: 0;
}
@media all and (min-width: 1024px) {
.desktop\:bullet-links li {
margin-bottom: 0.3rem;
}
.desktop\:height-380px {
height: 380px;
}
.desktop\:width-380px {
width: 380px;
}
.desktop\:width-480px {
width: 30rem;
}
}
.list-style-none {
list-style: none;
}
a,
.usa-link {
text-decoration: none;
}
a:hover,
a:active,
a:visited,
.usa-link:hover,
.usa-link:active,
.usa-link:visited {
/* color: initial; */
text-decoration: underline;
}
a.usa-icon--arrow::after {
content: "\00a0\0203a";
font-weight: bold;
font-size: 110%;
}
a.usa-icon--arrow:hover::after {
text-decoration: underline;
}
a[href^="tel"] {
text-decoration: inherit;
color: inherit;
}
@media (min-width: 1024px) {
.tablet-lg\:float-right {
float: right;
}
}
/*
Hero Carousel
1388px full width
14px left & right padding
7px spacing
1038px main
315 small secondary
*/
.usa-hero--mobile-carousel {
padding: 0;
}
/*
Form
*/
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint */
/*****************************************************************/
/* @media only screen and (min-width: 30em) { */
.usa-form {
max-width: 100%;
}
/* } */
.usa-label {
line-height: normal;
}
/* Inputs */
.usa-input,
.usa-select {
height: 40px;
padding-left: 20px;
color: #444343;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times,
serif;
font-size: 16px;
border-radius: 3px;
border: none;
transition: 0.25s ease;
}
.usa-input.usa-input-search {
background-image: url("/assets/images/icon-search-blue.svg");
/* background-size: 1.4rem; */
background-size: 1.4rem 1.4rem;
background-position: calc(100% - 5px);
background-repeat: no-repeat;
padding-right: 1.5rem;
}
.usa-form .usa-input {
max-width: 350px;
transition: 0.25s ease;
}
.usa-form .usa-select {
max-width: 350px;
background: #fff url("/assets/images/select-arrow-down.svg") no-repeat right
50%;
transition: 0.25s ease;
padding-right: 4rem;
}
.usa-select:hover,
.usa-select:focus {
background-image: url("/assets/images/select-arrow-down-active.svg");
transition: 0.25s ease;
}
/*
Buttoms
*/
.usa-button,
.usa-form .usa-button,
.usa-button:visited,
.usa-form .usa-button:visited {
display: flex;
justify-content: center;
align-items: center;
width: 275px;
height: 44px;
/* NOTE: Fallback to USWDS Default */
color: #ffffff;
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
font-size: 16px;
font-weight: 600;
font-weight: normal;
letter-spacing: 1.5px;
text-transform: uppercase;
text-decoration: none;
background-color: #7f7044;
transition: 0.25s ease;
}
.usa-nav__secondary .usa-search .usa-button[type="submit"] {
margin-top: 0;
}
.usa-search .usa-search__submit,
.usa-search [type="submit"] {
background-color: #7f7044;
}
.usa-search .usa-search__submit:hover,
.usa-search [type="submit"]:hover {
background-color: #a48923;
}
/*light chevron acordian*/
/* .usa-tab-light {
border: solid 1px #dadada;
} */
.usa-tab-light .usa-accordion__button {
color: #003256;
text-decoration: none;
background-color: #ffffff;
background-image: url("/assets/images/arrow-right-blue.svg");
background-size: 0.8rem;
background-position: calc(100% - 15px) center;
border-bottom: 0;
letter-spacing: 0px;
}
.usa-tab-light .usa-accordion__button[aria-expanded="true"] {
color: #003256;
background-color: #ffffff;
background-image: url("/assets/images/arrow-down-blue.svg");
background-size: 1rem;
background-position: calc(100% - 15px) center;
border-bottom: 0;
pointer-events: auto;
}
.usa-tab-light .usa-accordion__link {
color: #003256;
text-decoration: none;
background-color: #ffffff;
background-size: 0.8rem;
background-position: calc(100% - 15px) center;
border-bottom: 0;
letter-spacing: 0px;
}
.usa-tab-light .usa-accordion__heading:not(:first-child) {
margin-top: 0;
}
.usa-tab-light .usa-accordion__content {
background-color: #faf9f6;
}
/* Dark Accordion */
.usa-accordion-dark .usa-accordion__button {
background-image: url("/assets/images/arrow-down-white.svg");
background-size: 1.25rem;
border-bottom: 0;
letter-spacing: 0px;
pointer-events: auto;
text-decoration: none;
}
.usa-accordion-dark .usa-accordion__button:hover {
background-color: #003256;
color: white;
}
.usa-accordion-dark .usa-accordion__button[aria-expanded="false"] {
background-image: url("/assets/images/arrow-right-white.svg");
}
.usa-accordion-dark .usa-accordion__button[aria-expanded="true"] {
pointer-events: auto;
}
/* .usa-accordion-dark .usa-accordion__button {
text-decoration: none;
background: url("/assets/images/arrow-right-white.svg") no-repeat;
background-position: calc(100% - 15px) center;
background-size: .75rem;
border-bottom: 0;
letter-spacing: 0px;
}
.usa-accordion-dark .usa-accordion__button:hover {
color: white;
}
.usa-accordion-dark .usa-accordion__button[aria-expanded="true"] {
background-image: url("/assets/images/arrow-down-white.svg");
background-size: 1.25rem;
background-position: calc(100% - 15px) center;
border-bottom: 0;
pointer-events: auto;
} */
.usa-accordion-dark .usa-accordion__link {
text-decoration: none;
background-size: 0.8rem;
background-position: calc(100% - 15px) center;
border-bottom: 0;
letter-spacing: 0px;
}
.usa-accordion-dark .usa-accordion__heading:not(:first-child) {
margin-top: 0;
}
.usa-button:hover,
.usa-form .usa-button:hover,
.usa-button:visited:hover,
.usa-form .usa-button:visited:hover {
color: #ffffff;
background-color: #a48923;
transition: 0.25s ease;
}
.usa-button.usa-button--primary,
.usa-button.usa-button--primary:visited {
text-decoration: none;
color: #ffffff;
background-color: #003256;
transition: 0.25s ease;
}
.usa-button.usa-button--primary:hover,
.usa-button.usa-button--primary:active {
/* text-decoration: underline; */
color: #ffffff;
background-color: #20509e;
transition: 0.25s ease;
}
.usa-button.width-auto {
display: inline-flex;
width: auto;
}
.usa-button.width-full {
display: inline-flex;
width: 100%;
}
.usa-button span {
display: none;
}
.usa-button.usa-button--hover {
background-color: #20509e;
}
/*
Icons
*/
.usa-icon {
display: flex;
overflow: hidden;
width: 30px;
height: 30px;
text-decoration: none;
justify-content: center;
align-items: center;
transition: 0.25s ease;
}
.usa-icon:hover {
text-decoration: none;
transition: 0.25s ease;
}
.usa-icon--gold-circle {
border-radius: 100%;
color: #ffffff;
background-color: #7f7044;
}
.usa-icon--gold-circle:hover {
color: #ffffff;
text-decoration: none;
background-color: #a48923;
}
.usa-icon--gold-box {
color: #7f7044;
background-color: transparent;
justify-content: center;
margin: 0;
padding: 0;
outline: solid 1px #c4bfad;
}
/* TODO: re-evaluate utility classes overrides*/
.usa-icon--gold-box.font-alt-xs {
/* 14px */
/* font-size: 0.875rem; */
pointer-events: none;
}
/* TODO: re-evaluate utility class overrides*/
.usa-icon--gold-box.width-auto {
width: auto;
/* 11px */
padding: 0 0.6875rem;
}
/*
TODO: remove after correcting all anchors from having blue background
*/
.card .card__content .usa-icon--gold-box {
background-color: transparent;
}
/*
TODO: remove after correcting default element i to always be color white
*/
.usa-icon--gold-box i {
color: #7f7044;
transition: 0.25s ease;
}
.usa-icon--gold-box i:hover {
color: #a48923;
text-decoration: none;
background-color: transparent;
transition: 0.25s ease;
}
/* Flickr icon */
.usa-icon .fa-circle {
font-size: 0.7rem;
margin-left: 1px;
margin-top: 1px;
}
/* YouTube icon */
.usa-icon .fa-play {
font-size: 1rem;
margin-left: 3px;
margin-top: 1px;
}
#icon {
display: flex;
flex-direction: column;
justify-content: center;
}
/* Official website banner */
.usa-banner {
height: auto;
background: #fff;
}
.usa-banner__content {
padding-top: 0;
margin-top: -0.7rem;
padding-bottom: 3.7rem;
}
.usa-banner p {
/* font-size: 1rem; */
font-family: "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial,
sans-serif;
}
.usa-banner__header-close-text,
.usa-banner__header-text {
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times,
serif;
font-style: italic;
font-size: 0.74rem;
}
.usa-banner__button {
margin-left: 0.25rem;
}
/* Header/Navigation */
.usa-header,
.usa-nav {
background-color: #003256;
background-image: none;
color: #fff;
}
/* Old site overrides */
.usa-alert p {
padding: 0;
}
div#breadcrumbs,
div#content,
div#page_foot {
max-width: 1366px;
}
div.left_side {
width: 74%;
}
div.right_side {
width: 21%;
}
#find_more_info input[type="button"],
#table_wrapper select {
background-color: #fff;
}
#table_filter input[type="text"],
div.right_side input[type="text"] {
border: solid 1px #dfdfdf;
}
.usa-banner p {
padding: 0;
}
.usa-header p {
/* padding: 0; */
}
.usa-header ul li,
.usa-footer ul li {
padding-bottom: 0;
}
.usa-footer h1,
.usa-footer h2,
.usa-footer h3,
.usa-footer h4,
.usa-footer h5,
.usa-footer h6 {
color: #fff;
padding-top: 0;
}
.usa-nav__submenu article h2 {
padding-top: 0;
margin-top: 0;
margin-bottom: 10px;
}
/*
Components
*/
/* Card */
.card {
background-color: #fff;
}
.card.bg-transparent {
background-color: transparent;
}
.card.width-281px,
.card.width-300px {
margin-left: auto;
margin-right: auto;
}
.card--chart {
}
.card--chart .chart-header {
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times;
/* 18px */
font-size: 1.125rem;
font-weight: normal;
line-height: normal;
letter-spacing: normal;
color: #002c4c;
margin-bottom: 10px;
}
.card--chart .card__content {
margin: 0 1.25rem 1.25rem 1.25rem;
}
.card--chart .card__content .share-text {
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times;
/* 14px */
font-size: 0.875rem;
font-weight: normal;
color: #002c4c;
font-size: 0.875rem;
font-style: italic;
}
.card--news {
}
.card--news .news-header {
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times;
/* 18px */
font-size: 1rem;
font-weight: normal;
line-height: 1.5;
letter-spacing: 0.36px;
color: #013256;
}
.card--news .card__content {
margin: 0 1.25rem 1.25rem 1.25rem;
}
@media (min-width: 0) and (max-width: 640px) {
.mobile\:card--inverse {
background-color: transparent;
}
.mobile\:card--inverse .card__image {
margin-left: 1.25rem;
margin-right: 1.25rem;
}
.mobile\:card--inverse .news-header,
.mobile\:card--inverse .card__content,
.mobile\:card--inverse .card__content p {
color: #ffffff;
}
/* TODO: fix to not need important */
.mobile\:margin-x-0 {
margin-left: 0 !important;
margin-right: 0 !important;
}
/* TODO: maybe this should be moved to a > 480px query */
.mobile\:margin-top-0 {
margin-top: 0;
}
.mobile\:margin-top-1 {
margin-top: 0.5rem;
}
.mobile\:margin-top-2 {
margin-top: 1rem;
}
}
.card.card--inverse {
max-width: 100%;
min-width: 100%;
overflow: hidden;
background: none;
border: none;
margin: 0;
}
.card--inverse .news-header,
.card--inverse .card__content {
color: #ffffff;
}
.card--inverse .news-header {
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times;
/* 18px */
font-size: 1rem;
font-weight: normal;
line-height: 1.5;
letter-spacing: 0.36px;
}
.card--inverse .card__content {
padding: 1.25rem;
}
.video-container {
overflow: hidden;
position: relative;
width: 100%;
}
.video-container::after {
padding-top: 56.25%;
display: block;
content: "";
}
.video-container iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
@media all and (min-width: 640px) {
.visible .card.card--inverse {
-moz-box-shadow: -1px 0 0 rgba(255, 255, 255, 0.5);
-webkit-box-shadow: -1px 0 0 rgba(255, 255, 255, 0.5);
box-shadow: -1px 0 0 rgba(255, 255, 255, 0.5);
}
}
.width-144px {
width: 7rem;
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint */
/*****************************************************************/
@media all and (min-width: 900px) {
.card.width-281px,
.card.width-300px {
margin-left: auto;
margin-right: auto;
}
.height-125px {
height: 7.8125rem;
}
}
.card .card__image {
text-align: center;
}
.card .card__image img {
width: 100%;
/* 281px
max-width: 23.42rem;
*/
}
/*
TODO: re-evaluate the animation on all images, it's causing issues
maybe turn this into a class?
*/
.card .card__image img {
opacity: 1;
transform: scale(1);
transition: 0.5s ease;
}
.card a:hover img,
.card a:focus img,
.card:hover .card__image img,
.card:focus .card__image img {
opacity: 0.25;
transform: scale(1.05);
transition: 0.5s ease;
}
@media (max-width: 480px) {
/* .card.card--news .card__image img {
transform: scale(1) translateY(-25%);
}
.card.card--news:hover .card__image img,
.card.card--news:focus .card__image img {
transform: scale(1) translateY(-25%);
} */
}
@media (max-width: 300px) {
.card.card--news .card__image img {
transform: scale(1);
}
.card.card--news:hover .card__image img,
.card.card--news:focus .card__image img {
transform: scale(1);
}
}
/* Category / Date */
/* .card__content p {
font-size: 0.875rem;
} */
/* TODO: re-evaluate font-size
if the a is just supppose to wrap other classes, this could cause issues with the utility classes
*/
.card__content a {
/*
font-size: 1rem;
font-weight: 500;
*/
}
.card a {
display: inline-block;
overflow: hidden;
padding: 0;
margin: 0;
}
/* TODO: the code prior forces all anchors to be inline-block
this is causing all icons to have the same display, breaking alignment
*/
.card a.usa-icon {
display: inline-block;
display: flex;
background-color: transparent;
margin: 0 auto;
}
.img-bg-blue {
background-color: rgb(4, 82, 137);
}
/* TODO: re-evaluate this line */
/* .card a:not(.usa-media-block__body) {
background-color: rgb(4, 82, 137);
} */
.card.card--hero {
position: relative;
display: grid;
grid-row: auto;
grid-column: auto;
grid-template-areas: "main";
overflow: hidden;
width: 100%;
}
.card.card--hero:hover,
.card.card--hero:active,
.card.card--hero:focus {
text-decoration: none;
}
.card--hero .card__image {
position: relative;
overflow: hidden;
/* 183px */
height: 11.4375rem;
}
.card--hero .card__image img {
width: 100%;
height: 100%;
object-fit: cover;
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint - ie10+ image scaling fix for mobile*/
/*****************************************************************/
@media (min-width: 480px) and (max-width: 768px) and (-ms-high-contrast: none),
(-ms-high-contrast: active) {
.card--hero .card__image {
position: relative;
height: 400px !important;
}
.card--hero .card__image img {
position: absolute;
height: 400px !important;
width: auto !important;
max-width: inherit !important;
}
.card--hero .card__content {
width: 200px;
}
}
@media (min-width: 0px) and (max-width: 480px) and (-ms-high-contrast: none),
(-ms-high-contrast: active) {
.card--hero .card__image img {
position: absolute;
top: 0;
left: 0;
width: 480px;
height: auto;
}
}
.card--hero .card__type {
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
/* 14px */
font-size: 0.875rem;
font-weight: 600;
letter-spacing: 1.5px;
color: #48b0fb;
text-transform: uppercase;
margin: 0;
/* 23px */
margin-top: 1.4375rem;
}
.card--hero .card__title {
color: #013256;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times,
serif;
font-size: 1.25rem;
font-weight: 300;
letter-spacing: 1.3px;
/* 6px */
/* 22px - 36px */
margin: 0 0 0.875rem;
/*0.375rem 0 0.875rem;*/
}
.card--hero .card__description {
color: #505050;
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
/* 14px */
font-size: 0.875rem;
font-weight: normal;
line-height: 1.5;
letter-spacing: 0.25px;
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint */
/*****************************************************************/
@media (min-width: 480px) {
/* this needs to be fixed for IE in a specific situation. See below. TH */
/*
.card .card__image img {
width: auto;
}
*/
.card.card--hero {
height: 100%;
}
.card--hero .card__image {
height: 100%;
grid-area: main;
max-height: 100%;
background-color: rgb(4, 82, 137);
}
.card--hero .card__image img {
width: 100%;
object-fit: cover;
transform: scale(1);
transition: 0.5s ease;
}
.card--hero:hover .card__image img,
.card--hero:focus .card__image img {
transform: scale(1.05);
transition: 0.5s ease;
}
.card--hero .card__content {
position: absolute;
z-index: 1;
bottom: 0;
left: 0;
/* 22px */
margin: 1.375rem;
transition: bottom 0.5s ease;
}
.card--hero:hover .card__content,
.card--hero:focus .card__content {
bottom: 50px;
transition: bottom 0.5s ease;
}
.card--hero .card__title {
color: #ffffff;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times,
serif;
font-size: 1.25rem;
font-weight: normal;
line-height: normal;
letter-spacing: 1.3px;
transition: margin 0.5s ease;
}
.card--hero:hover .card__title,
.card--hero:focus .card__title {
margin: 0 0 0.375rem;
transition: margin 0.5s ease;
}
.card--hero .card__description {
overflow: hidden;
color: #fff;
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
/* 14px */
font-size: 0.875rem;
font-weight: normal;
line-height: 1.5;
letter-spacing: 0.25px;
margin: 0;
transition: all 0.5s ease;
/* 22px */
max-height: 1.375rem;
/* -42px*/
margin-bottom: -2.625rem;
}
.card--hero:hover .card__description,
.card--hero:focus .card__description {
transition: all 0.5s ease;
max-height: 100px;
margin-bottom: 0px;
}
.grid-container.margin-x-7 {
margin-left: 3.5rem;
margin-right: 3.5rem;
}
.width-281px {
flex-grow: 0;
flex-shrink: 0;
flex-basis: 17.5625rem;
max-width: 17.5625rem;
}
.width-144px {
width: 9rem;
}
.width-192px {
min-width: 12rem;
}
.width-200px {
min-width: 12.5rem;
}
.width-300px {
max-width: 18.75rem;
}
.width-385px {
max-width: 24.0625rem;
}
}
@media (min-width: 480px) and (-ms-high-contrast: none),
(-ms-high-contrast: active) {
/* need to do something different for IE - TH 6/10/2020 */
.usa-megamenu .card .card__image img {
width: 100%;
}
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint */
/*****************************************************************/
@media all and (min-width: 768px) {
.usa-hero--mobile-carousel {
/* 14px */
padding: 0.875rem;
}
.usa-hero--mobile-carousel .glider-track {
/* important is needed to override glider inline styles */
width: 100% !important;
display: -ms-grid;
display: grid;
/*
1360px
1038px 7px 315px
76.3235294117647% 0.5147058823529411% 23.161764705882355%
*/
-ms-grid-columns: minmax(min-content, 64.875rem) 7px 19.8rem;
-ms-grid-rows: auto 7px auto;
/* first col is 1038px width, second is 315px*/
grid-template-columns: minmax(min-content, 74.78386167146974%) auto;
grid-template-rows: auto;
/* 7px */
grid-gap: 0.4375rem;
grid-template-areas:
"main sub1"
"main sub2";
}
.usa-hero--mobile-carousel .glider-slide {
overflow: hidden;
/* important is needed to override glider inline styles */
width: 100% !important;
}
.usa-hero--mobile-carousel .glider-slide .card--hero .card__image {
height: 100%;
}
.usa-hero--mobile-carousel .glider-slide:nth-of-type(1) {
-ms-grid-row: 1;
-ms-grid-row-span: 3;
-ms-grid-column: 1;
grid-area: main;
/* 550px */
/* max-height: 34.375rem; */
}
.usa-hero--mobile-carousel .glider-slide:nth-of-type(1) .card__content {
/* width: 100vh; */
}
.usa-hero--mobile-carousel
.glider-slide:nth-of-type(1)
.card--hero
.card__image
img {
height: 100%;
object-fit: cover;
}
.usa-hero--mobile-carousel
.glider-slide:nth-of-type(2)
.card--hero
.card__image
img,
.usa-hero--mobile-carousel
.glider-slide:nth-of-type(3)
.card--hero
.card__image
img {
object-fit: cover;
}
.usa-hero--mobile-carousel
.glider-slide:nth-of-type(2)
.card--hero
.card__title,
.usa-hero--mobile-carousel
.glider-slide:nth-of-type(3)
.card--hero
.card__title {
/* 16px */
font-size: 1rem;
}
.usa-hero--mobile-carousel .glider-slide:nth-of-type(2) {
-ms-grid-row: 1;
-ms-grid-column: 3;
grid-area: sub1;
/* 272px */
/* max-height: 17rem; */
}
.usa-hero--mobile-carousel .glider-slide:nth-of-type(3) {
-ms-grid-row: 3;
-ms-grid-column: 3;
grid-area: sub2;
/* 272px */
/* max-height: 17rem; */
}
.dots.glider-dots {
display: none;
}
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint - ie10+*/
/*****************************************************************/
@media all and (min-width: 768px) and (-ms-high-contrast: none),
(-ms-high-contrast: active) {
.usa-hero--mobile-carousel
.glider-slide:nth-of-type(2)
.card--hero
.card__image
img,
.usa-hero--mobile-carousel
.glider-slide:nth-of-type(3)
.card--hero
.card__image
img {
width: auto;
height: 100%;
}
.usa-hero--mobile-carousel .glider-slide .card--hero .card__description {
width: 95%;
}
.usa-hero--mobile-carousel
.glider-slide:nth-of-type(1)
.card--hero
.card__content {
/* width: 64.6875rem; */
}
.usa-hero--mobile-carousel
.glider-slide:nth-of-type(2)
.card--hero
.card__content,
.usa-hero--mobile-carousel
.glider-slide:nth-of-type(3)
.card--hero
.card__content {
width: 19.6875rem;
}
}
.usa-hero {
background-image: url("/assets/images/large-3up.jpg");
background-position: top center;
}
.usa-hero--container {
position: absolute;
}
@media (min-width: 1024px) {
.usa-nav__primary button,
.usa-nav__primary button:hover,
.usa-nav__primary button[aria-expanded="true"],
.usa-nav__primary button[aria-expanded="true"]:hover,
.usa-nav__primary button[aria-expanded="false"]:hover {
transition: 0.25s ease;
}
}
.usa-navbar {
border-bottom: none;
}
/* Header with Golden Top Rule */
.usa-header {
border-top: solid 2px #7f7044;
box-shadow: inset 0 7px 0 #b7ac83;
-moz-box-shadow: inset 0 7px 0 #b7ac83;
-webkit-box-shadow: inset 0 7px 0 #b7ac83;
}
.sticky-active .usa-header {
border-bottom: solid 3px #fff;
box-shadow: inset 0 7px 0 #b7ac83, 0 2px 6px rgba(0, 0, 0, 0.2);
-moz-box-shadow: inset 0 7px 0 #b7ac83, 0 2px 6px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: inset 0 7px 0 #b7ac83, 0 2px 6px rgba(0, 0, 0, 0.2);
}
.usa-nav__primary .usa-accordion__button span {
color: #fff;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times,
serif;
font-weight: 100;
font-size: 1.2rem;
letter-spacing: 0.1rem;
padding-right: 0;
}
.usa-nav__primary > .usa-nav__primary-item#search {
display: none;
}
.usa-header + .usa-section,
.usa-header + main {
border-top: 0;
}
/* Mega Menu Content */
.usa-nav__submenu,
.usa-nav__submenu h2,
.usa-nav__submenu a,
.usa-nav__submenu a:visited {
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times,
serif;
font-weight: 100;
color: #fff;
line-height: 1.5rem;
}
.usa-nav__submenu {
transition: 0.5s ease;
}
.usa-nav__submenu article p,
.usa-nav__submenu article span {
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
font-size: 0.8rem;
line-height: 1.7rem;
letter-spacing: 0.03rem;
}
.usa-nav__submenu article ul {
margin-left: 0;
}
.usa-nav__submenu-list > li {
list-style: disc;
font-size: 0.8rem;
line-height: 0.5rem;
letter-spacing: 0.1rem;
}
/* Mega Menu Link Hovers */
.usa-nav__submenu a:hover,
.usa-nav__submenu a:visited:hover,
.usa-nav__submenu .usa-nav__submenu-item a:hover,
.usa-nav__submenu .usa-nav__submenu-item a:visited:hover {
color: #a48923;
transition: 0.25s ease;
text-decoration: underline;
}
.usa-nav__submenu .card a,
.usa-nav__submenu .card a:visited {
color: #003256;
}
.usa-nav__submenu .card a:hover,
.usa-nav__submenu .card a:visited:hover,
.usa-nav__submenu .card a:focus {
color: #3163b6;
}
.usa-search input[type="search"] {
font-style: italic;
letter-spacing: 0.05rem;
}
.usa-search .usa-button {
background-image: url("/assets/images/icon-search.svg");
background-size: 1.4rem;
}
/* Search Submit Icon */
.usa-search .usa-search__submit,
.usa-search [type="submit"] {
width: 2.3rem;
}
/* Mega menu - affecting all breakpoints */
/* TO DO: don't affect mobile */
header .usa-accordion {
/* color: #fff; */
}
header .usa-nav__primary .usa-nav__primary-item > a {
color: #fff;
text-decoration: none;
}
header .usa-nav__primary .usa-nav__primary-item > a:hover,
header .usa-nav__primary .usa-nav__primary-item > a:visited:hover {
text-decoration: underline;
}
/* Adjust overlay dim */
.usa-overlay {
z-index: 0;
}
@media (min-width: 0) and (max-width: 639px) {
/* Make overlay dim darker on mobile for map popup */
.usa-overlay.is-visible {
/* opacity: 0.7; */
}
}
/* Logo */
.usa-logo {
margin-top: 1.2rem;
margin-left: 0.8rem;
}
/* Hamburger Icon */
.usa-menu-btn .fa-bars {
font-size: 2rem;
}
.usa-menu-btn,
.usa-menu-btn:hover {
background-color: transparent;
margin-top: 5px;
padding-right: 9px;
}
.usa-nav__close .fa-times {
font-size: 1.5rem;
}
/* Menu */
.usa-nav__primary {
order: 1;
}
.usa-nav__secondary {
order: 2;
}
.usa-nav__secondary .usa-label {
margin-bottom: 1rem;
}
/* Menu Links */
.usa-nav__primary button {
text-transform: uppercase;
}
/* Social links under search */
.usa-social-link {
text-align: center;
padding-top: 16px;
}
/*
Footer
*/
/*
.usa-footer {
background-color: #1b1d20;
}
*/
.usa-footer p {
padding: 0;
}
.usa-footer__primary-section {
background-color: #1b1d20;
}
.usa-footer__secondary-section {
background-color: #1b1d20;
border-top: solid 2px #fff;
}
.usa-footer__secondary-section .usa-footer__nav li {
width: auto;
margin: 0 auto;
padding: auto;
text-align: center;
}
.usa-footer__primary-link,
.usa-footer__secondary-link,
.usa-footer__secondary-section a,
.usa-footer__secondary-section a:visited {
color: #ffffff;
text-transform: uppercase;
text-decoration: none;
/* NOTE: Fallback to USWDS Default */
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
font-size: 0.7rem;
letter-spacing: 1.2px;
margin-left: 0;
}
.usa-footer__secondary-section a:hover,
.usa-footer__secondary-section a:visited:hover {
text-decoration: underline;
}
.usa-footer__secondary-section ul li a {
/* TO DO - find way to remove left margin from footer links to truly center */
}
/*
Carousel
*/
.carousel-previous-button,
.carousel-next-button,
.dark .carousel-previous-button,
.dark .carousel-next-button {
display: none;
}
.view-more-link,
.view-more-link:visited {
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
font-size: 1rem;
text-transform: uppercase;
font-weight: 600;
line-height: normal;
letter-spacing: 1.71;
color: #003256;
}
.carousel--dark .view-more-link {
color: #ffffff;
}
.carousel-controls {
flex-direction: column;
margin: 0;
}
.glider.margin-x-4,
.glider-track.margin-x-4 {
margin-right: 0;
margin-left: 0;
}
/* glider/carousel */
.glider.disable-scrollbars::-webkit-scrollbar {
width: 0;
height: 0;
background: transparent;
}
.glider .glider-slide .card {
height: 100%;
width: 100%;
display: block;
}
.glider .glider--one {
width: 100%;
}
.glider.glider--three-wide .card .card__content {
margin: 0 1.25rem 1.25rem 1.25rem;
}
.glider.glider--three-wide .card .card__image img {
width: 100%;
object-fit: cover;
}
.glider.glider--three-narrow {
max-width: 825px;
margin: 0 auto;
}
.glider.glider--three-narrow-2 {
max-width: 939px;
margin: 0 auto;
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint */
/*****************************************************************/
@media (min-width: 768px) {
.carousel-controls {
flex-direction: row;
margin: 0 3.5rem;
}
.glider-track {
margin-right: 2rem;
/* margin-left: 2rem; */
}
.glider.margin-x-4,
.glider-track.margin-x-4 {
margin-right: 2rem;
margin-left: 2rem;
}
.view-more-link {
margin-right: 1.875rem;
}
/* TODO: move all default carousel control styling outside of media query */
.carousel-previous-button,
.carousel-next-button,
.carousel--dark .carousel-previous-button,
.carousel--dark .carousel-next-button {
display: block;
/* 57px */
height: 3.5625rem;
width: 3.5625rem;
border: none;
cursor: pointer;
}
.carousel-previous-button {
background: url("/assets/images/arrowprevnew.svg") no-repeat;
}
.carousel--dark .carousel-previous-button {
background: url("/assets/images/arrow-prev.svg") no-repeat;
}
.carousel-previous-button:hover,
.carousel-previous-button:active {
background: url("/assets/images/arrowprevnewhover.svg") no-repeat;
}
.carousel-next-button {
background: url("/assets/images/arrownextnew.svg") no-repeat;
}
.carousel--dark .carousel-next-button {
background: url("/assets/images/arrow-next.svg") no-repeat;
}
.carousel-next-button:hover,
.carousel-next-button:active {
background: url("/assets/images/arrownextnewhover.svg") no-repeat;
}
}
.dots.glider-dots {
}
.glider-dot {
height: 1.8125rem;
width: 1.8125rem;
color: #ffffff;
background: #ffffff;
border: 1px solid #003256;
/* 20px 2.5px*/
margin: 1.5rem 0.15625rem;
}
.glider-dot--dark .glider-dot {
height: 1.8125rem;
width: 1.8125rem;
color: #ffffff;
background: transparent;
border: 1px solid #ffffff;
/* 20px 2.5px*/
margin: 1.5rem 0.15625rem;
}
.glider-dot:focus,
.glider-dot.active {
color: #003256;
background: #003256;
}
.glider-dot--dark .glider-dot:focus,
.glider-dot--dark .glider-dot.active {
color: #ffffff;
background: #ffffff;
}
/* accordions
TODO: default this for all accordions
*/
.usa-tab .usa-accordion__button {
color: #ffffff;
text-decoration: none;
text-transform: uppercase;
background-color: #003256;
background-image: url("/assets/images/arrow-right-white.svg");
background-size: 0.8rem;
background-position: calc(100% - 16px) center;
}
.usa-tab .usa-accordion__button[aria-expanded="true"] {
color: #ffffff;
background-color: #003256;
background-image: url("/assets/images/arrow-down-white.svg");
background-size: 1.2rem;
background-position: calc(100% - 16px) center;
}
.usa-tab .usa-accordion__heading:not(:first-child) {
margin-top: 0;
/* border-top: solid 2px rgba(255, 255, 255, 0.5); */
}
/*
Tabs
*/
.usa-accordion__content {
overflow: hidden;
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint */
/*****************************************************************/
@media all and (min-width: 40em) {
.tablet\:text-left {
text-align: left;
}
}
/*****************************************************************/
/*****************************************************************/
/* background images for sections */
/*****************************************************************/
/*****************************************************************/
@media all and (min-width: 640px) {
.bg-microphone {
background-image: url("/assets/images/fdic-about-leadership-bg3.jpg");
background-position: top left;
background-repeat: no-repeat;
}
.bg-careers {
background-image: url("/assets/images/fdic-about-careers-bg.jpg");
background-position: 40% 0;
background-repeat: no-repeat;
max-height: 515px;
}
.bg-initiatives {
background-image: url("/assets/images/fdic-resources-initiatives-bg.png");
background-position: 70% 0;
background-repeat: no-repeat;
max-height: 515px;
}
.bg-depositinsurance {
background-image: url("/assets/images/fdic-topic-depositinsurance-bg.png");
background-position: 70% 0;
background-repeat: no-repeat;
background-size: cover;
}
.bg-supervision {
background-image: url("/assets/images/fdic-topics-supervision-bg.png");
background-position: 76% 0;
background-repeat: no-repeat;
background-size: cover;
}
.bg-lawsregulations {
background-image: url("/assets/images/fdic-resources-lawsregulations.png");
background-position: 70% 0;
background-repeat: no-repeat;
background-size: cover;
}
.bg-resolutions {
background-image: url("/assets/images/fdic-resources-resolutions.jpg");
background-position: 60% 40%;
background-repeat: no-repeat;
background-size: cover;
}
.bg-tools {
background-image: url("/assets/images/fdic-resources-tools.jpg");
background-position: 70% 0;
background-repeat: no-repeat;
background-size: cover;
}
.bg-financialresearch {
background-image: url("/assets/images/fdic-analysis-financialresearch-bg.jpg");
background-position: 50% 0;
background-repeat: no-repeat;
background-size: cover;
}
.bg-quarterlyprofile {
background-image: url("/assets/images/fdic-analysis-quarterlyprofile-bg.jpg");
background-position: 40% 0;
background-repeat: no-repeat;
background-size: cover;
}
.bg-natsurvey {
background-image: url("/assets/images/fdic-analysis-natsurvey-bg.jpg");
background-position: 50% 0;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-difference {
background-image: url("/assets/images/fdic-careers-difference-bg.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.bg-employee-benefits {
background-image: url("/assets/images/fdic-careers-employee-benefits-bg.png");
background-position: 70% 0;
background-repeat: no-repeat;
min-height: 450px;
}
.bg-interships-careers {
background-image: url("/assets/images/fdic-careers-interships-careers-bg.png");
background-position: 70% 0;
background-repeat: no-repeat;
min-height: 446px;
}
.bg-job-opportunities {
background-image: url("/assets/images/fdic-careers-job-opportunities-bg.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.bg-transparency {
background-image: url("/assets/images/fdic-trust-why-bg.png");
background-position: 36% 0;
background-repeat: no-repeat;
background-size: cover;
}
.bg-sharing {
background-image: url("/assets/images/fdic-trust-sharing-performance-bg.png");
background-position: 40% 0;
background-repeat: no-repeat;
background-size: cover;
}
.bg-explaining-work {
background-image: url("/assets/images/fdic-trust-explaining-work-bg.png");
background-position: 70% 0;
background-repeat: no-repeat;
}
.bg-access-data {
background-image: url("/assets/images/fdic-access-data-bg.png");
background-position: 40% 0;
background-repeat: no-repeat;
background-size: cover;
}
.bg-future {
background-image: url("/assets/images/fdic-innovation-future-bg.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-small-business-lending {
background-image: url("/assets/images/fdic-resources-publications-small-business-lending.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.bg-initivies-trust {
background-image: url("/assets/images/fdic-about-inititives-trust.jpg");
background-position: 70% 0;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-resolutions-bank-failures {
background-image: url("/assets/images/fdic-resources-resolutions-bank-failures.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-resolutions-authority-news {
background-image: url("/assets/images/fdic-resources-resolutions-authority-news.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-bank-find {
background-image: url("/assets/images/fdic-resources-tools-bank-find.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-deposit-market-share-report {
background-image: url("/assets/images/fdic-resources-tools-deposit-market-share.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-financial-inclusion {
background-image: url("/assets/images/fdic-about-initiatives-financialinclusion.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-realestateproperty {
background-image: url("/assets/images/fdic-resources-resolutions-realestateproperty.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-allianceforeconinclusion {
background-image: url("/assets/images/fdic-about-inititives-allianceforeconinclusion.jpg");
background-position: 0 0;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-financialinclusion {
background-image: url("/assets/images/fdic-about-initiatives-financialinclusion.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-contact-cfr {
background-image: url("/assets/images/fdic-contact-cfr-bg.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-faq-bg {
background-image: url("/resources/deposit-insurance/images/fdic-faq-bg.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-contact-bg {
background-image: url("/resources/deposit-insurance/images/fdic-contact-bg.jpg");
background-position: 40% 62%;
background-repeat: no-repeat;
background-size: cover;
}
.bg-who-we-are-bg {
background-image: url("/analysis/cfr/images/fdic-who-we-are-bg.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-papers-studies-research {
background-image: url("/analysis/cfr/images/bg-papers-studies-research.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-cfr-events {
background-image: url("/analysis/cfr/images/bg-cfr-events.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-cfr-careers {
background-image: url("/analysis/cfr/images/bg-cfr-careers.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
/* new background for innovation section - 6/30 */
.bg-techcomp {
background-image: url("/assets/images/fdic-analysis-innovation-bg.jpg");
background-position: 50% 0;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-getstarted {
background-image: url("/getbanked/images/fdic-getstarted-bg.jpg");
background-position: 20% 0;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-chairmanquote {
background-image: url("/getbanked/images/fdic-chairmanquote-bg.jpg");
background-position: 20% 0;
background-repeat: no-repeat;
background-size: cover;
min-height: 425px;
}
.bg-findabank {
background-image: url("/getbanked/images/fdic-findabank-bg.jpg");
background-position: 20% 0;
background-repeat: no-repeat;
background-size: cover;
min-height: 425px;
}
.usa-tab {
display: -ms-grid;
display: grid;
-ms-grid-columns: 1fr minmax(215px, 1fr) minmax(215px, 1fr)
minmax(215px, 1fr) auto 1fr;
grid-template-columns:
minmax(0, 1fr) minmax(215px, 1fr) minmax(215px, 1fr) minmax(215px, 1fr)
auto auto minmax(0, 1fr);
/* grid-template-columns: minmax(0, 1fr) min-content min-content min-content min-content min-content minmax(0,
1fr); */
grid-template-rows: auto;
grid-template-areas:
"left header1 header2 header3 header4 header5 right"
"content content content content content content content";
/* background-color: #003256; */
background-image: linear-gradient(to bottom, #003256 63px, #f9f7f3 63px);
}
.usa-tab .usa-accordion__heading:not(:first-child),
.usa-tab .usa-accordion__heading {
margin: 0;
padding: 0;
}
.usa-accordion__button {
letter-spacing: 1.5px;
}
main .usa-accordion__button[aria-expanded="true"] {
pointer-events: none;
}
header .usa-accordion__button[aria-expanded="false"]:hover,
header .usa-accordion__button[aria-expanded="true"] {
text-decoration: none;
}
/*
.usa-accordion__button[aria-expanded="true"]::after {
content: '';
position: absolute;
width: 100%;
left: 0;
border-bottom: 1px solid #ffffff;
}
*/
.usa-accordion__button[aria-expanded="false"] {
text-decoration: none;
}
.usa-tab .usa-accordion__heading .usa-accordion__button {
height: 100%;
color: inherit;
text-align: center;
background: none;
padding: 1.25rem 2.5rem;
margin: 0;
}
.usa-tab .usa-accordion__heading:nth-of-type(1) {
-ms-grid-row: 1;
-ms-grid-column: 2;
grid-area: header1;
}
.usa-tab .usa-accordion__heading:nth-of-type(2) {
-ms-grid-row: 1;
-ms-grid-column: 3;
grid-area: header2;
}
.usa-tab .usa-accordion__heading:nth-of-type(3) {
-ms-grid-row: 1;
-ms-grid-column: 4;
grid-area: header3;
}
.usa-tab .usa-accordion__heading:nth-of-type(4) {
-ms-grid-row: 1;
-ms-grid-column: 5;
grid-area: header4;
}
.usa-tab .usa-accordion__heading:nth-of-type(5) {
-ms-grid-row: 1;
-ms-grid-column: 6;
grid-area: header5;
}
.usa-tab .usa-accordion__content {
-ms-grid-row: 2;
-ms-grid-column: 1;
-ms-grid-column-span: 6;
grid-area: content;
padding: 0;
}
}
/*
Tablet Portrait and lower
*/
@media and (max-width: 640px) {
/* TODO: fix so we don't need this line */
.glider.tablet\:margin-bottom-0,
.carousel-controls.tablet\:margin-bottom-0,
.tablet\:margin-bottom-0 {
margin-bottom: 0;
}
}
/* Tablet Landscape and lower */
@media all and (max-width: 880px) {
/* TODO: fix so we don't need this line */
.carousel-controls.tablet-lg\:margin-bottom-0,
.tablet-lg\:margin-bottom-0 {
margin-bottom: 0;
}
}
/*
TODO: had to put this in here to make it consistent with USWD
https://github.com/uswds/uswds/blob/229aed2205db77dad7b7b914bd94d84e7bec79d6/src/stylesheets/settings/_settings-utilities.scss#L47
*/
@media all and (max-width: 1024px) {
.tablet-lg\:text-center {
text-align: center;
}
.tablet-lg\:position-relative {
position: relative;
}
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint - Smallest ≥ 0px & ≤ 1024px */
/*****************************************************************/
/* TODO: fix this. It's targeting everything below 1023.
using mobile: or tablet: here is a bad idea. we will have to clean this up.
*/
@media all and (min-width: 0) and (max-width: 1023px) {
.usa-help .usa-button,
.usa-help .usa-form .usa-button {
margin-top: 1rem;
}
/* .usa-banner__button::after, */
.usa-banner__button[aria-expanded="false"],
.usa-banner__button[aria-expanded="true"] {
background-position: left 287px bottom 8px;
}
/* Stay Informed Component */
.usa-stay-informed .usa-button {
margin-top: 1rem;
}
.usa-header {
border-bottom: solid 6px #fff;
}
.sticky-active .usa-header {
border-bottom: solid 6px #fff;
box-shadow: inset 0 7px 0 #b7ac83, 0 2px 6px rgba(0, 0, 0, 0.2);
-moz-box-shadow: inset 0 7px 0 #b7ac83, 0 2px 6px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: inset 0 7px 0 #b7ac83, 0 2px 6px rgba(0, 0, 0, 0.2);
}
.usa-banner__header {
min-height: 22px;
}
.usa-banner__content {
padding-bottom: 1rem;
padding-top: 1rem;
}
.usa-nav {
background-image: url("/assets/images/fdic-logo-seal.svg");
background-repeat: no-repeat;
background-size: 239%;
background-position: -478px -126px;
}
.usa-nav__primary button,
.usa-nav__primary button:hover,
.usa-nav__primary a:hover {
background-color: transparent;
}
.usa-nav__primary button {
padding: 1.2rem 1.5rem;
}
.usa-nav__primary button[aria-expanded="false"] {
background-image: url("/assets/images/arrow-right-white.svg");
background-size: 0.8rem;
background-position: calc(100% - 16px) center;
}
.usa-nav__primary button[aria-expanded="true"] {
background-image: url("/assets/images/arrow-down-white.svg");
background-size: 1.2rem;
background-position: calc(100% - 14px) center;
}
.usa-nav__primary .usa-accordion__button span {
font-size: 1.5rem;
font-weight: 100;
}
.usa-nav__submenu {
padding: 0 0.3rem 1rem;
}
.usa-nav__submenu .grid-row {
padding: 0 1rem;
}
.usa-nav__submenu article h2,
.usa-nav__submenu-list,
.usa-nav__submenu .usa-col {
display: none;
}
.usa-nav__submenu article p {
margin-top: 0;
margin-bottom: 0;
}
article .usa-nav__submenu-list {
display: block;
}
article .usa-nav__submenu-list .usa-nav__submenu-item {
border-top: none;
list-style: none;
}
article .usa-nav__submenu-list .usa-nav__submenu-item a {
padding-left: 0;
}
.usa-accordion__button .usa-icon {
position: absolute;
height: 37px;
width: 43px;
right: 0;
top: 0;
}
.light-parent-nav .usa-accordion__button[aria-expanded="true"] span i {
transform: rotate(180deg);
}
.usa-search p {
margin-top: 0;
}
.usa-search p a,
.usa-nav__secondary .usa-search .usa-link {
margin-right: 0;
}
.usa-search .usa-link:hover {
color: #a48923;
text-decoration: underline;
}
.usa-search input[type="search"] {
/* max-width: calc(27ch + 6rem); */
}
.usa-search .usa-search__submit,
.usa-search [type="submit"] {
width: 3.5rem;
margin-bottom: 0;
height: 40px;
}
header .usa-nav__primary-item {
border-top: none;
border-bottom: solid 1px rgba(255, 255, 255, 0.5);
}
/* Header Sticky Nav */
header.position-sticky {
top: 0;
}
/* Full width menu instead of partial */
.usa-nav {
width: 100%;
padding: 0 0 12px 0;
}
.usa-nav__secondary .usa-form,
.usa-nav__secondary .usa-link {
display: block;
color: #fff;
text-decoration: none;
font-size: 0.7rem;
font-weight: 100;
letter-spacing: 0.1rem;
}
/* Advanced Search link */
.usa-nav__secondary .usa-link {
margin-right: 12px;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times,
serif;
}
.usa-logo {
margin-top: 0.5rem;
margin-left: 0.8rem;
height: 32px;
overflow: hidden;
}
.usa-logo img {
max-width: none;
width: 5rem;
transition: scale 0.25s;
}
/* Close Icon */
.usa-nav__close {
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
height: 4rem;
}
.usa-nav__primary {
margin-top: 0;
}
.usa-nav__primary a {
color: #fff;
width: 20rem;
}
.usa-footer__primary-section .usa-footer__primary-content {
border-top: none;
border-bottom: solid 1px rgba(255, 255, 255, 0.5);
padding-top: 1.7rem;
padding-bottom: 1.7rem;
}
/* to do - hide bottom border on last "how can we help" section */
/*
.usa-footer .usa-footer__primary-content{
margin-bottom: 0;
padding-bottom: 0;
border-bottom: none;
}
*/
.usa-footer .grid-row.grid-gap-4 > *,
.usa-footer .grid-row.grid-gap > * {
padding-left: 0.5rem;
padding-right: 0.5rem;
}
.usa-footer .margin-6 {
margin-bottom: 0;
}
.usa-footer .margin-6:first-child {
margin-top: 0;
}
/* Footer - last section - hide bottom border and reduce padding */
.usa-footer .margin-6 div:last-child section {
border-bottom: none;
padding-bottom: 0;
}
.usa-footer__nav {
border-bottom: none;
}
.usa-footer__secondary-section .usa-footer__nav {
/* width: 18rem; */
}
.usa-footer__secondary-section .usa-footer__nav ul {
margin-left: 0.5rem;
margin-right: 0.5rem;
}
.usa-footer__secondary-section .usa-footer__nav ul li {
display: inline;
text-align: center;
width: auto;
margin: 0 auto;
}
.usa-navbar {
height: 4rem;
}
.usa-banner__header {
padding-top: 0.3rem;
padding-bottom: 0.3rem;
}
/* Official website of the US government down arrow */
/* Option 1 - matches designs */
/* .usa-banner__button::after, */
.usa-banner__button[aria-expanded="false"],
.usa-banner__button[aria-expanded="true"] {
background-image: url("/assets/uswds-2.6.0/img/angle-arrow-down-primary.svg"),
linear-gradient(transparent, transparent);
/* background-position: left 287px bottom 8px; */
background-size: 0.5rem;
}
.usa-banner__button[aria-expanded="true"] {
background-image: url("/assets/uswds-2.6.0/img/angle-arrow-up-primary.svg"),
linear-gradient(transparent, transparent);
}
.usa-banner__button::after {
background-image: none;
}
.usa-banner__button[aria-expanded="true"]::after {
background-color: transparent;
background-position: right 10px top 5px;
display: none;
}
/* Option 2 - move arrow to far right to line up with X when it opens */
/*
.usa-banner__button::after,
.usa-banner__button[aria-expanded=false],
.usa-banner__button[aria-expanded=true]{
background-image: url('/assets/uswds-2.5.0/img/angle-arrow-down-primary.svg'),linear-gradient(transparent,transparent);
background-position: right 16px bottom 11px;
}
*/
.usa-nav__secondary {
margin-top: 0;
}
/* TODO: We should undo font-size changes in favor of
tablet:font-size-bla-px or mobile:font-size-bla-px
*/
.font-heading-xl {
font-size: 0.8rem;
}
.font-heading-3xl {
font-size: 1.5rem;
}
.mobile-font-alt-md {
font-size: 0.85rem;
}
.font-alt-xl {
font-size: 1.5rem;
}
.font-sans-sm {
font-size: 0.8rem;
}
.font-sans-md {
/* 14px */
font-size: 0.875rem;
}
.mobile-list-style-none {
list-style: none;
}
.card--hero .card__title {
font-size: 0.9rem;
}
.mobile-padding-x-neg-2 {
margin-left: -1rem;
margin-right: -1rem;
}
.mobile-text-normal {
text-transform: initial;
}
.mobile\:text-center {
text-align: center;
}
.mobile\:width-full {
width: 99%;
}
.mobile\:width-full {
width: 99%;
}
.mobile\:margin-x-14px {
margin-left: 0.875rem;
margin-right: 0.875rem;
}
}
/* Mobile */
@media (max-width: 480px) {
.mobile\:padding-top-0 {
padding-top: 0;
}
.mobile\:padding-top-60px {
padding-top: 3.75rem;
}
/* TODO fix this line */
.margin-bottom-5.mobile\:margin-bottom-0,
.mobile\:margin-bottom-0 {
margin-bottom: 0;
}
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint - Mobile large ≥ 480px and above */
/*****************************************************************/
@media all and (min-width: 480px) {
.height-350px {
height: 21.875rem;
}
/* .usa-banner__button::after, */
.usa-banner__button[aria-expanded="false"],
.usa-banner__button[aria-expanded="true"] {
background-position: left 287px bottom 8px;
}
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint - Tablet ≥ 640px and above */
/*****************************************************************/
@media all and (min-width: 640px) and (max-width: 1023px) {
/* Partial nav */
.usa-nav {
width: 50%;
border-left: solid 3px #fff;
-moz-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
header.position-sticky {
top: 0;
}
/* .usa-banner__button::after, */
.usa-banner__button[aria-expanded="false"],
.usa-banner__button[aria-expanded="true"] {
background-position: center center;
}
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint */
/*****************************************************************/
@media all and (min-width: 640px) {
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint */
/*****************************************************************/
@media all and (min-width: 769px) {
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint - Desktop ≥ 1024px and above */
/*****************************************************************/
@media all and (min-width: 1366px) {
.widescreen\:grid-col-4 {
width: 33.3333333333%;
}
.widescreen\:grid-col-8 {
width: 66.6666666667%;
}
/* Top search bar */
.usa-nav__secondary {
right: 8.8rem;
}
.glider.glider--two .card {
max-width: 575px;
}
/* Consumers/Bankers/Analysts carousel cards */
.glider.glider--three .card {
max-width: 385px;
}
.glider.glider--three-wide .card {
max-width: 411px;
}
.glider.glider--three-wide .card .card__content {
margin: 0;
}
.glider.glider--four .card,
.glider.glider--three-narrow-2 .card {
max-width: 281px;
}
}
@media (min-width: 1024px) and (max-width: 1365px) {
/* Consumers/Bankers/Analysts carousel cards */
/* To Do: rename class */
/*
.carousel.caorusel-three-items
.carousel.caorusel-three-items .card { width}
*/
.glider.glider--two .card {
max-width: 416px;
}
.glider.glider--three .card {
max-width: 281px;
}
.glider.glider--three-wide .card {
max-width: 90%;
}
.glider.glider--three-wide .card .card__content {
margin: 0;
}
.glider.glider--four .card,
.glider.glider--three-narrow-2 .card {
max-width: 281px;
}
}
@media (min-width: 640px) and (max-width: 1024px) {
/* Consumers/Bankers/Analysts carousel cards */
/* To Do: rename class */
/*
.carousel.caorusel-three-items
.carousel.caorusel-three-items .card { width}
*/
.glider.glider--two .card {
max-width: 313px;
}
.glider.glider--three .card {
max-width: 281px;
}
.glider.glider--three-wide .card {
max-width: 90%;
}
.glider.glider--three-wide .card .card__content {
margin: 0;
}
.glider.glider--four .card,
.glider.glider.glider--three-narrow-2 .card {
max-width: 281px;
}
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint */
/*****************************************************************/
@media all and (min-width: 1024px) {
.tablet\:font-size-20px {
font-size: 1.25rem;
}
.desktop\:font-alt-lg {
/* 24px */
font-size: 1.5rem;
}
.desktop\:margin-x-177px {
margin-left: 11.0625rem;
margin-right: 11.0625rem;
}
.tablet\:font-size-25px {
/* 25px */
font-size: 1.5625rem;
}
.tablet\:font-size-32px {
font-size: 2rem;
}
.tablet\:font-size-36px {
font-size: 2.25rem;
}
.tablet\:text-center {
text-align: center;
}
.usa-banner__header {
min-height: 60px;
}
.usa-nav {
background-color: transparent;
}
.usa-logo img {
width: 12rem;
max-width: none;
transition: scale 0.25s;
}
/* Header Sticky Nav */
header.position-sticky {
top: 0;
}
.usa-header {
border-bottom-width: 3px;
}
.usa-header h2 {
font-size: 1.35rem;
letter-spacing: 0rem;
}
.usa-logo {
margin-top: -7rem;
/* margin-left: 0.6rem; */
margin-right: 0.4rem;
}
.usa-banner__inner {
padding-left: 14px;
border-bottom: 1px solid;
border-image-source: linear-gradient(
90deg,
#eef0f3,
#eef0f3,
#ffffff,
#ffffff
);
padding-bottom: 4px;
border-image-slice: 1;
border-left: 0;
border-top: 0;
border-right: 0;
}
.usa-nav__primary button,
.usa-nav__primary button:hover,
.usa-nav__primary button[aria-expanded="true"],
.usa-nav__primary button[aria-expanded="true"]:hover,
.usa-nav__primary button[aria-expanded="false"]:hover {
background-image: none;
text-decoration: none;
}
.usa-nav__primary
.usa-nav__primary-item:not(#search)
button[aria-expanded="false"] {
background-color: transparent;
background-image: none;
transition: 0.25s ease;
/* transition-delay: .1s; */
/* add back in when we can fade out the submenu */
}
/* hide the default nav hover underline */
.usa-header--basic .usa-current::after,
.usa-header--basic .usa-nav__link:hover::after,
.usa-header--basic [aria-expanded="true"]::after {
background-color: transparent;
}
/* Header blue background beneath, allowing main-content to float on top */
#main-content {
padding: 0;
}
/* Primary Links */
.usa-nav__primary {
margin-top: 1.3rem;
}
.sticky-active .usa-header--basic .usa-nav__primary {
margin-top: 2.7rem;
}
.usa-nav__primary > button,
.usa-nav__primary > .usa-nav__primary-item {
margin: 0 3.8rem;
/* display: block; */
transition: ease 0.25s;
}
.sticky-active .usa-nav__primary > button,
.sticky-active .usa-nav__primary > .usa-nav__primary-item {
margin: 0 2.9rem;
transition-delay: 0.25s;
transition: 0.25s;
}
.usa-nav__primary .usa-nav__primary-item .usa-nav__link {
border: solid 3px rgba(255, 255, 255, 0);
padding: 1.8rem 0.1rem 3rem;
margin: 0 1.6rem 0;
text-align: center;
}
/* Sticky nav search icon */
.usa-nav__primary > .usa-nav__primary-item#search button img {
width: 2rem;
}
.usa-nav__primary > .usa-nav__primary-item#search > button {
border: none;
background-color: transparent;
background-image: none;
}
.usa-nav__primary > .usa-nav__primary-item#search {
display: block;
opacity: 0;
transition: opacity 0.25s;
/*transition-delay: 0.25s;*/
}
#search .usa-accordion__button span {
display: block;
text-indent: -9999px;
background-repeat: no-repeat;
position: relative;
height: 30px;
}
#search .usa-accordion__button[aria-expanded="false"] span {
background-image: url("/assets/images/icon-search.svg");
}
#search .usa-accordion__button[aria-expanded="true"] span {
background-image: url("/assets/images/close-white-alt.svg");
}
#search .usa-megamenu.usa-nav__submenu {
border: none;
background-color: #003256;
margin-left: 832px;
margin-right: -32px;
background-image: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
/* mega nav dropdown hover tab */
.usa-nav__primary
.usa-nav__primary-item:not(#search)
button[aria-expanded="true"] {
border: solid 3px #fff;
border-bottom: none;
background-color: #003256;
/* background-image: url('/assets/images/meganav-bg.jpg'); */
z-index: 900;
background-position: top 0 left -240px;
background-size: initial;
}
.usa-nav__submenu-list {
margin-left: 1.5rem;
}
.usa-nav__submenu-list > li a {
line-height: 0.5rem;
}
.usa-header--basic.usa-header--megamenu .usa-nav__inner {
margin-top: 0;
}
/* Horizontally center the mege menu expanded area */
.usa-megamenu.usa-nav__submenu {
left: 0;
border: solid 3px #fff;
margin-top: -3px;
margin-left: -165px;
margin-right: 188px;
/*100px*/
padding: 1.6rem 1.8rem;
background-color: #0c2946;
transition: 0.5s ease;
transition-delay: 0.25s;
-moz-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.8);
-webkit-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.8);
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.8);
background-image: url("/assets/images/meganav-bg.jpg");
background-position: top center;
/* background-position: left 0 top -93px; */
}
#search .usa-megamenu.usa-nav__submenu {
margin-top: -11px;
}
.sticky-active .usa-megamenu.usa-nav__submenu {
margin-left: -114px;
margin-right: 14px;
}
.usa-megamenu.usa-nav__submenu::after,
.usa-megamenu.usa-nav__submenu::before {
background-color: transparent;
display: none;
}
/* Intro and links in columns */
.usa-nav__submenu article {
padding-right: 1rem;
}
.usa-nav__submenu article h2 {
font-weight: 500;
}
.usa-nav__submenu article p {
color: #fff;
}
.usa-nav__submenu article ul > li {
list-style: none;
}
.usa-nav__submenu article ul > li p a,
.usa-nav__submenu article ul > li a {
font-size: 0.9rem;
letter-spacing: 0.25rem;
font-weight: 500;
}
/* Search */
.usa-nav__secondary {
top: -4.8rem;
/* right: 7rem; */
position: absolute;
width: 50%;
height: 78px;
float: right;
transition: opacity 0.25s ease;
transition-delay: 0.25s;
}
.usa-nav__secondary .usa-help .usa-form,
.usa-nav__secondary .usa-help .usa-link,
.usa-nav__secondary .usa-link {
display: none;
}
.usa-search {
margin-left: 0;
}
/* Secondary Nav - Search Bar top right */
.usa-nav__secondary [role="search"] {
max-width: 20rem;
}
.usa-nav__secondary .usa-search input[type="search"] {
border: solid 1px #dedede;
height: 2rem;
margin-right: -2px;
padding-left: 0.9rem;
letter-spacing: 0.06rem;
width: 22rem;
}
/* Sticky nav search dropdown */
#search .usa-search [role="search"] {
max-width: 100%;
}
#search .usa-header [role="search"] {
max-width: none;
}
#search .usa-search {
margin-left: 0;
}
#search .usa-search input[type="search"] {
width: 24rem;
padding-right: 47px;
}
/* Google Autocomplete dropdown */
table.gssb_c {
padding-right: 20px;
}
#search .usa-search p {
text-align: right;
font-size: 0.8rem;
letter-spacing: 0.1rem;
}
#search .usa-help button {
margin-left: auto;
margin-right: auto;
border-radius: 3px;
}
.usa-nav__secondary .usa-search .usa-button {
background-color: #09314d;
margin-top: 0;
height: 2rem;
}
.usa-nav__secondary .usa-search .usa-button:hover {
background-color: #20509e;
}
.sticky-active .usa-nav__secondary {
opacity: 0;
transition: opacity 0.25s;
right: -1.8rem;
/* transition-delay: 0.25s; */
}
.sticky-active .usa-header--basic.usa-header--megamenu .usa-nav__inner {
margin-top: 0;
}
.sticky-active .usa-logo {
margin-top: 1.2rem;
margin-left: 1rem;
}
.sticky-active .usa-logo img {
width: 6.4rem;
transition: scale 0.25s;
}
.sticky-active .usa-nav {
height: 5.1rem;
}
.sticky-active .usa-navbar {
height: 4.9rem;
}
.sticky-active .usa-nav__primary .usa-nav__link {
padding: 1.2rem 0 2rem;
margin: -1rem 2.2rem 0;
width: 80%;
}
.sticky-active .usa-nav__primary > .usa-nav__primary-item#search {
opacity: 1;
margin-top: -6px;
margin-right: 15px;
margin-left: 40px;
transition: opacity 0.25s;
/* transition-delay: 0.25s; */
}
#search .usa-search button[type="submit"] {
height: 2rem;
width: auto;
background-image: url("/assets/images/icon-search-blue.svg");
/* background-size: 1.375rem; */
margin-top: 0px;
margin-left: -2rem;
background-color: transparent;
background-position: right 0.5rem top 0.6rem;
}
#search .usa-help label {
font-size: 1.5rem;
padding-top: 20px;
border-top: solid 1px rgba(255, 255, 255, 0.3);
}
.half-pixel-border-white {
-moz-box-shadow: 1px 0 0 rgba(255, 255, 255, 0.5);
-webkit-box-shadow: 1px 0 0 rgba(255, 255, 255, 0.5);
box-shadow: 1px 0 0 rgba(255, 255, 255, 0.5);
}
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint */
/*****************************************************************/
@media all and (min-width: 1024px) and (max-width: 1279px) {
.usa-nav__primary > button,
.usa-nav__primary > .usa-nav__primary-item {
margin: 0 1rem;
}
.sticky-active .usa-nav__primary > button,
.sticky-active .usa-nav__primary > .usa-nav__primary-item {
margin: 0 0.6rem;
}
.usa-footer__primary-section h3,
.usa-footer__primary-section label {
font-size: 1.2rem;
}
.usa-megamenu.usa-nav__submenu {
margin-left: -165px;
margin-right: 74px;
}
.sticky-active .usa-megamenu.usa-nav__submenu {
margin-left: -66px;
margin-right: 74px;
}
.usa-nav__secondary {
right: 1.8rem;
}
/* iPad landscape fix */
#search .usa-megamenu.usa-nav__submenu {
margin-left: 56%;
}
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint - iPad Air 3 landscape*/
/*****************************************************************/
@media all and (min-width: 1111px) {
.tablet-margin-x-16rem {
margin-left: 16rem;
margin-right: 16rem;
}
.usa-button span {
display: inline;
margin-left: 0.4rem;
}
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint */
/*****************************************************************/
@media all and (min-width: 1111px) and (max-width: 1112px) {
.usa-nav__secondary {
right: -2rem;
}
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint */
/*****************************************************************/
@media all and (min-width: 1280px) and (max-width: 1365px) {
.usa-nav__primary > button,
.usa-nav__primary > .usa-nav__primary-item {
margin: 0 3.3rem;
}
.sticky-active .usa-nav__primary > button,
.sticky-active .usa-nav__primary > .usa-nav__primary-item {
margin: 0 2.4rem;
}
.usa-nav__secondary {
right: 8.8rem;
}
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint */
/*****************************************************************/
@media all and (min-width: 1367px) {
/* this adds the blue bar beneath the hero/image/mosaic */
body.usa {
background: linear-gradient(to bottom, #003256 228px, #f9f7f3 228px);
}
body.usa.alert-active {
background: linear-gradient(to bottom, #003256 284px, #f9f7f3 284px);
}
body.usa.sticky-active {
background: linear-gradient(to bottom, #f9f7f3 228px, #f9f7f3 228px);
}
.usa-megamenu.usa-nav__submenu {
margin-right: 160px;
}
.sticky-active .usa-megamenu.usa-nav__submenu {
margin-left: -72px;
}
.sticky-active .usa-nav__primary .usa-nav__link {
margin: -1rem 2.5rem 0;
}
.usa-nav__secondary {
right: 7rem;
}
}
/*****************************************************************/
/*****************************************************************/
/*****************************************************************/
/* Breakpoint - Internet Explorer */
/*****************************************************************/
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
.sticky-active header.position-sticky {
position: fixed;
left: 0;
right: 0;
}
#search .usa-search button[type="submit"] {
z-index: 100;
}
.usa-header--basic .usa-navbar {
width: auto;
}
#search .usa-megamenu.usa-nav__submenu {
margin-right: -1px;
}
.usa-megamenu.usa-nav__submenu {
margin-right: 40px;
}
.sticky-active .usa-megamenu.usa-nav__submenu {
margin-left: -70px;
}
.usa-nav__primary > button,
.usa-nav__primary > .usa-nav__primary-item {
margin: 0 3.3rem;
}
.sticky-active .usa-nav__primary > button,
.sticky-active .usa-nav__primary > .usa-nav__primary-item {
margin: 0 2.4rem;
}
.usa-nav__secondary {
right: -2.2rem;
}
#search .usa-megamenu.usa-nav__submenu {
margin-left: 800px;
margin-right: -32px;
}
#search .usa-search input[type="search"] {
width: 100%;
}
.share a,
.share a:hover {
overflow: visible;
background: transparent;
}
}
@media all and (min-width: 1367px) and (-ms-high-contrast: none),
(-ms-high-contrast: active) {
#search .usa-search [role="search"] {
padding-left: 10px;
}
#search .usa-search p {
padding-right: 10px;
}
}
/* End Internet Explorer */
/*****************************************************************/
/*****************************************************************/
/*
Utilities
NOTE: this needs to be last in the file for utility classes to supercede other classes
*/
/* Bring back the scrollbar by default for chrome */
.custom-scrollbar ::-webkit-scrollbar {
-webkit-appearance: none;
border-radius: 4px;
background-color: #ededed;
width: 8px;
}
.custom-scrollbar ::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: #575656;
-webkit-box-shadow: 0 0 1px rgba(255, 255, 255, 0.5);
}
.absolute-center {
position: absolute;
left: 0;
right: 0;
margin: auto;
}
@media (min-width: 1024px) {
.desktop\:position-sticky {
-webkit-position: sticky;
position: sticky;
}
}
.flex-justify-between {
justify-content: space-between;
}
.disable-scrollbars *::-webkit-scrollbar {
width: 0;
height: 0;
background: transparent;
/* Chrome/Safari/Webkit */
}
.disable-scrollbars * {
scrollbar-width: none;
/* Firefox */
-ms-overflow-style: none;
/* IE 10+ */
}
.no-mouse-events {
pointer-events: none;
}
.text-prussian-blue,
.text-prussian-blue:visited,
.usa-form a:visited {
color: #003256;
}
@media (min-width: 640px) {
.tablet\:text-white {
color: #ffffff;
}
}
a.text-prussian-blue:hover,
a.text-prussian-blue:visited:hover {
color: #3163b6;
}
.text-base,
.text-base:visited {
color: #444343;
}
.text-yellow-metal {
color: #736539;
}
.text-gold {
color: #b7ac83;
}
.text-gray {
color: #939393;
}
a.text-white,
a.text-white:visited {
color: #ffffff;
}
a.text-white:hover,
a.text-white:visited:hover {
color: #b7ac83; /* was a48923 - TH */
}
.text-weight-600 {
font-weight: 600;
}
.text-spacing-1-71px {
/* 1.71 px*/
letter-spacing: 1.71px;
}
.text-lh-1 {
line-height: 1.8rem;
}
.fill-gold {
fill: #b7ac83;
}
.fill-blue {
fill: #013256;
}
.bg-gold-gradient {
background-image: linear-gradient(to right, white, #f7f7f3, white);
}
.bg-blue-gradient {
background-image: url("/assets/images/fdic-news-multimedia-bg.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.bg-prussian-blue {
background-color: #003256;
}
.bg-blue {
background-color: #003256;
}
@media (min-width: 640px) {
.tablet\:bg-blue {
background-color: #003256;
}
}
.bg-dark-blue {
background-color: #162237;
}
.bg-yellow {
background-color: #f9f8f5;
}
.bg-informed {
background-image: url("/assets/images/bg-informed.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.bg-eagle {
background-image: url("/assets/images/fdic-news-calendar-bg.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.bg-podium {
background-image: url("/assets/images/fdic-news-testimony-bg-top.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.bg-flag {
background-image: url("/assets/images/bg-flag.png");
background-position: top left;
background-repeat: no-repeat;
}
.bg-seal {
background-image: url("/assets/images/seal.png");
background-repeat: no-repeat;
background-position: 50% 45px;
}
.bg-supervisorytopics {
background-image: url("/assets/images/fdic-brc-supervisorytopics-bg.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.bg-spring-wood {
background-color: #f9f7f3;
}
.bg-gold {
background-color: #746639;
}
.border-rounded {
border-radius: 100%;
}
.border-white-40-percent {
border-color: #757b86;
}
.border-gray-nurse {
border-color: #e7e8e7;
}
.border-gold,
.tablet\:border-gold {
border-color: #c4bfad;
}
.border-dark-gold {
border-color: #b7ac83;
}
.outline-shadow-gold {
outline-color: #c4bfad;
}
.width-fit-content {
width: fit-content;
}
.margin-x-16px {
margin-left: 1rem;
margin-right: 1rem;
}
.margin-x-177px {
margin-left: 11.0625rem;
margin-right: 11.0625rem;
}
.margin-bottom-2 {
/* 8px */
margin-bottom: 0.5rem;
}
.margin-bottom-4 {
/* 27px */
margin-bottom: 1.6875rem;
}
/* .margin-bottom-4 {
margin-bottom: 1rem;
} */
.margin-bottom-5 {
/* 43px */
margin-bottom: 2.6875rem;
}
.text-capitalize {
text-transform: capitalize;
}
.width-281px,
.width-300px,
.width-192px {
width: 100%;
}
.width-200px {
min-width: 12.5rem;
}
.width-336px {
min-width: 21rem;
}
.height-142px {
/* 142px */
max-height: 8.875rem;
}
.height-302px {
max-height: 18.875rem;
}
.height-200px {
max-height: 12.5rem;
}
.height-380px {
height: 380px;
}
.maxh-380px {
max-height: 380px;
}
.top-68px {
/* top: 4.25rem; */
top: 3rem;
}
/* @media (min-width: 640px) and (max-width 1365px) {
.top-68px {
top: 3rem;
}
} */
@media (min-width: 1366px) {
.tablet\:top-94px {
top: 5.25rem;
}
}
.truncate {
/* hide text if it more than N lines */
overflow: hidden;
/* for set '...' in absolute position */
position: relative;
/* max-height = line-height (1.2) * lines max number (3) */
max-height: 4.6em;
/* fix problem when last visible word doesn't adjoin right side */
/* text-align: justify; */
/* place for '...' */
margin-right: -1em;
padding-right: 1em;
}
/* create the ... */
.truncate:before {
/* points in the end */
content: "...";
/* absolute position */
position: absolute;
/* set position to right bottom corner of block */
right: 0;
bottom: 0;
}
/* hide ... if we have text, which is less than or equal to max lines */
.truncate:after {
/* points in the end */
content: "";
/* absolute position */
position: absolute;
/* set position to right bottom corner of text */
right: 0;
/* set width and height */
width: 1em;
height: 1em;
margin-top: 0.2em;
/* bg color = bg color under block */
background: white;
}
/* new, brief update - need to have truncate on sliders, but slidersare auto made via javascript so adding truncate class more difficult - just blanket - 2/12/21 - TH */
.glider-track .card__content a.news-header {
/* hide text if it more than N lines */
overflow: hidden;
/* for set '...' in absolute position */
position: relative;
/* max-height = line-height (1.2) * lines max number (3) */
max-height: 4.6em;
/* fix problem when last visible word doesn't adjoin right side */
/* text-align: justify; */
/* place for '...' */
margin-right: -1em;
padding-right: 1em;
}
/* create the ... */
.glider-track .card__content a.news-header::before {
/* points in the end */
content: "...";
/* absolute position */
position: absolute;
/* set position to right bottom corner of block */
right: 0;
bottom: 0;
}
/* hide ... if we have text, which is less than or equal to max lines */
.glider-track .card__content a.news-header::after {
/* points in the end */
content: "";
/* absolute position */
position: absolute;
/* set position to right bottom corner of text */
right: 0;
/* set width and height */
width: 1em;
height: 1em;
margin-top: 0.2em;
/* bg color = bg color under block */
background: white;
}
.glider-track .card--inverse .card__content a.news-header::after {
background-color: #003256;
}
.podcast-grid {
display: -ms-grid;
display: grid;
-ms-grid-columns: repeat(2, 1fr);
-ms-grid-rows: 230px auto;
grid-template-columns: repeat(2, 1fr);
grid-template-rows: 230px auto;
}
@media (max-width: 1260px) {
.podcast-grid {
-ms-grid-rows: 260px auto;
grid-template-rows: 260px auto;
}
}
.podcast-grid .podcast-image {
-ms-grid-row: 1;
-ms-grid-column: 1;
grid-row-start: 1;
grid-row-end: 2;
grid-column: 1;
}
.podcast-grid .podcast-description {
-ms-grid-row: 1;
-ms-grid-row-span: 2;
-ms-grid-column: 2;
grid-row-start: 1;
grid-row-end: 2;
grid-column: 2;
}
.podcast-grid .podcast-items {
-ms-grid-row: 2;
-ms-grid-row-span: 1;
-ms-grid-column: 2;
grid-row-start: 2;
grid-row-end: 2;
grid-column: 2;
}
@media (max-width: 1160px) {
.podcast-grid {
-ms-grid-rows: auto;
grid-template-rows: auto;
}
.podcast-grid .podcast-items {
-ms-grid-row: 2;
-ms-grid-row-span: 1;
-ms-grid-column: 1;
-ms-grid-column-span: 2;
grid-row-start: 2;
grid-row-end: 2;
grid-column-start: 1;
grid-column-end: none;
}
}
@media (max-width: 1024px) {
.podcast-grid {
display: block;
}
.podcast-grid .podcast-image,
.podcast-grid .podcast-description,
.podcast-grid .podcast-items {
width: 100%;
}
}
/*
responsive utility helpers
*/
@media (min-width: 1280px) {
.vh1280\:display-none {
display: none;
}
}
/*
DataTable
*/
.dataTable--cards .dataTables-content-main {
/* display: -ms-flexbox;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between; */
display: grid;
grid-gap: 0;
grid-template-columns: repeat(auto-fit, minmax(281px, 1fr));
}
.dataTable--cards .dataTables-content-main > * {
margin: 0 auto;
}
.dataTable--cards .dataTables-content-main .width-281px {
/* this is breaking grid wrapping */
/* max-width: 100% !important; */
}
/* .dataTable--cards .dataTables-content-main>*:last-child {
margin: 0 4.6%;
} */
/* .dataTable--cards .dataTables-content-main:after {
content: '';
flex-grow: 1;
} */
.dataTable--cards {
width: 100%;
table-layout: fixed;
}
.dataTable--cards tbody {
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
width: 100%;
table-layout: fixed;
}
.dataTable--cards tbody tr {
display: -ms-flexbox;
display: flex;
}
.dataTable--cards tbody td {
display: -ms-flexbox;
display: flex;
}
.data-table--header {
display: -ms-flexbox;
display: flex;
align-items: center;
justify-content: space-between;
border-top: 1px solid #dcdcdc;
border-bottom: 1px solid #dcdcdc;
background: rgb(255, 255, 255);
background: radial-gradient(
circle,
rgba(248, 248, 245, 1) 0%,
rgba(255, 255, 255, 1) 100%
);
/* 7px 20px */
padding: 0.4375rem 1.25rem;
width: 100%;
max-width: 1324px;
}
/* IE sticky styles*/
.data-table--header.js-is-sticky {
margin-top: 84px;
}
select.border,
.data-table--header input,
.data-table--header select {
border: 1px solid #bebdbd;
}
.dataTables_info {
font-family: "Merriweather Web", Georgia, Cambria, Times New Roman, Times,
serif;
font-size: 0.875rem;
font-style: italic;
color: #746639;
min-width: 210px;
}
.data-table--content {
/* 32px */
margin-top: 2rem;
padding: 0 3rem;
}
/* Latest News Include fix to allow to use in header, latest news slider, and archive tile */
.data-table--content tr td .grid-col-3 {
display: flex;
width: 100%;
}
.data-table--footer {
display: -ms-flexbox;
display: flex;
justify-content: flex-end;
/* 16px 20px 32px */
margin: 1rem 1.25rem 2rem;
}
.dataTables_paginate {
}
a.paginate_button,
.paginate_button,
.paginate_button:visited {
font-family: "Merriweather Web", Georgia, Cambria, Times New Roman, Times,
serif;
font-size: 1rem;
font-weight: 100;
color: #746639;
text-decoration: none;
padding: 0 5px;
margin: 0 5px;
cursor: pointer;
}
.paginate_button:hover {
text-decoration: underline;
}
.paginate_button.first {
background-image: url("/assets/images/icon-first.svg");
background-position: left center;
background-repeat: no-repeat;
padding-left: 35px;
}
.paginate_button.last {
background-image: url("/assets/images/icon-last.svg");
background-position: right center;
background-repeat: no-repeat;
padding-right: 35px;
}
.paginate_button.current,
.paginate_button.current:hover {
color: #fff;
background-color: #7f7044;
text-decoration: none;
}
@media (min-width: 1024px) {
/* IE sticky styles */
.data-table--header.js-is-sticky {
margin-top: 80px;
width: calc(100% - 66px);
}
}
@media (max-width: 1024px) {
.data-table--header {
display: -ms-grid;
display: grid;
-ms-grid-columns: minmax(0, 1fr);
-ms-grid-rows: minmax(0, 1fr);
grid-template-columns: minmax(0, 1fr);
grid-template-rows: minmax(0, 1fr);
background: none;
border: none;
/* 7px 20px */
padding: 0;
background-color: #ffffff;
overflow: hidden;
justify-content: center;
}
/* IE sticky styles */
.data-table--header.js-is-sticky {
margin-top: 72px;
width: calc(100% - 96px);
}
.data-table--header.usa-form .usa-input,
.data-table--header.usa-form .usa-select {
width: 100%;
max-width: 100%;
}
.data-table--content {
/* 32px */
overflow-x: scroll;
margin-top: 0;
padding: 0;
}
.data-table--footer {
display: none;
}
.dataTables_info {
-ms-grid-row: 1;
-ms-grid-column: 1;
grid-row-start: 1;
grid-row-end: 1;
grid-column-start: 1;
grid-column-end: none;
text-align: center;
border-top: 1px solid #dcdcdc;
background: rgb(255, 255, 255);
background: radial-gradient(
circle,
rgba(248, 248, 245, 1) 0%,
rgba(255, 255, 255, 1) 100%
);
/* 20px 20px 10px */
padding: 1.25rem 1.25rem 0.625rem;
}
.dataTables_paginate {
-ms-grid-row: 2;
-ms-grid-column: 1;
grid-row-start: 2;
grid-row-end: 2;
grid-column-start: 1;
grid-column-end: none;
display: flex;
justify-content: center;
align-items: center;
border-bottom: 1px solid #dcdcdc;
background: rgb(255, 255, 255);
background: radial-gradient(
circle,
rgba(248, 248, 245, 1) 0%,
rgba(255, 255, 255, 1) 100%
);
/* 10px 20px 20px */
padding: 0.625rem 1.25rem 1.25rem;
}
.dataTables_filter {
-ms-grid-row: 3;
-ms-grid-column: 1;
grid-row-start: 3;
grid-row-end: 3;
grid-column-start: 1;
grid-column-end: none;
margin-top: 0.9375rem;
}
.dataTables_length {
-ms-grid-row: 4;
-ms-grid-column: 1;
grid-row-start: 4;
grid-row-end: 4;
grid-column-start: 1;
grid-column-end: none;
margin-top: 0.9375rem;
margin-bottom: 15px;
}
.dataTables-sidebar caption {
position: absolute;
z-index: 201;
display: block;
top: 0;
width: 100%;
}
.dataTables_info {
margin-top: 20px;
}
}
@media (max-width: 630px) {
a.paginate_button {
margin: 0;
}
/* IE sticky styles */
.data-table--header.js-is-sticky {
margin-top: 72px;
width: calc(100% - 32px);
}
}
@media (max-width: 480px) {
a.paginate_button {
margin: 0;
}
/* IE sticky styles */
.data-table--header.js-is-sticky {
margin-top: 72px;
width: calc(100% - 32px);
}
}
@media (min-width: 1024px) {
.dataTable.dataTables-sidebar {
display: -ms-grid;
display: grid;
/* 309px width for aside plus margin of 37 (roughly) */
-ms-grid-columns: 341px 1fr;
-ms-grid-rows: 50px 1fr;
grid-template-columns: 341px minmax(0, 1fr);
grid-template-rows: 50px minmax(0, 1fr);
}
/* .dataTables-sidebar tr {
display: grid;
grid-template-columns: 25% 15% 8% 10% 25% 17%;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
} */
.data-table--content {
overflow: hidden;
}
.data-table--content .dataTables-sidebar,
.data-table--content .dataTables-nosidebar {
padding-left: 0;
padding-right: 0;
}
.data-table--content {
padding-left: 0;
padding-right: 0;
}
.dataTables-content-header {
grid-row: 1;
grid-column: 2;
display: table;
table-layout: fixed;
width: 100%;
/* this needs to be the total of all min-widths below */
min-width: 850px;
}
.dataTables-sidebar .dataTables-content-main,
.dataTables-nosidebar .dataTables-content-main {
grid-row: 2;
grid-column: 2;
display: table;
table-layout: fixed;
width: 100%;
}
.dataTables-content-aside {
grid-row-start: 1;
grid-row-end: none;
grid-column: 1;
}
.dataTables-sidebar caption {
position: relative;
z-index: 0;
}
}
/******************************\
extra forgotten table option
\******************************/
/* PN didn't give us some options that we might need - like a sortable table that takes the entire width of the page */
@media (min-width: 1024px) {
.dataTable.dataTables-nosidebar {
display: -ms-grid;
display: grid;
/* 309px width for aside plus margin of 37 (roughly) */
-ms-grid-columns: 0 1fr;
-ms-grid-rows: 50px 1fr;
grid-template-columns: 0 minmax(0, 1fr);
grid-template-rows: 50px minmax(0, 1fr);
}
}
/*
This is a hack to get table headers to match
TODO: write a js script to do width calculations
*/
.dataTables-sidebar tr,
.dataTables-nosidebar tr {
display: table;
width: 100%;
min-width: 850px;
}
.dataTables-sidebar tr th:nth-of-type(1),
.dataTables-sidebar tr td:nth-of-type(1),
.dataTables-nosidebar tr th:nth-of-type(1),
.dataTables-nosidebar tr td:nth-of-type(1) {
width: 25%;
min-width: 201px;
}
.dataTables-sidebar tr th:nth-of-type(2),
.dataTables-sidebar tr td:nth-of-type(2),
.dataTables-nosidebar tr th:nth-of-type(2),
.dataTables-nosidebar tr td:nth-of-type(2) {
width: 15%;
min-width: 121px;
}
.dataTables-sidebar tr th:nth-of-type(3),
.dataTables-sidebar tr td:nth-of-type(3),
.dataTables-nosidebar tr th:nth-of-type(3),
.dataTables-nosidebar tr td:nth-of-type(3) {
width: 8%;
min-width: 65px;
}
.dataTables-sidebar tr th:nth-of-type(4),
.dataTables-sidebar tr td:nth-of-type(4),
.dataTables-nosidebar tr th:nth-of-type(4),
.dataTables-nosidebar tr td:nth-of-type(4) {
width: 10%;
min-width: 80px;
}
.dataTables-sidebar tr th:nth-of-type(5),
.dataTables-sidebar tr td:nth-of-type(5),
.dataTables-nosidebar tr th:nth-of-type(5),
.dataTables-nosidebar tr td:nth-of-type(5) {
width: 25%;
min-width: 201px;
}
.dataTables-sidebar tr th:nth-of-type(6),
.dataTables-sidebar tr td:nth-of-type(6),
.dataTables-nosidebar tr th:nth-of-type(6),
.dataTables-nosidebar tr td:nth-of-type(6) {
width: 17%;
min-width: 137px;
}
/* IE 11 */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
.dataTable.dataTables-sidebar,
.dataTable.dataTables-nosidebar {
table-layout: fixed;
}
.dataTables-content-aside {
display: -ms-inline-flexbox;
-ms-grid-row: 1;
-ms-grid-row-span: 2;
-ms-grid-column: 1;
}
.dataTables-content-header {
-ms-grid-row: 1;
-ms-grid-column: 2;
display: table;
table-layout: auto;
width: 100%;
}
.dataTables-sidebar .dataTables-content-main,
.dataTables-nosidebar .dataTables-content-main {
-ms-grid-row: 2;
-ms-grid-column: 2;
display: table;
table-layout: auto;
width: 100%;
}
}
.dataTables-sidebar > .dataTables-content-main tr,
.dataTables-nosidebar > .dataTables-content-main tr {
border-bottom: 1px solid;
border-left: 1px solid;
border-color: #c5c5c5;
}
.dataTables-sidebar td,
.dataTables-sidebar td a,
.dataTables-nosidebar td,
.dataTables-nosidebar td a {
font-weight: 400;
font-size: 0.8125rem;
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica,
Roboto, Arial, sans-serif;
color: #444343;
line-height: 1.6rem;
}
.dataTables-sidebar td,
.dataTables-nosidebar td{
padding-right: 0.5rem;
padding-left: 1rem;
padding-top: 0.8125rem;
padding-bottom: 0.5rem;
border-right: 1px solid;
border-color: #c5c5c5;
}
.dataTables-sidebar .dataTables-content-main tr:nth-child(even),
.dataTables-nosidebar .dataTables-content-main tr:nth-child(even) {
/* background: rgba(237, 234, 224, 0.03); */
background-color: #f9f8f5;
}
.dataTables-sidebar .dataTables-content-main tr:nth-child(odd),
.dataTables-nosidebar .dataTables-content-main tr:nth-child(odd) {
background-color: #fff;
}
.sorting p:after {
content: " ";
color: white;
display: inline-block;
width: 25px;
height: 10px;
background: url("/assets/images/icon-sort.png") no-repeat center;
}
.sorting_asc p:after {
content: " ";
color: white;
display: inline-block;
width: 25px;
height: 10px;
background: url("/assets/images/icon-sort-asc.png") no-repeat center;
}
.sorting_desc p:after {
content: " ";
color: white;
display: inline-block;
width: 25px;
height: 10px;
background: url("/assets/images/icon-sort-desc.png") no-repeat center;
}
.dataTables-content-aside {
-ms-grid-row: 1;
-ms-grid-column: 1;
grid-row-start: 1;
grid-row-end: none;
grid-column-start: 1;
grid-column-end: 1;
}
/**************************\
START Micromodal Styles
\**************************/
.modal__overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.72);
display: flex;
justify-content: center;
align-items: center;
z-index: 999999998;
}
.modal__container {
margin-top: 10px;
background-color: #fff;
max-width: 1080px;
height: auto;
border-radius: 0px;
box-sizing: border-box;
z-index: 999999999;
border: solid 5px #013256;
}
.modal__close {
background: none;
cursor: pointer;
border: 0;
}
i.fas.fa-times.text-base-dark {
font-size: 36px;
}
.modal__title {
line-height: 2.5625rem;
margin-left: 40px;
margin-right: 40px;
}
.modal__image {
display: block;
margin-left: auto;
margin-right: auto;
width: auto;
padding-left: 14px;
padding-right: 14px;
}
.modal__content {
line-height: 1.6875rem;
color: rgba(0, 0, 0, 0.8);
margin-top: 0rem;
margin-left: 40px;
margin-right: 40px;
}
/* 10.6 displays with a vertical resolution of 768 */
@media (max-height: 768px) {
.modal__image {
max-height: 240px;
}
}
/* Tablet Landscape */
@media (min-width: 640px) {
.modal__container {
max-width: 730px;
}
}
/* Tablet Portrait */
@media (min-width: 480px) {
}
/* Mobile */
@media (max-width: 480px) {
.modal__container {
margin-left: 15px;
margin-right: 15px;
}
.modal__title {
line-height: 1.15rem;
margin-top: 33px;
margin-right: 19px;
margin-left: 21px;
}
.modal__image {
width: auto;
padding-left: 14px;
padding-right: 14px;
}
.modal__content {
line-height: 1.3125rem;
margin-left: 14px;
margin-right: 14px;
}
}
/*
* hack for IE11 to get it to work because
* it doesn't like dipslay:flex;
*
* */
@media all and (-ms-high-contrast: none) {
.modal__overlay {
position: block;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.72);
display: block;
justify-content: center;
align-items: center;
z-index: 999999998;
}
.modal__container {
position: relative;
top: 0;
max-width: 1080px;
height: auto;
box-sizing: border-box;
margin-left: auto;
margin-right: auto;
}
}
/*
* hack for IE11 and 10.6" displays
* this will force the height of the image
* and bring the full modal into the screen
*
* */
@media (max-height: 768px) and (-ms-high-contrast: none) {
.modal__image {
max-height: 340px;
}
}
/****************************\
Micromodal Animation Sytle
\****************************/
@keyframes mmfadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes mmfadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes mmslideIn {
from {
transform: translateY(15%);
}
to {
transform: translateY(0);
}
}
@keyframes mmslideOut {
from {
transform: translateY(0);
}
to {
transform: translateY(-10%);
}
}
.micromodal-slide {
display: none;
}
.micromodal-slide.is-open {
display: block;
}
.micromodal-slide[aria-hidden="false"] .modal__overlay {
animation: mmfadeIn 0.3s cubic-bezier(0, 0, 0.2, 1);
}
.micromodal-slide[aria-hidden="false"] .modal__container {
animation: mmslideIn 0.3s cubic-bezier(0, 0, 0.2, 1);
}
.micromodal-slide[aria-hidden="true"] .modal__overlay {
animation: mmfadeOut 0.3s cubic-bezier(0, 0, 0.2, 1);
}
.micromodal-slide[aria-hidden="true"] .modal__container {
animation: mmslideOut 0.3s cubic-bezier(0, 0, 0.2, 1);
}
.micromodal-slide .modal__container,
.micromodal-slide .modal__overlay {
will-change: transform;
}
/****************************\
END Micromodal Styles
\****************************/
.fdic-table {
line-height: 1.5;
border-collapse: collapse;
border-spacing: 0;
margin: 1.25rem 0;
}
.fdic-table th,
.fdic-table td {
border-width: 1px;
border-color: #c5c5c5;
border-style: solid;
padding: 1rem;
}
.fdic-table-alt th,
.fdic-table-alt td {
border-width: 1px;
border-color: #c5c5c5;
border-style: solid;
padding: 1rem 0.5rem;
}
.fdic-table .border-left-0 {
border-left: 0 solid;
}
.fdic-table .border-right-0 {
border-right: 0 solid;
}
/* I thought this was in here 11/3 */
.fdic-table a {
color: #003256;
text-decoration: underline;
}
.fdic-table a:hover {
color: #3163b6;
}
/****************************\
Link cleanups for templates
\****************************/
/* this section is going to grow for awhile. We need to make sure links within the body of the pages don't need the
text-prussian-blue text-underline classes added each time someone adds a link. Since all links in the body article
will be this way, lets blanket it for now. This is being done after the press release and fil styles. 7/7. */
article[class*="desktop\:grid-col-"] a,
article[class*="desktop\:grid-col-"] a:visited { /* applies prussian blue and underline to all links within article area */
color: #003256;
text-decoration: underline;
}
article[class*="desktop\:grid-col-"] a:hover { /* applies blue and underline to all links within article area when hovered */
color: #3163b6;
}
/* so a new problem that needs to be corrected for - slider in articles */
article[class*="desktop\:grid-col-"] div.glider a,
article[class*="desktop\:grid-col-"] div.glider a:visited {
text-decoration: none;
}
article[class*="desktop\:grid-col-"] div.glider a:hover {
text-decoration: underline;
}
/* lists in pages all have spacing applied */
article[class*="desktop\:grid-col-"] ol,
article[class*="desktop\:grid-col-"] ul { /* adds the correct styles to ul and ol */
line-height: 1.6;
padding-left: 1.5rem;
}
article[class*="desktop\:grid-col-"] ul ol,
article[class*="desktop\:grid-col-"] ol ul,
article[class*="desktop\:grid-col-"] ul ul,
article[class*="desktop\:grid-col-"] ol ol { /* if there is some type of nested list combo, remove the second style */
list-style: initial;
}
article[class*="desktop\:grid-col-"] li {
margin-bottom: 1.5rem;
}
article[class*="desktop\:grid-col-"] ul ul > li,
article[class*="desktop\:grid-col-"] ul ol > li,
article[class*="desktop\:grid-col-"] ol ul > li,
article[class*="desktop\:grid-col-"] ol ol > li {
margin-bottom: 0;
}
/* the best laid plans.... */
/* ok, so if there's a section inside an article on a page, we need to fix that up. */
.page-standalone-content article[class*="desktop\grid-col-"] section[class*="bg-"] a,
.page-standalone-content article[class*="desktop\grid-col-"] section[class*="bg-"] a:visited { /* so, on standalone, in an article, if there's a section with a background - which is dark - and if it has a link... */
color: #ffffff;
text-underline: none;
}
.page-standalone-content article[class*="desktop\grid-col-"] section[class*="bg-"] a:hover {
color: #ffffff;
text-decoration: underline;
}
/****************************\
Link jump fix for header
\****************************/
/* for links that point to a spot inside a page (link.url/#inside_place), they jump to
the top of the browser. But our header being fixed in place, will obscure the link.
We need to move the link below the header. */
a[name]:not([href])::before { /* targets anchors with a name attribute and places before the element */
/* targets anchors with a name attribute and places before the element */
display: block; /* make a block */
content: " "; /* with nothing in it */
margin-top: -88px; /* make the top of it -88 pixels high (about the height of the nav bar) */
height: 88px; /* then make the block about the same height as the nav bar */
visibility: hidden; /* hide it, but retain the space it's using */
pointer-events: none; /* hide it from the mouse */
}
/****************************\
Link jump fix for header part 2
\****************************/
/* The lovely bit of code above didn't work with the speeches, so a new solution needed to be found. */
a[name][href]:target {
position: relative; /* when a link that has both a name and href is targeted, make it relative to where it is. Needed for next thing. */
}
a[name][href]:target sup::after { /* when a link with a name and href is targeted, the sup element within it needs the following after it. */
display: inline-block; /* make the after sup an inline-block */
content: " "; /* give it no content */
height: 100px; /* give that after sup content a height of 100px */
margin-top: -100px; /* and move the top up above it by the same amount */
border: 1px solid transparent; /* give it enough mass to move from the top */
}
/****************************\
Link jump fix for header part 3
\****************************/
/* Minor thing - let's make the superscripted number bold so it's visible. */
a[name][href] > sup {
font-weight: bold;
}
sup > a[href*="#"] { /* why? because sometimes we do things backwards */
font-weight: bold;
}
/****************************\
Link jump fix for header part 4
\****************************/
/* starting to think this might be a regular change as well. Some CFR pages with internal links need this */
a[name][id^="20"]:target {
position: relative; /* when a link that has both a name and id is targeted, make it relative to where it is. Needed for next thing. */
}
a[name][id^="20"]:target + span::after { /* when a link with a name and id is targeted, the span element after it needs the following after it. */
display: inline-block; /* make the after sup an inline-block */
content: " "; /* give it no content */
height: 200px; /* give that after sup content a height of 100px */
margin-top: -130px; /* and move the top up above it by the same amount */
border: 1px solid transparent; /* give it enough mass to move from the top */
}
/****************************\
text fix for mosaic
\****************************/
/* titles and text on the hero mosaic are white, which can't be seen on a light image.
This adds text shadow to the text so it can be seen. */
/*.card.card--hero .card__title,
.card.card--hero .card__description {
text-shadow: 1px 1px 3px #000000;
}*/
/****************************\
new video size
\****************************/
/* some videos just need to be a different size */
.video-container-half {
overflow: hidden;
position: relative;
width: 50%;
}
.video-container-half::after {
padding-top: 56.25%;
display: block;
content: "";
}
.video-container-half iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
/****************************\
new graphic size
\****************************/
/* some graphics just need to be a different size */
@media all and (min-width: 1024px) {
.desktop\:width-500px {
width: 500px;
}
.desktop\:width-600px {
width: 600px;
}
}
/****************************\
help page images
\****************************/
/* sometimes its just easier to find your own path in life. */
.helpflex {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
}
@media all and (max-width: 1024px) {
.helpflex {
flex-direction: column;
}
}
/****************************\
failed bank spacing
\****************************/
/* to make the template easier to add to, making a div to
surround paragraphs instead of making a paragraph with double
breaks in it because that defeats the concept */
.failed-bank div.padding-2.padding-top-0.tablet\:padding-top-2.margin-top-0.tablet\:margin-top-2 > p:first-child { /* this will only target pages with the .failed-bank class */
margin-top: 0;
}
.template-failed-bank .rcvrtable {
padding-bottom: 5px;
}
.template-failed-bank .rcvrtable tr > td:first-child {
vertical-align: top;
text-align: left;
}
.template-failed-bank .rcvrtable tr > td:last-child {
vertical-align: top;
text-align: left;
padding-left: 1em;
}
.template-failed-bank .rcvrtable tr > td > p {
margin-top: 0;
}
/****************************\
podcast image sizing
\****************************/
/* on the news page we have 3 podcast graphics from
three sources. We just want them to be the same
relative height. */
.podcast-description .display-flex a > img {
height: 44px;
}
/****************************\
printout fix
\****************************/
/* When people print out the pages, they don't want some things */
@media print {
header { /* you don't really need the header on a printout ... */
display: none;
}
main > div:first-child::before { /* ... but it should be branded */
display: block;
content: url('/assets/images/fdic-logo-dark.svg'); /* consider replacing with a .png file */
width: 10em;
height: 5em;
}
article > img {
page-break-inside: avoid;
}
aside.desktop\:grid-col-3 { /* you don't need the left side navigation on a printout ... */
display: none; /* well actually we do */
}
aside.desktop\:grid-col-3 > div:last-child {
/*page-break-before: always;*/
}
aside.desktop\:grid-col-3 > div:last-child a[aria-label="Learn More"] {
display: none;
}
footer.usa-footer { /* you don't need a footer on a printout */
display: none;
}
/* danger area */
div.grid-auto.text-yellow-metal > div.grid-row.flex-align-center { /*hopefully this only targets the share this line */
display: none;
}
main {
display: block;
overflow: visible !important;
}
}
/****************************\
footer links
\****************************/
/* the addition of links in the footer threw off some spacing. This attempts to fix that a bit. */
/* this counters something from uswds.css. p-l and p-r were 1.0rem. */
@media (min-width: 64em) {
.usa-footer__nav .grid-row.grid-gap > * {
padding-left: 1.5rem;
padding-right: 1.5rem;
}
}
/****************************\
press-release pages
\****************************/
/* the new template requires too much time. A CSS solution was found. 6/29 */
.page-press-release article.desktop\:grid-col-9 a,
.page-press-release article.desktop\:grid-col-9 a:visited,
.page-press-release aside a,
.page-press-release aside a:visited { /* applies prussian blue and underline to all links within press release article area */
color: #003256;
text-decoration: underline;
}
.page-press-release article.desktop\:grid-col-9 a:hover,
.page-press-release aside a:hover { /* applies blue and underline to all links within press release article area when hovered */
color: #3163b6;
}
.page-press-release article.desktop\:grid-col-9 ol,
.page-press-release article.desktop\:grid-col-9 ul { /* adds the correct styles to ul and ol */
line-height: 1.6;
padding-left: 1.5rem;
}
.page-press-release article.desktop\:grid-col-9 ul ol,
.page-press-release article.desktop\:grid-col-9 ol ul,
.page-press-release article.desktop\:grid-col-9 ul ul,
.page-press-release article.desktop\:grid-col-9 ol ol { /* if there is some type of nested list combo, remove the second style */
list-style: initial;
}
.page-press-release article.desktop\:grid-col-9 li {
margin-bottom: 1.5rem;
}
.page-press-release article.desktop\:grid-col-9 ul ul > li,
.page-press-release article.desktop\:grid-col-9 ul ol > li,
.page-press-release article.desktop\:grid-col-9 ol ul > li,
.page-press-release article.desktop\:grid-col-9 ol ol > li {
margin-bottom: 0;
}
.page-press-release .printro {
font-size: 1.125rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
color: #736539;
text-align: center;
font-weight: 300;
margin-bottom: 0;
margin-top: 0.5rem;
}
.page-press-release .prdate {
font-family: "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 1rem;
letter-spacing: 0.15em;
color: #444343;
}
.page-press-release .fir {
font-size: 1rem;
color: #003256;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
}
@media (min-width: 480px) {
.page-press-release .fir {
font-size: 1.125rem;
}
}
@media (min-width: 1024px) {
.page-press-release .printro {
font-size: 1.25rem;
}
}
/* hey, here's a brilliant thought - let's not worry about the h2 - if you have an attachment section, have it auto labelled - 7/21 swas */
.page-press-release div[class*="attachment"]::before { /* if you're in the press release page and in a div with a class that starts with "attachment", do this */
display: block;
color: #003256;
font-size: 1.125rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
margin-top: 1.5rem;
margin-bottom: 1.5rem;
font-weight: 500; /* was 100, but then "they" wanted all h2s to be font weight 500. 8/24/20 */
cursor: text; /* with this, it really looks like it's there */
}
.page-press-release div.attachment::before { /* if the div is called "attachment" the content for the declaration above is "Attachment:" */
content: "Attachment:"
}
.page-press-release div.attachments::before { /* if the div is called "attachments" the content for the declaration above is "Attachments:" */
content: "Attachments:"
}
/* but now if it's automatic, we'll have to get rid of the h2s that already exist */
.page-press-release div[class*="attachment"] h2 { /* for the attachments section, the h2 needs styles applied */
/*color: #003256;
margin-top: 2rem;
font-size: 1.125rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;*/
display: none;
}
.page-press-release div[class*="attachment"] a[href] {
display: inline-block;
min-height: 55px;
}
.page-press-release div[class*="attachment"] a[href]::before { /* apply to all link icons in attachments section */
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
line-height: 1;
color: #736539;
margin: 0px 26px 20px 0;
font-size: 1.46rem;
float: left;
}
.page-press-release div[class*="attachment"] a[href]::before { /* apply to all links to start with */
font-weight: 900;
content: "\f0c1"; /* the font awesome character for link */
}
.page-press-release div[class*="attachment"] a[href*=".pdf"]::before { /* use *= instead of $= */ /* if it's a pdf, apply the pdf icon */
font-weight: 400;
font-size: 2.2rem;
margin-right: 23px;
content: "\f1c1"; /* fa pdf char */
}
.page-press-release div[class*="attachment"] a[href*=".doc"]::before { /* use *= instead of $= */ /* if it's a word doc, apply the word icon */
font-weight: 400;
font-size: 2.2rem;
margin-right: 23px;
content: "\f1c2"; /* fa word char */
}
.page-press-release div[class*="attachment"] a[href*=".xls"]::before { /* use *= instead of $= */ /* if it's an excel file, apply the xls icon */
font-weight: 400;
font-size: 2.2rem;
margin-right: 23px;
content: "\f1c3"; /* fa xls char */
}
.page-press-release div[class*="attachment"] a[href*=".ppt"]::before { /* use *= instead of $= */ /* if it's a powerpoint file, apply the ppt icon */
font-weight: 400;
font-size: 2.2rem;
margin-right: 23px;
content: "\f1c4"; /* fa ppt char */
}
/* joint release side information agencies section */
.page-press-release #joint-release p { /* this is the font-sans-3xs class from custom.css line 448 applied to all <p> under #joint-release */
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: .875rem;
}
/* press release side information contacts section */
.page-press-release #media-contacts .contactinfo {
padding-top: 1rem;
padding-bottom: 1rem;
}
.page-press-release #media-contacts .contactinfo p {
font-size: 0.875rem;
margin: 0;
}
.page-press-release #media-contacts .contactinfo p.ciagency {
}
.page-press-release #media-contacts .contactinfo p.ciname {
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
padding-bottom: 0.25rem;
}
.page-press-release #media-contacts .contactinfo p.ciphone {
font-family: "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
}
.page-press-release #media-contacts .contactinfo p.ciphone::before {
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
line-height: 1;
color: #003256;
margin-right: 8px;
font-size: 1.05rem;
content: "\f879"; /* fa phone char */
font-weight: 900;
}
.page-press-release #media-contacts .contactinfo p.ciemail {
font-family: "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
}
.page-press-release #media-contacts .contactinfo p.ciemail::before {
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
line-height: 1;
color: #003256;
margin-right: 8px;
font-size: 1.05rem;
content: "\f0e0"; /* envelope */
font-weight: 900;
}
.page-press-release #media-contacts .contactinfo p.ciemail a { /* one of those after thoughts - TH - 4/30/21 */
display: inline;
}
.page-press-release #media-contacts .contactinfo p.ciweb {
font-family: "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
}
.page-press-release #media-contacts .contactinfo p.ciweb::before {
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
line-height: 1;
color: #003256;
margin-right: 8px;
font-size: 1.05rem;
content: "\f108"; /* monitor */
font-weight: 900;
}
.page-financial-institution-letter #media-contacts .contactinfo p.cifax,
.page-standalone-content #media-contacts .contactinfo p.cifax,
.page-press-release #media-contacts .contactinfo p.cifax { /* special request - TH - 5/5/21 */
font-family: "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
}
.page-financial-institution-letter #media-contacts .contactinfo p.cifax::before,
.page-standalone-content #media-contacts .contactinfo p.cifax::before,
.page-press-release #media-contacts .contactinfo p.cifax::before {
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
line-height: 1;
color: #003256;
margin-right: 8px;
font-size: 1.05rem;
content: "\f1ac"; /* fax */
font-weight: 900;
}
.page-press-release #media-contacts .contactinfo p.ciweb a { /* one of those after thoughts - TH - 4/30/21 */
display: inline;
}
.page-press-release #media-contacts .contactinfo + .contactinfo {
border-top: 1px solid #dfe1e2;
}
.page-press-release #media-contacts .contactinfo:last-child {
padding-bottom: 0;
}
.page-press-release #media-contacts .contactinfo:first-child {
padding-top: 0;
}
.page-press-release .prtitle h1 {
text-align: center;
font-size: 1.5625rem; /* this is from custom.css.414 (font-size-25px) */
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
color: #003256;
margin-top: 0.5rem; /* from uswds.css:58442 */
margin-bottom: 0;
max-width: 64rem;
margin-right: auto;
margin-left: auto;
}
@media (min-width: 1024px) {
.page-press-release .prtitle h1 {
font-size: 2.25rem; /* from custom.css:3010 (media resize for tablet:font-size-36px) */
}
}
@media (min-width: 40em) { /* is this the same size as 1024px? */
.page-press-release .prtitle h1 {
margin-top: 1rem;
}
}
.page-press-release .prtitle h1 + p { /*only target a p when it's next to an h1 in the prtitle div */
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-style: italic;
text-align: center;
margin-bottom: 0;
}
@media (min-width: 40em) {
.page-press-release .prtitle h1 + p {
font-size: 1rem;
padding-left: 5rem;
padding-right: 5rem;
}
}
@media (max-width: 1023px) and (min-width: 0px) {
.page-press-release .prtitle h1 + p {
font-size: 0.875rem;
}
}
/* the following are for the press release index page */
.page-press-release aside h3.prindex {
color: #003256; /* text-prussian-blue */
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif; /* font-family-serif */
line-height: 1.5; /* line-height-serif-4 */
margin-top: 0; /* margin-y-0 */
margin-bottom: 0;
font-size: 1.125rem; /* font-size-18px */
}
.page-press-release ul#press_releases li { /* stop showing the bullet before the month */
list-style-type: none;
}
.page-press-release ul#press_releases ul li { /* but do show the bullet before the pr - and make it a circle */
list-style-type: circle;
}
.page-press-release ul#press_releases ul > li {
margin-bottom: .5em;
line-height: 1.3;
}
.page-press-release ul#press_releases span.title {
/* line-height: 1.3; */
}
.page-press-release ul#press_releases span.title > a::before { /* put a space and a dash and a space separating the date and the pr title */
content: " - ";
}
.page-press-release aside #cse-search-box-form-id2 input[type="text"],
#cse-search-box-form-id2 input[type="text"] { /* this will keep the search press release text box from going beyond the box */ /* need to target the text box on non PN templates */
max-width: 100%;
outline: none; /* this was in the left nav code as an inline style. I don't agree with having this but I want inline styles less. */
}
.page-press-release .prindexyears,
.prindexyears { /* the years list needs to be split into two columns */ /*also just targeting .prindexyears to fix the non PN templates */
column-count: 2;
column-width: 50%; /* this might not be able to accept percentages */
}
.page-press-release #GD-snippet-form input.rightnavtextbox,
#GD-snippet-form input.rightnavtextbox { /* this will keep the email signup text box from going beyond the box */ /* need to target the text box on non PN templates */
max-width: 100%;
}
/****************************\
FIL pages
\****************************/
/* the new template requires too much time. A CSS solution was found. 7/2 */
.page-financial-institution-letter article.desktop\:grid-col-9 a,
.page-financial-institution-letter article.desktop\:grid-col-9 a:visited,
.page-financial-institution-letter #media-contacts .contactinfo a,
.page-financial-institution-letter #media-contacts .contactinfo a:visited,
.page-standalone-content #media-contacts .contactinfo a,
.page-standalone-content #media-contacts .contactinfo a:visited { /* applies prussian blue and underline to all links within fil article area (and standalone template with contact) */
color: #003256;
text-decoration: underline;
}
.page-financial-institution-letter article.desktop\:grid-col-9 a:hover,
.page-financial-institution-letter #media-contacts .contactinfo a:hover,
.page-standalone-content #media-contacts .contactinfo a:hover { /* applies blue and underline to all links within press release article area when hovered */
color: #3163b6;
}
.page-standalone-content article.desktop\:grid-col-9 ol,
.page-standalone-content article.desktop\:grid-col-9 ul,
.page-financial-institution-letter article.desktop\:grid-col-9 ol,
.page-financial-institution-letter article.desktop\:grid-col-9 ul { /* adds the correct styles to ul and ol */
line-height: 1.6;
padding-left: 1.5rem;
}
.page-standalone-content article.desktop\:grid-col-9 ul ol,
.page-standalone-content article.desktop\:grid-col-9 ol ul,
.page-standalone-content article.desktop\:grid-col-9 ul ul,
.page-standalone-content article.desktop\:grid-col-9 ol ol,
.page-financial-institution-letter article.desktop\:grid-col-9 ul ol,
.page-financial-institution-letter article.desktop\:grid-col-9 ol ul,
.page-financial-institution-letter article.desktop\:grid-col-9 ul ul,
.page-financial-institution-letter article.desktop\:grid-col-9 ol ol { /* if there is some type of nested list combo, remove the second style */
list-style: initial;
}
.page-standalone-content article.desktop\:grid-col-9 li,
.page-financial-institution-letter article.desktop\:grid-col-9 li {
margin-bottom: 1.5rem;
}
.page-standalone-content article.desktop\:grid-col-9 ul ul > li,
.page-standalone-content article.desktop\:grid-col-9 ul ol > li,
.page-standalone-content article.desktop\:grid-col-9 ol ul > li,
.page-standalone-content article.desktop\:grid-col-9 ol ol > li,
.page-financial-institution-letter article.desktop\:grid-col-9 ul ul > li,
.page-financial-institution-letter article.desktop\:grid-col-9 ul ol > li,
.page-financial-institution-letter article.desktop\:grid-col-9 ol ul > li,
.page-financial-institution-letter article.desktop\:grid-col-9 ol ol > li {
margin-bottom: 0;
}
.page-financial-institution-letter article.desktop\:grid-col-9 h2 { /* the h2 needs styles applied */
color: #003256;
margin-top: 2rem;
font-size: 1.125rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
}
.page-financial-institution-letter .filintro {
font-size: 1.125rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
color: #736539;
text-align: center;
font-weight: 300;
margin-bottom: 0;
margin-top: 0.5rem;
}
@media (min-width: 1024px) {
.page-financial-institution-letter .filintro {
font-size: 1.25rem;
}
}
.page-financial-institution-letter .fildate,
.page-financial-institution-letter .filnum {
font-family: "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 1rem;
letter-spacing: 0.15em;
color: #444343;
}
/* hey, here's a brilliant thought - let's not worry about the h2 - if you have an attachment section, have it auto labelled - 7/21 swas */
.page-financial-institution-letter div[class*="attachment"]::before { /* if you're in the press release page and in a div with a class that starts with "attachment", do this */
display: block;
color: #003256;
font-size: 1.125rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
margin-top: 1.5rem;
margin-bottom: 1.5rem;
font-weight: 500; /* was 100, but then "they" wanted all h2s to be font weight 500. 8/24/20 */
cursor: text;
}
.page-financial-institution-letter div.attachment::before { /* if the div is called "attachment" the content for the declaration above is "Attachment:" */
content: "Attachment:"
}
.page-financial-institution-letter div.attachments::before { /* if the div is called "attachments" the content for the declaration above is "Attachments:" */
content: "Attachments:"
}
/* but now if it's automatic, we'll have to get rid of the h2s that already exist */
.page-financial-institution-letter div[class*="attachment"] h2 { /* for the attachments section, the h2 needs styles applied */
/*color: #003256;
margin-top: 2rem;
font-size: 1.125rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;*/
display: none;
}
.page-financial-institution-letter div[class*="attachment"] a[href] {
display: inline-block;
min-height: 55px;
}
.page-financial-institution-letter div[class*="attachment"] a[href]::before { /* apply to all link icons in attachments section */
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
line-height: 1;
color: #736539;
margin: 0px 26px 20px 0;
font-size: 1.46rem;
float: left;
}
.page-financial-institution-letter div[class*="attachment"] a[href]::before { /* apply to all links to start with */
font-weight: 900;
content: "\f0c1"; /* the font awesome character for link */
}
.page-financial-institution-letter div[class*="attachment"] a[href*=".pdf"]::before { /* use *= instead of $= */ /* if it's a pdf, apply the pdf icon */
font-weight: 400;
font-size: 2.2rem;
margin-right: 23px;
content: "\f1c1"; /* fa pdf char */
}
.page-financial-institution-letter div[class*="attachment"] a[href*=".doc"]::before { /* use *= instead of $= */ /* if it's a word doc, apply the word icon */
font-weight: 400;
font-size: 2.2rem;
margin-right: 23px;
content: "\f1c2"; /* fa word char */
}
.page-financial-institution-letter div[class*="attachment"] a[href*=".xls"]::before { /* use *= instead of $= */ /* if it's an excel file, apply the xls icon */
font-weight: 400;
font-size: 2.2rem;
margin-right: 23px;
content: "\f1c3"; /* fa xls char */
}
.page-financial-institution-letter div[class*="attachment"] a[href*=".ppt"]::before { /* use *= instead of $= */ /* if it's a powerpoint file, apply the ppt icon */
font-weight: 400;
font-size: 2.2rem;
margin-right: 23px;
content: "\f1c4"; /* fa ppt char */
}
/* joint release side information agencies section */
.page-financial-institution-letter #joint-release p { /* this is the font-sans-3xs class from custom.css line 448 applied to all <p> under #joint-release */
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: .875rem;
}
/* side information contacts section */
.page-financial-institution-letter #media-contacts .contactinfo,
.page-standalone-content #media-contacts .contactinfo {
padding-top: 1rem;
padding-bottom: 1rem;
}
.page-financial-institution-letter #media-contacts .contactinfo p,
.page-standalone-content #media-contacts .contactinfo p {
font-size: 0.875rem;
margin: 0;
}
.page-financial-institution-letter #media-contacts .contactinfo p.ciagency,
.page-standalone-content #media-contacts .contactinfo p.ciagency {
}
.page-financial-institution-letter #media-contacts .contactinfo p.ciname,
.page-standalone-content #media-contacts .contactinfo p.ciname {
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
padding-bottom: 0.25rem;
}
.page-financial-institution-letter #media-contacts .contactinfo p.ciphone,
.page-standalone-content #media-contacts .contactinfo p.ciphone {
font-family: "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
}
.page-financial-institution-letter #media-contacts .contactinfo p.ciphone::before,
.page-standalone-content #media-contacts .contactinfo p.ciphone::before {
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
line-height: 1;
color: #003256;
margin-right: 8px;
font-size: 1.05rem;
content: "\f879"; /* phone */
font-weight: 900;
}
.page-financial-institution-letter #media-contacts .contactinfo p.ciemail,
.page-standalone-content #media-contacts .contactinfo p.ciemail {
font-family: "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
}
.page-financial-institution-letter #media-contacts .contactinfo p.ciemail::before,
.page-standalone-content #media-contacts .contactinfo p.ciemail::before {
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
line-height: 1;
color: #003256;
margin-right: 8px;
font-size: 1.05rem;
content: "\f0e0"; /* envelope */
font-weight: 900;
}
.page-financial-institution-letter #media-contacts .contactinfo p.ciemail a,
.page-standalone-content #media-contacts .contactinfo p.ciemail a { /* one of those after thoughts - TH 4/30/21 */
display: inline;
}
.page-financial-institution-letter #media-contacts .contactinfo + .contactinfo,
.page-standalone-content #media-contacts .contactinfo + .contactinfo {
border-top: 1px solid #dfe1e2;
}
.page-financial-institution-letter #media-contacts .contactinfo:last-child,
.page-standalone-content #media-contacts .contactinfo:last-child {
padding-bottom: 0;
}
.page-financial-institution-letter #media-contacts .contactinfo:first-child,
.page-standalone-content #media-contacts .contactinfo:first-child {
padding-top: 0;
}
.page-financial-institution-letter #notes a,
.page-financial-institution-letter #notes a:visited {
color: #003256;
text-decoration: underline;
font-size: 0.875rem;
}
.page-financial-institution-letter #notes a:hover {
color: #3163b6;
}
.page-financial-institution-letter .filtitle h1 {
text-align: center;
font-size: 1.5625rem; /* this is from custom.css.414 (font-size-25px) */
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
color: #003256;
margin-top: 0.5rem; /* from uswds.css:58442 */
margin-bottom: 0;
/*max-width: 64rem;*/
margin-right: auto;
margin-left: auto;
}
@media (min-width: 1024px) {
.page-financial-institution-letter .filtitle h1 {
font-size: 2.25rem; /* from custom.css:3010 (media resize for tablet:font-size-36px) */
}
}
@media (min-width: 40em) { /* is this the same size as 1024px? */
.page-financial-institution-letter .filtitle h1 {
margin-top: 1rem;
}
}
.page-financial-institution-letter .filtitle h1 + p { /*only target a p when it's next to an h1 in the prtitle div */
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-style: italic;
text-align: center;
margin-bottom: 0;
}
@media (min-width: 40em) {
.page-financial-institution-letter .filtitle h1 + p {
font-size: 1rem;
padding-left: 5rem;
padding-right: 5rem;
}
}
@media (max-width: 1023px) and (min-width: 0px) {
.page-financial-institution-letter .filtitle h1 + p {
font-size: 0.875rem;
}
}
.addendum {
border-top: 1px solid #979797;
margin-top: 1.5rem;
padding-top: 1rem;
}
.addendum h2 {
font-size: 1rem;
color: #003256;
line-height: 1.3;
}
@media (min-width: 480px) {
.addendum h2 {
font-size: 1.5rem;
}
}
.addendum .addendumdate {
padding-top: 1rem;
display: flex;
flex-wrap: wrap;
color: #444343;
font-size: 1rem;
letter-spacing: 0.15em;
}
@media (min-width: 40em) {
.addendum .addendumdate {
padding: .75rem 0;
}
}
@media print { /* any addendum of a FIL will start on a new page */
.addendum {
page-break-before: always;
border-top: none;
padding-top: 0;
margin-top: 0;
}
.addendum::before { /* ... but it should be branded */
display: block;
content: url('/assets/images/fdic-logo-dark.svg'); /* consider using a png file */
width: 10em;
height: 5em;
}
}
/****************************\
more pages
\****************************/
/* on the offhand chance pages beyond PRs and FILs need the attachments */
/* hey, here's a brilliant thought - let's not worry about the h2 - if you have an attachment section, have it auto labelled - 7/21 swas */
article[class*="desktop\:grid-col-"] div[class*="attachment"]::before { /* if you're in the press release page and in a div with a class that starts with "attachment", do this */
display: block;
color: #003256;
font-size: 1.125rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
margin-top: 1.5rem;
margin-bottom: 1.5rem;
font-weight: 500; /* was 100, but then "they" wanted all h2s to be font weight 500. 8/24/20 */
cursor: text;
}
article[class*="desktop\:grid-col-"] div.attachment::before { /* if the div is called "attachment" the content for the declaration above is "Attachment:" */
content: "Attachment:"
}
article[class*="desktop\:grid-col-"] div.attachments::before { /* if the div is called "attachments" the content for the declaration above is "Attachments:" */
content: "Attachments:"
}
/* but now if it's automatic, we'll have to get rid of the h2s that already exist */
article[class*="desktop\:grid-col-"] div[class*="attachment"] h2 { /* for the attachments section, the h2 needs styles applied */
/*color: #003256;
margin-top: 2rem;
font-size: 1.125rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;*/
display: none;
}
article[class*="desktop\:grid-col-"] div[class*="attachment"] a[href],
div[class="dpattachment"] a[href] { /* the dp in dpattachment stands for "don't print" */
display: inline-block;
min-height: 55px;
}
article[class*="desktop\:grid-col-"] div[class*="attachment"] a[href]::before,
div[class="dpattachment"] a[href]::before { /* apply to all link icons in attachments section */
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
line-height: 1;
color: #736539;
margin: 0px 26px 20px 0;
font-size: 1.46rem;
float: left;
}
article[class*="desktop\:grid-col-"] div[class*="attachment"] a[href]::before,
div[class="dpattachment"] a[href]::before { /* apply to all links to start with */
font-weight: 900;
content: "\f0c1"; /* the font awesome character for link */
}
article[class*="desktop\:grid-col-"] div[class*="attachment"] a[href*=".pdf"]::before,
div[class="dpattachment"] a[href*=".pdf"]::before { /* use *= instead of $= */ /* if it's a pdf, apply the pdf icon */
font-weight: 400;
font-size: 2.2rem;
margin-right: 23px;
content: "\f1c1"; /* fa pdf char */
}
article[class*="desktop\:grid-col-"] div[class*="attachment"] a[href*=".doc"]::before,
div[class="dpattachment"] a[href*=".doc"]::before { /* use *= instead of $= */ /* if it's a word doc, apply the word icon */
font-weight: 400;
font-size: 2.2rem;
margin-right: 23px;
content: "\f1c2"; /* fa word char */
}
article[class*="desktop\:grid-col-"] div[class*="attachment"] a[href*=".xls"]::before,
div[class="dpattachment"] a[href*=".xls"]::before { /* use *= instead of $= */ /* if it's an excel file, apply the xls icon */
font-weight: 400;
font-size: 2.2rem;
margin-right: 23px;
content: "\f1c3"; /* fa xls char */
}
article[class*="desktop\:grid-col-"] div[class*="attachment"] a[href*=".ppt"]::before,
div[class="dpattachment"] a[href*=".ppt"]::before { /* use *= instead of $= */ /* if it's a powerpoint file, apply the ppt icon */
font-weight: 400;
font-size: 2.2rem;
margin-right: 23px;
content: "\f1c4"; /* fa ppt char */
}
/* ok, so what happens if we want an attachment section (with attachment icons) but don't want it to say attachment(s)? We make a new changes to custom.css. Of course. 12/18 */
/* call it dpattachment - for don't print attachment */
/* also, if we want "micro" icons before links in particular situations, lets use similar code for similar situations, but not use <i> since that's not what <i> is for. 12/23 */
.pdficon {
margin-left: 3px;
}
.pdficon::before {
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
/*line-height: 1;*/
color: #736539;
margin: 0px 3px 0 0;
/*font-size: 1.46rem;*/
/*float: left;*/
font-weight: 400;
/*font-size: 2.2rem;*/
content: "\f1c1"; /* fa pdf char */
}
.pdficonright { /* new option - TH - 5/7/21 */
margin-left: 0;
}
.pdficonright::after {
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
/*line-height: 1;*/
color: #736539;
margin-left: 3px;
/*font-size: 1.46rem;*/
/*float: left;*/
font-weight: 400;
/*font-size: 2.2rem;*/
content: "\f1c1"; /* fa pdf char */
}
.linkicon {
margin-left: 3px;
}
.linkicon::before {
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
/*line-height: 1;*/
color: #736539;
margin: 0px 3px 0 0;
/*font-size: 1.46rem;*/
/*float: left;*/
font-weight: 900;
content: "\f0c1"; /* the font awesome character for link */
}
.linkiconright {
margin-left: 0;
}
.linkiconright::after {
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
/*line-height: 1;*/
color: #736539;
margin-left: 3px;
/*font-size: 1.46rem;*/
/*float: left;*/
font-weight: 900;
content: "\f0c1"; /* the font awesome character for link */
}
/* so we should have a word and xls icon to go with these - TH - 5/4/21 */
.mswordicon {
margin-left: 3px;
}
.mswordicon::before {
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
/*line-height: 1;*/
color: #736539;
margin: 0px 3px 0 0;
/*font-size: 1.46rem;*/
/*float: left;*/
font-weight: 400;
/*font-size: 2.2rem;*/
content: "\f1c2"; /* the font awesome character for doc */
}
.mswordiconright {
margin-left: 0;
}
.mswordiconright::after {
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
/*line-height: 1;*/
color: #736539;
margin-left: 3px;
/*font-size: 1.46rem;*/
/*float: left;*/
font-weight: 400;
/*font-size: 2.2rem;*/
content: "\f1c2"; /* the font awesome character for doc */
}
.excelicon {
margin-left: 3px;
}
.excelicon::before {
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
/*line-height: 1;*/
color: #736539;
margin: 0px 3px 0 0;
/*font-size: 1.46rem;*/
/*float: left;*/
font-weight: 400;
/*font-size: 2.2rem;*/
content: "\f1c3"; /* the font awesome character for xls */
}
.exceliconright {
margin-left: 0;
}
.exceliconright::after {
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
/*line-height: 1;*/
color: #736539;
margin-left: 3px;
/*font-size: 1.46rem;*/
/*float: left;*/
font-weight: 400;
/*font-size: 2.2rem;*/
content: "\f1c3"; /* the font awesome character for xls */
}
/****************************\
SRAC indices tables
\****************************/
/* SRAC index pages start with tables. A request came in to have the date column (first column) to have more room instead of auto sizing. 1/27/21 TH */
.sracindex table.fdic-table.width-full:first-child tbody tr td:first-child {
white-space: nowrap;
}
/* and now something that might make 508 team take notice */
.sracindex table.fdic-table.width-full:first-child tbody tr td:nth-child(2) a {
text-decoration: none;
}
.sracindex table.fdic-table.width-full:first-child tbody tr td:nth-child(2) a:hover {
text-decoration: underline;
}
/****************************\
508 skipheader fix
\****************************/
/* a problem was discovered on old pages with the new header that caused a 508 error. This fix made by JB. */
a.skipheader, a#after-header
{
position:absolute;
display:block;
width:1px;
height:1px;
overflow:hidden;
}
/****************************\
speech landing table
\****************************/
/* due to how tables are formed, there is a small gap on the speech landing page. No one would notice. */
@media (min-width: 64em) {
article[class*="desktop\:grid-col-"] > table.fdic-table.full-width:first-child {
margin-top: 0;
}
}
/****************************\
speech pages
\****************************/
/* bringing in styles for speeches */
/*@media (min-width: 0) and (max-width: 1023px) { *//* in mobile mode, make sure any urls in the footnotes break so that the page doesn't go beyond the viewport */
/* It turns out it is possible that we might have a footnote that overspans the entire page in desktop. I thought that would only happen with mobile. Removed mobile only. 12/18 */
.page-standalone-content article div[id^="ftn"] a,
.page-speeches article div[id^="ftn"] a { /* and of course not all speeches have their own .page-speeches class on the body, some have .page-standalone-content */
word-break: break-all;
}
/*}*/
/****************************\
standalone template
\****************************/
/* bringing in styles for standalone template to remove extra code */
.page-topic .dateholder,
.page-forms .dateholder,
.page-standalone-content .dateholder,
.page-resources-di .dateholder,
.page-standalone-category {
position: relative;
width: 100%;
box-sizing: border-box;
flex: 1 0 0;
max-width: 100%;
padding-bottom: 1rem;
}
.page-topic .date,
.page-forms .date,
.page-standalone-content .date,
.page-resources-di .date,
.page-standalone-category .date {
font-family: "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
color: #444343;
font-size: 1rem;
letter-spacing: 0.15rem;
}
/* gathering place for "category" */
.page-standalone-content .maincategory,
.page-forms .maincategory,
.page-topic .maincategory,
.page-general-content-data .gcwdcategory,
.page-general-content-video .gcwdcategory,
.page-archive-tile-video .vidcategory,
.page-archive-list .palcategory,
.page-resources-di .maincategory,
.page-standalone-category .maincategory {
color: #736539;
line-height: 1.6rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
font-weight: 300;
margin-top: 0;
margin-bottom: 0;
text-align: center;
font-size: 1.25rem;
/* margin: 0; *//* potentially better */
}
.page-standalone-content h1.maintitle,
.page-forms h1.maintitle,
.page-topic h1.maintitle,
.page-resources-di .maintitle,
.page-standalone-category h1.maintitle {
color: #003256;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
text-align: center;
margin-top: 0.5rem;
margin-bottom: 0;
font-size: 1.5625rem;
font-weight: 100;
}
.page-standalone-content h1.maintitle + p,
.page-standalone-category h1.maintitle + p { /*only target a p when it's next to an h1.maintitle */
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-style: italic;
text-align: center;
margin-bottom: 0;
}
@media (min-width: 40em) {
.page-standalone-category h1.maintitle + p,
.page-standalone-content h1.maintitle + p {
font-size: 1rem;
padding-left: 5rem;
padding-right: 5rem;
}
}
@media (max-width: 1023px) and (min-width: 0px) {
.page-standalone-category h1.maintitle + p,
.page-standalone-content h1.maintitle + p {
font-size: 0.875rem;
}
}
article[class*="desktop\:grid-col-"] h2 { /* a request came in to change all H2s (within articles) and add an extra 32px to the top of them. 10/8/20 */
margin-top: 2.5rem;
}
.page-standalone-category article[class*="desktop\:grid-col-"] h2,
.page-standalone-content article[class*="desktop\:grid-col-"] h2 {
color: #003256;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
font-size: 1.125rem;
width: 100%;
clear: both;
}
.page-standalone-category h2.sectiontitle,
.page-standalone-content h2.sectiontitle {
margin-top: 2rem;
}
.page-standalone-category .imageholder,
.page-standalone-content .imageholder {
margin-bottom: 2rem;
float: right;
padding-left: 0;
padding-right: 0;
}
.page-standalone-category .imageholder .image,
.page-standalone-content .imageholder .image {
float: right;
width: 100%;
padding-top: 1rem;
}
.page-standalone-category .quoteholder,
.page-standalone-content .quoteholder,
.page-category .quoteholder { /*base */
border-top: 3px solid #003256;
border-bottom: 3px solid #003256;
color: #003256;
padding: 0.5rem;
font-style: italic;
font-weight: 500;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
line-height: 1.5;
font-size: 1.3rem; /* request to make quote size 30% bigger than standard. Standard is 16px which is 1rem. Therefore 1.3rem is 30% bigger. */
clear: both;
text-align: center;
}
.page-category .quoteholder { /* cv page also has a quote, but this has paragraphs so it needs to be this way or the border bars will act weirdly. Or I could try to do it differently. */
/*border-top: 3px solid #003256;
border-bottom: 3px solid #003256; */
}
.page-category .quoteholder p {
/*color: #003256;
padding: 0.5rem;
font-style: italic;
font-weight: 500;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
line-height: 1.5;
font-size: 1.3rem;*/ /* request to make quote size 30% bigger than standard. Standard is 16px which is 1rem. Therefore 1.3rem is 30% bigger. */
/*clear: both;
text-align: center;*/
}
@media (min-width: 1024px) { /*desktop*/
.page-standalone-category .quoteholder,
.page-standalone-content .quoteholder,
.page-category .quoteholder {
margin: 1.5rem 0 ;
}
}
@media (max-width: 1023px) and (min-width: 0px) { /*mobile*/
.page-standalone-category .quoteholder,
.page-standalone-content .quoteholder,
.page-category .quoteholder {
width: 100%;
float: none;
margin: 2rem 0;
}
}
.page-standalone-category .quotemaker,
.page-standalone-content .quotemaker,
.page-category .quotemaker {
font-size: 1.2rem;
}
/* leftsidemenu is for the leftside - more than just the navigation - this also impacts the about FDIC and any additional boxes for leftside */
aside.leftsidemenu {
order: 0;
position: relative;
flex: 1 0 0 ;
max-width: 100%;
margin-left: 1rem;
margin-right: 1rem;
margin-top: 1.5rem;
margin-bottom: 0;
}
aside.leftsidemenu a,
aside.leftsidemenu a:visited {
color: #003256;
text-decoration: none;
}
aside.leftsidemenu a:hover {
color: #3163b6;
}
aside.leftsidemenu .leftsideimagebox { /* because sometimes we need a new image box promo thing */
display: none; /* why? because this will be what happens when it's in mobile mode */
border: 1px solid #dfe1e2;
}
aside.leftsidemenu .leftsideimagebox .ibimage {
margin-left: auto;
margin-right: auto;
width: 100%;
}
aside.leftsidemenu h3.adtitle {
color: #003256;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
line-height: 1.5;
font-size: 1.125rem;
margin-bottom: 0;
}
aside.leftsidemenu p.adtext {
margin-top: 0.5rem;
font-size: 0.875rem;
}
aside .promobox { /* some pages might want a promo box */
border: 1px solid #dfe1e2;
margin-bottom: 0.5rem;
}
aside .promobox h3.promotitle {
font-size: 1.25rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
font-weight: 100;
color: #003256;
margin-top: 1rem;
margin-bottom: 0.5rem;
}
aside .promobox p.promotext {
font-size: 0.875rem;
margin-top: 0.5rem;
}
aside .promobox p a,
aside .promobox p a:visited {
color: #003256;
text-decoration: underline;
}
aside .promobox p a:hover {
color: #3163b6;
}
@media (min-width: 64em) {
aside.leftsidemenu {
order: 2;
-webkit-box-flex: 0;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
width: 25%;
margin-left: 0;
margin-right: 0;
margin-top: 0;
margin-bottom: 2rem
}
aside.leftsidemenu .leftsideimagebox {
display: block; /* because we do want this seen when it's bigger */
}
}
@media (max-width: 1023px) and (min-width: 0) { /* mobile */
aside .promobox {
margin-bottom: 1rem;
}
aside .promobox h3.promotitle {
text-align: center;
}
aside .promobox p.promotext {
text-align: center;
}
}
@media (min-width: 40em) { /* tablet */
.page-topic .dateholder,
.page-forms .dateholder,
.page-standalone-content .dateholder,
.page-resources-di .dateholder,
.page-standalone-category .dateholder {
flex: 1 0 0;
width: auto;
max-width: 100%;
padding-top: 0;
padding-bottom: 0;
}
.page-topic h1.maintitle,
.page-standalone-content h1.maintitle,
.page-forms h1.maintitle,
.page-resources-di h1.maintitle,
.page-standalone-category h1.maintitle {
margin-top: 1rem;
}
aside .promobox h3.promotitle {
text-align: left;
}
aside .promobox p.promotext {
text-align: left;
}
}
@media (min-width: 64em) {
.page-standalone-category .imageholder,
.page-standalone-content .imageholder {
flex: 1 0 0;
width: auto;
max-width: 100%;
margin-bottom: 1.6875rem;
}
.page-standalone-category .imageholder .image,
.page-standalone-content .imageholder .image {
margin-top: 1.5rem;
}
}
@media (min-width: 1024px) {
.page-standalone-category .maincategory,
.page-standalone-content .maincategory,
.page-forms .maincategory,
.page-topic .maincategory,
.page-general-content-data .gcwdcategory,
.page-general-content-video .gcwdcategory,
.page-archive-tile-video .vidcategory,
.page-archive-list .palcategory,
.page-resources-di .maincategory {
font-size: 1.25rem;
}
.page-standalone-category h1.maintitle,
.page-standalone-content h1.maintitle,
.page-forms h1.maintitle,
.page-topic h1.maintitle,
.page-resources-di h1.maintitle {
font-size: 2.25rem;
}
.page-standalone-category article[class*="desktop\:grid-col-"] h2,
.page-standalone-content article[class*="desktop\:grid-col-"] h2 {
clear: none;
}
.page-standalone-category .imageholder,
.page-standalone-content .imageholder {
padding-left: 1.25rem;
padding-right: 1.25rem;
}
.page-standalone-category .imageholder .image,
.page-standalone-content .imageholder .image {
width: 380px;
}
}
/****************************\
Failed bank template
\****************************/
/* there was some failed bank stuff higher up. This is for the new template changes */
.template-failed-bank section a,
.template-failed-bank section a:visited {
color: #003256;
text-decoration: underline;
}
.template-failed-bank section a:hover {
color: #3163b6;
}
.template-failed-bank footer section a,
.template-failed-bank footer section a:visited {
text-decoration: none;
}
.template-failed-bank .fbankcategory {
font-size: 1.125rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
color: #736539;
text-align: center;
font-weight: 300;
margin-bottom: 0;
margin-top: 0.5rem;
}
@media (min-width: 1024px) {
.template-failed-bank .fbankcategory {
font-size: 1.25rem;
}
}
.template-failed-bank .fbanktitle {
font-size: 1.5625rem; /* this is from custom.css.414 (font-size-25px) */
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
text-align: center;
color: #003256;
margin-top: 0.5rem; /* from uswds.css:58442 */
margin-bottom: 0;
max-width: 55rem;
margin-right: auto;
margin-left: auto;
}
.template-failed-bank .fbankgrayborder {
display: none;
border: 1px solid #e7e8e7;
margin: 0;
margin-top: 1rem;
margin-bottom: 1.6875rem;
}
.template-failed-bank .fbankdescription {
text-align: center;
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 1.13rem;
margin: 1.5rem;
margin-bottom: 1.25rem;
}
.template-failed-bank .aagtitle { /* h2 in at a glance */
color: #ffffff;
font-size: 1.5rem;
text-align: center;
background-color: #003256;
margin-left: 0;
margin-right: 0;
margin-top: 0.75rem;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
padding-left: 1rem;
padding-right: 1rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
margin-bottom: 0;
}
.template-failed-bank .aagboxtab {
}
.template-failed-bank .aagboxtext {
margin-bottom: 0.75rem;
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
}
.template-failed-bank .aagboximgholder {
position: relative;
box-sizing: border-box;
/*width: 100%;*/
text-align: center;
min-width: 2rem;
margin-right: 0.75rem;
}
.template-failed-bank .iftitle {
text-align: center;
color: #003256;
margin: 0;
padding: 1rem;
font-size: 1.25rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
margin-left: 0.5rem;
margin-right: 0.5rem;
}
.template-failed-bank .bttt {
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
font-size: 0.875rem;
color: #003256;
font-style: italic;
font-weight: 300;
letter-spacing: 0.1em;
text-decoration: none;
}
.template-failed-bank .fbanksectiontitle {
text-align: center;
color: #003256;
margin: 0;
padding: 1rem;
font-size: 1.5rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
}
.template-failed-bank strong { /* this is a bad idea. But then again, I'm just following what PN gave us. They gave all <strong> a class to be prussian blue. */
color: #003256;
}
.template-failed-bank .sepline { /* another in a line of things that seem to be made more complicated than they need to be */
border-bottom: 1px solid #dfe1e2;
margin-top: 1rem;
margin-bottom: 1rem;
}
.template-failed-bank .fbankstdp {
padding: 1rem;
padding-top: 0;
margin-top: 0;
}
@media (min-width: 1024px) {
.template-failed-bank .fbanktitle {
font-size: 2.25rem; /* from custom.css:3010 (media resize for tablet:font-size-36px) */
}
.template-failed-bank .aagtitle {
font-size: 1.25rem;
margin-left: 0;
margin-right: 0;
}
.template-failed-bank .fbanksectiontitle {
font-size: 1.25rem;
}
}
@media (min-width: 640px) {
.template-failed-bank .iftitle {
color: #ffffff;
background-color: #003256;
}
}
@media (min-width: 40em) { /* is this the same size as 1024px? */
.template-failed-bank .fbanktitle {
margin-top: 1rem;
}
.template-failed-bank .fbankgrayborder {
display: block;
}
.template-failed-bank .fbankdescription {
text-align: left;
margin-top: 2rem;
}
.template-failed-bank .aagtitle {
text-align: left;
/*margin-left: auto;
margin-right: auto;*/
}
.template-failed-bank .aagboxtab {
/*
border-bottom: 1px solid #dfe1e2;
border-right: 1px solid #dfe1e2;
*/
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-flex: 1;
-ms-flex: 1 0 0px;
flex: 1 0 0;
width: auto;
max-width: 100%;
}
.template-failed-bank .aagboximgholder {
width: 100%;
text-align: left;
}
.template-failed-bank .iftitle {
text-align: left;
margin-left: 1rem;
margin-right: 1rem;
}
.template-failed-bank .fbanksectiontitle {
text-align: left;
padding-top: 1.5rem;
padding-bottom: 0;
}
.template-failed-bank .fbankstdp {
padding-top: 1rem;
margin-top: 1rem;
}
}
@media (max-width: 1023px) and (min-width: 0) {
.template-failed-bank .fbankdescription {
font-size: 0.875rem;
}
}
@media (max-width: 640px) and (min-width: 0) {
.template-failed-bank .fbankdescription {
margin-left: 0;
margin-right: 0;
}
.template-failed-bank .aagboximgholder {
width: 5rem;
padding-right: 1rem;
}
}
@media (min-width: 64em) {
.template-failed-bank .aagboximgholder {
width: 25%;
}
.template-failed-bank .iftitle {
margin-left: 0;
margin-right: 0;
}
}
/* need to fix up the back to top link */
.template-failed-bank a[href="#gov-banner"] { /* I would've preferred a longer selector, but this seems to work. */
z-index: 9; /* 9 is all we need */
}
/*********************************\
General Content with Data Page
\*********************************/
/* clean up for General Content with Data Page */
.page-general-content-data section a,
.page-general-content-data section a:visited,
.page-general-content-video section a,
.page-general-content-video section a:visited,
.page-archive-tile-video .data-table--content a,
.page-archive-tile-video .data-table--content a:visited {
color: #003256;
text-decoration: underline;
}
.page-general-content-data section a:hover,
.page-general-content-video section a:hover,
.page-archive-tile-video section a:hover {
color: #3163b6;
}
.page-general-content-data footer section a,
.page-general-content-data footer section a:visited,
.page-general-content-video footer section a,
.page-general-content-video footer section a:visited,
.page-archive-tile-video footer section a,
.page-archive-tile-video footer section a:visited { /* oops */
text-decoration: none;
}
/* one more fix to the fixes */
.page-general-content-data main section:last-child a,
.page-general-content-data main section:last-child a:visited,
.page-general-content-video main section:last-child a,
.page-general-content-video main section:last-child a:visited {
text-decoration: none;
}
.page-general-content-data main section:last-child a.text-base,
.page-general-content-data main section:last-child a.text-base:visited,
.page-general-content-video main section:last-child a.text-base,
.page-general-content-video main section:last-child a.text-base:visited {
color: #444343;
}
.page-general-content-data main section:last-child a:hover,
.page-general-content-video main section:last-child a:hover {
text-decoration: underline;
}
/*.page-general-content-data .gcwdcategory,
.page-general-content-video .gcwdcategory,
.page-archive-tile-video .vidcategory {
font-size: 1.125rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
color: #736539;
text-align: center;
font-weight: 300;
margin-bottom: 0;
margin-top: 0.5rem;
}
@media (min-width: 1024px) {
.page-general-content-data .gcwdcategory,
.page-general-content-video .gcwdcategory,
.page-archive-tile-video .vidcategory {
font-size: 1.25rem;
}
} */ /* moved higher in the code */
.page-general-content-data .gcwdtitle,
.page-general-content-video .gcwdtitle,
.page-archive-tile-video .vidtitle {
font-size: 1.5625rem; /* this is from custom.css.414 (font-size-25px) */
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
text-align: center;
color: #003256;
margin-top: 0.5rem; /* from uswds.css:58442 */
margin-bottom: 0;
max-width: 55rem;
margin-right: auto;
margin-left: auto;
}
.page-general-content-data h2.sectiontitle,
.page-general-content-video h2.sectiontitle {
font-size: 1rem;
color: #003256;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
}
.page-general-content-data .gcwdmodimageholder,
.page-general-content-video .gcwdmodimageholder {
padding: 0.75rem;
border: 1px solid #dfe1e2;
margin-top: 0.5rem;
}
@media (min-width: 1024px) {
.page-general-content-data .gcwdtitle,
.page-general-content-video .gcwdtitle,
.page-archive-tile-video .vidtitle {
font-size: 2.25rem; /* from custom.css:3010 (media resize for tablet:font-size-36px) */
}
}
@media (min-width: 40em) { /* is this the same size as 1024px? */
.page-general-content-data .gcwdtitle,
.page-general-content-video .gcwdtitle,
.page-archive-tile-video .vidtitle {
margin-top: 1rem;
}
.page-general-content-data .gcwdmodimageholder {
margin-left: 4.5rem;
margin-right: 4.5rem;
}
}
@media (min-width: 480px) {
.page-general-content-data h2.sectiontitle,
.page-general-content-video h2.sectiontitle {
font-size: 1.125rem;
}
}
@media (min-width: 64em) {
.page-general-content-data .gcwdmodimageholder {
margin-left: 0;
margin-right: 0;
}
}
.page-general-content-data .date,
.page-general-content-video .date {
font-family: "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
color: #444343;
font-size: 1rem;
letter-spacing: 0.15rem;
}
.page-general-content-data .gcwdenlarge {
font-size: 0.75rem;
letter-spacing: 0.15em;
display: flex;
justify-content: center;
align-items: center;
color: #444343;
text-transform: uppercase;
font-weight: 700;
}
/****************************\
Specialized breadcrumbs
\****************************/
/* the way the breadcrumbs are made, sometime you want to have a directory name in all caps. Here's a section that will grow. */
nav#usa-breadcrumbs li > a[aria-label="Foia"] { /* foia will need to have all uppercase */
text-transform: uppercase;
}
nav#usa-breadcrumbs li > a[aria-label="Cfr"] { /* CFR will need to have all uppercase */
text-transform: uppercase;
}
/* came up with a new way to deal with the camelcase issue - 3/15/21 - th */
/* the following three declarations are for when the breadcrumb target is the "end of the line" - that is, when the page is the furthest down - no child pages */
nav#usa-breadcrumbs li > a[aria-label="Jelena mcwilliams"] { /* target the link */
color: transparent; /* make whats currently there invisible */
width: 16.5ch; /* this is here for the outline when using tab key to get around. this will go around the word. will need to be recalibrated */
position: relative; /* make sure it stays put */
/* why not display: none? Because it needs to exist. d:n will remove it from existence. Why not visibility: hidden? Because the space would remain. We won't want that. */
}
nav#usa-breadcrumbs li > a[aria-label="Jelena mcwilliams"]::after { /* need to make it say what / how we want it to say/look */
color: #777678; /* need to keep the same color from before */
content: "Jelena McWilliams"; /* the new content the way we want it to look */
display: inline-block;
position: absolute; /* keeping the space */
top: 0; /* make sure it starts at the top of the space */
width: 20ch; /* fun part - count the number of characters in the link text, including spaces. Then add a little more because IE. The ch unit of measurement is perfect for this. */
left: 0; /* becasue IE, that's why. */
}
nav#usa-breadcrumbs li > a[aria-label="Jelena mcwilliams"]:hover::after {
text-decoration: underline; /* we need to have the underline show when hovering.*/
}
/* ----------------------- */
/* the following declarations are for when the breadcrumb target is NOT the last in the chain of directories */
/* using cfr as an example - don't know if they really want this, so it will be commented out */
/*nav#usa-breadcrumbs li > a[aria-label="CFR"] {
color: transparent;
width: 27ch;
position: relative;
display: inline-block;
}
nav#usa-breadcrumbs li > a[aria-label="CFR"]::after {
color: #777678;
content: "Center for Financial Research";
display: inline-block;
position: absolute;
top: 0.5px;
left: 0;
width: 27ch;
}
nav#usa-breadcrumbs li > a[aria-label="CFR"]:hover::after {
text-decoration: underline;
}*/
/*nav#usa-breadcrumbs li:not(:last-child) > a[aria-label="CFR"]::after { *//* the :not selector is used to change the color should the target NOT be in the last li in the breadcrumbs */
/*color: #003256;*/
/*}*/
/*nav#usa-breadcrumbs li:not(:last-child) > a[aria-label="CFR"]:hover::after {
color: #3163b6;
}*/
/****************************\
standard left side menu
\****************************/
/* trying to standarize the left nav menus */
.std-left-nav {
position: relative;
margin-bottom: 0;
}
.std-left-nav .mbl-title-holder {
border: 1px solid #e6e6e6;
border-radius: 0.25rem;
}
.std-left-nav a,
.std-left-nav a:visited {
color: #003256; /* this should be in already due to .leftsidemenu */
font-weight: 400;
padding-left: 0.25rem;
padding-right: 0.25rem;
padding-top: 1rem;
padding-bottom: 1rem;
display: block;
text-decoration: none;
}
.std-left-nav a:hover {
color: #3163b6; /* this should be in already due to .leftsidemenu */
text-decoration: underline;
}
.std-left-nav .first-level-link {
font-size: 1.125rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
line-height: 1.4;
}
.std-left-nav h2 {
border-bottom: 1px solid #dfe1e2;
margin-right: 0.5rem;
margin-left: 0.5rem;
}
.std-left-nav h2:last-child {
border-bottom: none;
}
@media (min-width: 64em) {
.std-left-nav {
margin-bottom: 2rem;
}
.std-left-nav .mbl-title-holder {
display: none;
}
}
.std-left-nav .second-level-link {
background-color: transparent;
border: none;
margin: 0;
padding: 3px !important;
text-align: left;
}
/****************************\
specialty leftnav addition
\****************************/
/* because, just because */
.highlightpage .active-link {
color: black !important;
cursor: default !important;
font-weight: bold !important;
text-decoration: none !important;
}
/****************************\
archive-list page
\****************************/
/*.page-archive-list .palcategory {
font-size: 1.125rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
color: #736539;
text-align: center;
font-weight: 300;
margin-bottom: 0;
margin-top: 0.5rem;
}
@media (min-width: 1024px) {
.page-archive-list .palcategory {
font-size: 1.25rem;
}
}*/ /* is now higher in the code */
.page-archive-list h1.maintitle {
color: #003256;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
text-align: center;
margin-top: 0.5rem;
margin-bottom: 0;
font-size: 1.5625rem;
font-weight: 100;
}
@media (min-width: 40em) {
.page-archive-list h1.maintitle {
margin-top: 1rem;
}
}
@media (min-width: 1024px) {
.page-archive-list h1.maintitle {
font-size: 2.25rem;
}
}
.page-archive-list .palintro {
font-size: 1.13rem;
font-style: italic;
margin-bottom: 0;
text-align: center;
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
color: #736539;
}
@media (min-width: 40em) {
.page-archive-list .palintro {
font-size: 1rem;
padding-left: 5rem;
padding-right: 5rem;
}
}
@media (min-width: 1024px) {
.page-archive-list .palintro {
font-size: 1.25rem;
}
}
/* if there are links in the section above the table, they should be styled with the other links */
.page-archive-list #main-content section:nth-of-type(1) a,
.page-archive-list #main-content section:nth-of-type(1) a:visited {
color: #003256;
text-decoration: underline;
}
.page-archive-list #main-content section:nth-of-type(1) a:hover {
color: #3163b6;
}
/****************************\
page-category pages
\****************************/
/* grand landing pages */
.page-standalone-category h1.category-title,
.page-category h1.category-title {
text-align: center;
color: #003256;
font-size: 3rem;
letter-spacing: 1px;
margin-top: 1rem;
margin-bottom: 1.6875rem;
font-family: "Merriweather Web", Georgia, Cambria, Times New Roman, Times, serif;
}
.page-standalone-category .category-intro,
.page-category .category-intro {
text-align: center;
font-size: 1.13rem;
margin-top: 0;
margin-bottom: 2.6875rem;
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
}
@media (max-width: 1023px) and (min-width: 0) {
.page-standalone-category h1.page-title,
.page-category h1.page-title {
font-size: 1.5rem;
}
}
@media (min-width: 40em) {
.page-standalone-category .category-intro,
.page-category .category-intro {
margin-left: 1rem;
margin-right: 1rem;
}
}
.page-standalone-category main > section h2,
.page-category main > section h2 {
text-align: center;
font-size: 2rem;
letter-spacing: normal;
margin-bottom: 1.6875rem;
padding-top: 0;
color: #003256;
font-family: "Merriweather Web", Georgia, Cambria, Times New Roman, Times, serif;
}
.page-standalone-category main > section h2.catlight,
.page-category main > section h2.catlight { /* for use on sections that have a dark background */
color: #ffffff;
}
/****************************\
page-standalone-category
\****************************/
/* quick new template fixes */
.page-standalone-category section + article {
margin-top: -1rem; /* There's only one instance of an article and it's after a section. So, let's remove some of the margin gap. */
}
.page-standalone-category section + article h2:first-child {
margin-top: -2.5rem; /* 508 said H2s needed a margin-top of 2.5rems. Let's undo some of that. */
}
/****************************\
page-events pages
\****************************/
/* event pages */
.page-event .islholder {
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
margin-bottom: 0.5rem;
display: block;
}
.page-event .islholder:last-child {
margin-bottom: 0;
}
.page-event .insectionlink {
font-size: 0.875rem;
font-weight: 600;
text-decoration: none;
color: #003256;
}
.page-event .insectionlink:hover {
color: #3163b6;
}
@media (min-width: 64em) {
.page-event .islholder {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
margin-bottom: 0;
-webkit-box-flex: 1;
flex: 1 0 0;
width: auto;
max-width: 100%;
}
}
/****************************\
page-topic pages
\****************************/
.page-topic h1.maintitle {
font-size: 2.25rem;
}
.page-topic .intro { /*intro paragraph */
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
text-align: center;
margin-left: 0;
margin-right: 0;
margin-bottom: 1.6875rem;
}
.page-topic p.topicpara {
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 1.125rem;
margin: 2rem 1.5rem 1.25rem 1.5rem;
}
@media (min-width: 40em) {
.page-topic .intro {
margin-left: 1.5rem;
margin-right: 1.5rem;
}
}
@media (max-width: 1023px) and (min-width: 0px) {
.page-topic .intro {
font-size: 0.875rem;
}
.page-topic p.topicpara {
font-size: 0.875rem;
}
}
@media (min-width: 0) and (max-width: 640px) {
.page-topic p.topicpara {
margin-left: 0 !important;
margin-right: 0 !important;
}
}
/****************************\
archive-tile pages
\****************************/
/* audio and video tile pages */
.page-archive-tile-audio .data-table--content a,
.page-archive-tile-audio .data-table--content a:visited,
.page-archive-tile-video .data-table--content a,
.page-archive-tile-video .data-table--content a:visited {
color: #003256;
text-decoration: underline;
}
.page-archive-tile-audio .data-table--content a:hover,
.page-archive-tile-video .data-table--content a:hover {
color: #3163b6;
}
.page-archive-tile-audio .card__content a.chapter::before,
.page-archive-tile-audio .card__content a.transcript::before {
font-family: "Font Awesome 5 Free";
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
line-height: 1;
color: #003256;
margin-right: 0.5rem;
font-size: .9rem;
font-weight: 400;
vertical-align: middle;
}
.page-archive-tile-audio .card__content a.chapter::before {
content: "\f1c1"; /* fa pdf char */
}
.page-archive-tile-audio .card__content a.transcript::before {
content: "\f1c7"; /* fa transcript char */
}
.page-archive-tile-video .atopening {
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-style: italic;
text-align: center;
margin-bottom: 0;
}
.page-archive-tile-video .vidtitletext {
font-size: 0.875rem;
font-family: "Open Sans", "Source Sans Pro Web", "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
color: #736539;
padding-top: 1rem;
padding-bottom: 0.5rem;
letter-spacing: 0.1em;
}
@media (min-width: 40em) {
.page-archive-tile-video .atopening {
font-size: 1rem;
padding-left: 5rem;
padding-right: 5rem;
}
.page-archive-tile-video .vidtitletext {
margin-top: 0;
margin-bottom: 0;
}
}
@media (max-width: 1023px) and (min-width: 0px) {
.pagearchive-tile-video .atopening {
font-size: 0.875rem;
}
}
/****************************\
di pages
\****************************/
.page-resources-di h2.trusts {
text-align: center;
color: #003256;
margin: 0;
padding: 1rem;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
font-size: 1.5625rem;
}
@media (min-width: 40em) {
.page-resources-di h2.trusts {
margin-top: 0.5rem;
margin-left: 1rem;
margin-right: 1rem;
}
}
@media (min-width: 1024px) {
.page-resources-di h2.trusts {
font-size: 2rem;
}
}
@media (min-width: 64em) { /* desktop */
.page-resources-di h2.trusts {
margin-left: 0;
margin-right: 0;
}
}
/*********************************\
regulation table modification
\*********************************/
/* a request came in to modify the basic table for an index list. Since it can be part of a template it made sense to make this an option for others. */
/* a good reminder that while <colgroup> and <col> exists for columns, the equivalent for rows is <tbody>. <tbody> can exist multiple times in a table. */
.wide-rows th,
.wide-rows td { /* removes internal borders from th and td */
border: none;
}
.wide-rows { /* ensures the table does have a border though */
border: 1px solid #c5c5c5;
}
.wide-rows tr.highlight { /* add .highlight to the row to give it a different background shade */
background-color: #f9f8f5;
border-top: 1px solid #c5c5c5;
}
.wide-rows tbody tr:last-child td { /* add a little extra bottom padding to the last row */
padding-bottom: 1.8rem;
}
/*********************************\
Agenda Page template
\*********************************/
/* not a real template - this is an addition to the standalone-content page */
.agendaheaderinfo {
text-align: center;
}
.agendacommitteeholder {
display: flex;
font-style: italic;
justify-content: space-between;
}
.agendacommitteeleft {
width: 49%;
text-align: left;
padding-top: 1rem;
}
.agendacommitteeright {
width: 49%;
text-align: right;
padding-top: 1rem;
}
.agendaholder {
display: table;
width: 100%;
}
.agendacaption {
display: table-caption;
font-weight: bold;
/*text-decoration: underline;*/
}
.agendarow {
display: table-row;
}
.agendarow:nth-child(odd) {
background-color: #eeeeee;
}
.agendatime {
display: table-cell;
width: 40%;
padding-top: 20px;
padding-left: 20px;
}
.agendasession {
display: table-cell;
width: 60%;
padding-top: 20px;
padding-bottom: 20px;
padding-right: 20px;
}
.agendasession a {
font-weight: bold;
}
@media (max-width: 1023px) {
.agendatime, .agendasession {
width: 100%;
float: left;
}
.agendasession {
padding-left: 20px;
}
.agendacommitteeholder {
flex-direction: column;
}
.agendacommitteeleft {
width: 100%;
text-align: left;
}
.agendacommitteeright {
width: 100%;
text-align: left;
}
.agendabannerholder {
margin-top: 2rem;
}
}
/*********************************\
Conference Agenda Page template
\*********************************/
/* not a real template - this is an addition to the standalone-content page *//* this is how we start to get into trouble*/
.conagenda { /* table conference agenda */
}
.conagenda tr:nth-child(even) {
background-color: #f9f8f5;
}
.conagenda tr td:nth-child(1) {
text-align: center;
font-size: 0.8125rem;
}
/*********************************\
board pages
\*********************************/
/* let's make the board members pages a little easier to update - 11/9 */
.page-board section div.usa-accordion table tr:nth-child(even) { /* the tables within the accordion dropdown, alternate rows should have a background color */
background-color: #f9f8f5;
}
.page-board section div.usa-accordion table tr th {
text-align: left;
font-weight: 400;
width: 15rem;
}
.page-board section article a,
.page-board section article a:visited { /* thought .page-standalone-content had this. It does. But with specific articles, not throughout the page */
color: #003256;
text-decoration: underline;
}
.page-board section article a:hover {
color: #3163b8;
}
/* map test */
div#mapsvg [tabindex]:focus::before {
content: attr(aria-label);
position: relative;
display: inline-block;
background-color: #ffffff;
color: #ff0000;
font-weight: bold;
padding: 10px;
}
/*********************************\
specialized slider fix
\*********************************/
/* very, very targeted declaration to blank out one instance */
.page-careers section.bg-job-opportunities .glider-track .visible .card.card--inverse {
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
/* very, very targeted declaration to change that same one instance */
.page-careers section.bg-job-opportunities .glider-track .visible + .visible {
border-left: 1px solid rgba(255, 255, 255, 0.5);
}
/* I have no idea what this is or how it got here */ /* nevermind - we know what these are for now - 2/1/21 */
/* New Tabs */
.responsive-tabs__heading {
display: none;
}
.responsive-tabs__list__item {
display: inline-block;
cursor: pointer;
}
@media (max-width: 767px) {
.responsive-tabs__list {
display: none;
}
.responsive-tabs__heading {
display: block;
cursor: pointer;
}
.responsive-tabs__panel--closed-accordion-only {
display: none;
}
}
@media (min-width: 768px) {
.responsive-tabs__panel--closed-accordion-only {
display: block !important;
}
}
/* END - Required for core functionality */
/* OPTIONAL - Basic Skin */
.responsive-tabs-wrapper {
clear: both;
zoom: 1;
}
.responsive-tabs-wrapper:before,
.responsive-tabs-wrapper:after {
content: "";
display: table;
}
.responsive-tabs-wrapper:after {
clear: both;
}
.responsive-tabs__heading:focus,
.responsive-tabs__list__item:focus {
outline: 1px solid #ccc;
}
.responsive-tabs__heading--active:focus,
.responsive-tabs__list__item--active:focus {
outline: 0.125rem dotted #bcac88;
}
.responsive-tabs__list {
background: #003256;
color: white;
font-size: 1.25rem;
text-align: center;
margin: 0;
padding: 0;
}
.responsive-tabs__list__item {
padding: 1rem 2.5rem 0; /* adding 0 for the bottom padding - 2/12/21 - TH */
}
.responsive-tabs__list__item:hover {
}
.responsive-tabs__list__item--active,
.responsive-tabs__list__item--active:hover {
text-decoration: underline;
}
.responsive-tabs__panel {
margin-bottom: 1.25rem;
}
@media (max-width: 767px) {
.responsive-tabs__heading {
padding: 0.5rem 1.25rem;
background: #003256;
color: #fff;
margin: 2px 0;
position: relative;
}
.responsive-tabs__heading:after {
background-image: url(/assets/images/arrow-right-white.svg);
background-size: 1rem;
background-repeat: no-repeat;
content: "";
display: block;
position: absolute;
right: 17px;
top: 29%;
width: 13px;
height: 20px;
}
.responsive-tabs__heading:hover,
.responsive-tabs__heading--active:hover {
}
.responsive-tabs__heading--active {
margin: 2px 0 0;
}
.responsive-tabs__heading--active:after {
background-image: url(/assets/images/arrow-down-white.svg);
width: 17px;
right: 14px;
}
}
/** 9-28-20 CSS **/
@media all and (min-width: 640px) {
.tablet\:font-family-serif {
font-family: Merriweather Web, Georgia, Cambria, Times New Roman, Times, serif;
}
}
@media all and (min-width: 640px) {
.bg-state-visits {
background-image: url("/about/jelena-mcwilliams/images/fdic-chairman-state-visits-bg.png");
background-position: 87% 0%;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-photos {
background-image: url("/about/jelena-mcwilliams/images/fdic-chairman-photos-bg.jpg");
background-position: 0 0;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
.bg-speaking-request {
background-image: url("/about/jelena-mcwilliams/images/fdic-chairman-speaking-request-bg.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
min-height: 400px;
}
}
@media all and (min-width: 1025px) {
.bg-state-visits {
background-position: center;
}
}
.fdic-table.margin-y-0 {
margin: 0;
}
/************************************\
new content display boxes 2/11/21
\************************************/
/* coronavirus page update now has boxes */
/* top of page, a holder that holds two boxes, one of intro text and one a quote */
.introcomboboxholder { /* positions the box holder */
width: 100%;
margin-left: auto;
margin-right: auto;
padding: 0 2rem;
}
.introcombobox { /* the actual flex box (for mobile vs desktop position) */
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-around;
}
.introcombobox div { /* basic margin */
margin: 10px 20px;
}
.introcombo-leftbox { /* leftside - for the intro paragraph */
width: 50%;
}
.introcombo-leftbox p { /* the paragraph inside the box */
font-size: 1.3rem;
line-height: 1.5;
}
.introcombo-rightbox { /* rightside - for the quote */
width: 50%;
}
@media (max-width: 1023px) { /* mobile positioning */
.introcomboboxholder {
padding: 0;
}
.introcombobox {
flex-direction: column;
}
.introcombo-leftbox,
.introcombo-rightbox { /* since mobile and in a column, take up the whole width */
width: 100%;
}
.introcombo-leftbox {
padding: 0;
}
.introcombo-leftbox p {
padding: 0;
margin: 0;
}
}
/* also have a video component on cv page - think I finally figured this out */
/* how it works and sample and explanation*/
/* need to have the iframe that holds the video. BUT, you also need a div to hold the iframe so it can resize. So:
<div id="vidwrap" class="vidwrap">
<iframe width="90%" src="youtube link to video here" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
*/
.vidwrap {
position: relative; /* because the iframe child will be absolutely positioned to this */
padding-bottom: 56.25%;
height: 0;
width: 100%; /* all the space */
margin-left: auto; /* center */
margin-right: auto;
max-width: 1200px; /* the max size in the available space */
}
.vidwrap iframe {
position: absolute; /* position the video in the div */
top: 0; /* right at the top of the div */
left: 0; /* to the very left side of the div */
height: 100%; /* take up all available space of the containing div - the magic to resize to the page or whatever the dov will resize to */
width: 100%;
}
/* also have content boxes */
.boxrowholder { /* hold a row (or column) of boxes */
display: flex;
width: 100%;
flex-direction: row;
}
.boxcard { /* box is a boxcard */
width: 250px; /* set size */
height: 250px;
border: 1px solid #003256;
justify-content: space-around; /* it's inside a flex box container */
margin-right: auto;
margin-left: auto;
text-align: center;
}
.boxcard a { /* the box is a giant link that takes up the size of the box */
color: #003256;
text-decoration: none;
display: inline-block;
width: 100%;
height: 100%;
position: relative;
padding-right: 1rem;
padding-left: 1rem;
}
.boxcard a:hover {
background-color: rgba(4,82,137,.6); /* this is the same overlay color as on the mosaic */
text-decoration: underline;
}
/* on the cv page are some inline styles that relate to the next declarations. They look like:
.boxrowholder .boxcard:nth-child(1) .imageforcard { background-image: url(/assets/images/icon-diversity-inclusion.svg); }
There's 5 of them - they specify the image to be used on each box */
.boxrowholder .boxcard .imageforcard { /* on cv page, the boxes have icons - this positions the icons */
background-repeat: no-repeat;
background-position: center 10%;
height: 90px;
background-size: auto;
background-color: transparent;
}
.boxrowholder .boxcard .imageforcard p { /* brief paragraph or link text under the image in the card */
text-align: center;
padding: 10px;
position: relative;
top: 90px;
}
.boxcardcontent { /* the link in the box goes to elsewhere on the page - this is the boxcardcontent - styles for that content */
width: 90%;
margin-left: auto;
margin-right: auto;
color: #003256;
font-size: 1.4rem;
line-height: 1.4;
margin-top: 50px;
margin-bottom: 50px;
}
.boxcardcontent p,
.boxcardcontent li {
color: #003256;
font-size: 1.4rem;
}
.boxcardcontent a {
color: #003256;
text-decoration: underline;
}
.boxcardcontent .boxcardtitle { /* the boxcardcontent has a title (on cv page it's in a span - hence the display: block) */
color: #003256;
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
display: block;
font-weight: bold;
}
@media (max-width: 1023px) { /* mobile style change */
.boxcardcontent {
width: 100%;
}
.boxrowholder {
flex-direction: column;
}
.boxcard {
margin-top: 10px;
margin-bottom: 10px;
width: 100%;
}
}
/************************************************************\
gradient overlay for frontpage hero images - 3/30/21 - TH
\************************************************************/
/* frontpage hero section - sometimes words are hard to read */
/* add a gradient overlay to the image, but pop up link text needs to be over that */
.usa-hero--mobile-carousel .glider-slide a.card::before { /* target only link cards in the glider-slide within the hero */
content: "";
position: absolute;
width: 100%;
height: 100%;
display: block;
z-index: 999;
top: 0;
left: 0;
background: linear-gradient(rgba(0,0,0,0.0) 50%, rgba(0,0,0,0.7) 100%);
}
.usa-hero--mobile-carousel .glider-slide a.card .card__content {
z-index: 9999;
} | {
"content_hash": "2d3e0f8cf82f63f5ea1cc44450a0012c",
"timestamp": "",
"source": "github",
"line_count": 7997,
"max_line_length": 215,
"avg_line_length": 25.365512067025133,
"alnum_prop": 0.6084555923647263,
"repo_name": "ygenc/ygenc.github.io",
"id": "08e88177fc66c0f1837836d61897f65710775a8a",
"size": "202858",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lectures/is684/sample_sources/FDIC _ Failed Bank List_files/custom.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "317848"
},
{
"name": "HTML",
"bytes": "10311204"
},
{
"name": "Hack",
"bytes": "2670"
},
{
"name": "JavaScript",
"bytes": "2135171"
},
{
"name": "PHP",
"bytes": "14402"
},
{
"name": "Python",
"bytes": "9455"
},
{
"name": "Ruby",
"bytes": "87"
},
{
"name": "SCSS",
"bytes": "4670"
}
],
"symlink_target": ""
} |
import datetime
import pandas as pd
from igf_data.igfdb.pipelineadaptor import PipelineAdaptor
from ehive.runnable.IGFBaseJobFactory import IGFBaseJobFactory
from igf_data.utils.ehive_utils.pipeseedfactory_utils import get_pipeline_seeds
class PipeseedFactory(IGFBaseJobFactory):
'''
Job factory class for pipeline seed
'''
def param_defaults(self):
params_dict = \
super(PipeseedFactory,self).param_defaults()
params_dict.\
update({
'seed_id_label':'seed_id',
'seqrun_id_label':'seqrun_id',
'seeded_label':'SEEDED',
'running_label':'RUNNING',
'seqrun_date_label':'seqrun_date',
'seqrun_igf_id_label':'seqrun_igf_id',
'seed_status_label':'status',
'experiment_id_label':'experiment_id',
'pipeseed_mode':'demultiplexing',
})
return params_dict
def run(self):
'''
Run method for the seed job factory class of the all pipelines
:param igf_session_class: A database session class
:param pipeline_name: Name of the pipeline
:param seed_id_label: A text label for the seed_id, default seed_id
:param seqrun_id_label: A text for seqrun_id column name, default seqrun_id
:param seqrun_date_label: A text label for the seqrun date, default seqrun_date
:param seqrun_igf_id_label: A text label for sequencing run igf id, default seqrun_igf_id
:param seeded_label: A text label for the status seeded in pipeline_seed table, default SEEDED
:param running_label: A text label for the status running in the pipeline_seed table, default RUNNING
:param seed_status_label: A text label for the pipeline_seed status column name, default status
:param experiment_id_label: A text label for the experiment_id, default experiment_id
:param pipeseed_mode: A text label for pipeline mode, default demultiplexing
Allowed values are
* demultiplexing
* alignment
:returns: A list of dictionary containing the seqrun ids or experiment_igf_ids seed for analysis
'''
try:
dbconnected = False
igf_session_class = self.param_required('igf_session_class') # set by base class
pipeline_name = self.param_required('pipeline_name')
seeded_label = self.param_required('seeded_label')
running_label = self.param_required('running_label')
seed_status_label = self.param_required('seed_status_label')
pipeseed_mode = self.param_required('pipeseed_mode')
if pipeseed_mode not in ('demultiplexing','alignment'):
raise ValueError(
'Pipeseed_mode {0} not supported'.\
format(pipeseed_mode))
pipeseeds_data,seed_data = \
get_pipeline_seeds(
pipeseed_mode=pipeseed_mode,
pipeline_name=pipeline_name,
igf_session_class=igf_session_class) # fetch pipeseed data from db
if len(seed_data.index)>0:
seed_data = \
seed_data.\
to_dict(orient='records') # convert dataframe to list of dictionaries
self.param('sub_tasks',seed_data) # set sub_tasks param for the data flow
pipeseeds_data[seed_status_label] = \
pipeseeds_data[seed_status_label].\
map({seeded_label:running_label}) # update seed records in pipeseed table, changed status to RUNNING
pa = PipelineAdaptor(**{'session_class':igf_session_class}) # get db adaptor
pa.start_session() # connect to db
dbconnected = True
pa.update_pipeline_seed(
data=pipeseeds_data.to_dict(orient='records'),
autosave=False) # set pipeline seeds as running
pa.commit_session() # save changes to db
pa.close_session() # close db connection
dbconnected=False
message = \
'Total {0} new job found for {1}, pipeline: {2}'.\
format(
len(seed_data),
self.__class__.__name__,
pipeline_name) # format msg
self.post_message_to_slack(
message,reaction='pass') # send update to slack
self.post_message_to_ms_team(
message=message,
reaction='pass') # send update to ms team
else:
message = \
'{0}, {1}: no new job created'.\
format(
self.__class__.__name__,
pipeline_name) # format msg for failed jobs
self.warning(message)
self.post_message_to_slack(
message,reaction='sleep') # post about failed job to slack
self.post_message_to_ms_team(
message=message,
reaction='sleep') # send update to ms team
except Exception as e:
message = \
'Error in {0},{1}: {2}'.\
format(
self.__class__.__name__,
pipeline_name, e) # format slack msg
self.warning(message)
self.post_message_to_slack(
message,reaction='fail') # send msg to slack
self.post_message_to_ms_team(
message=message,
reaction='fail') # send update to ms team
if dbconnected:
pa.rollback_session() # remove changes from db
pa.close_session()
raise # mark worker as failed
| {
"content_hash": "38d73d19714ae70806589d5eefdc49de",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 146,
"avg_line_length": 48.37301587301587,
"alnum_prop": 0.5361771944216571,
"repo_name": "imperial-genomics-facility/data-management-python",
"id": "9eb9b34f3e0f68950923e1f75613989bd5efa23f",
"size": "6095",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ehive/runnable/jobfactory/PipeseedFactory.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2900"
},
{
"name": "HTML",
"bytes": "77727"
},
{
"name": "JavaScript",
"bytes": "1074"
},
{
"name": "Jinja",
"bytes": "399"
},
{
"name": "Mako",
"bytes": "494"
},
{
"name": "Python",
"bytes": "2553178"
},
{
"name": "R",
"bytes": "376"
},
{
"name": "Shell",
"bytes": "536"
}
],
"symlink_target": ""
} |
package sorm.test.features
import org.scalatest.{FunSuite, Matchers}
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import sorm._
import sorm.test.MultiInstanceSuite
object MultithreadingTest {
case class A (a : Int)
}
@RunWith(classOf[JUnitRunner])
class MultithreadingTest extends FunSuite with Matchers with MultiInstanceSuite {
import MultithreadingTest._
def entities = Set() + Entity[A]()
instancesAndIds foreach { case (db, dbId) =>
val a1 = db.save(A(1))
val a2 = db.save(A(3))
val a3 = db.save(A(0))
val a4 = db.save(A(3000))
test(dbId + " - Parallel queries"){
Seq(0,1,2,3).par.flatMap{ i => db.query[A].whereEqual("a", i).fetchOne() }.seq
.should(contain(a1) and contain(a3) and not contain(a4))
}
test(dbId + " - Parallel saving"){
pending
}
}
}
| {
"content_hash": "bea820709b3c1fb5ddf11d901be471cb",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 84,
"avg_line_length": 25.058823529411764,
"alnum_prop": 0.6690140845070423,
"repo_name": "pjfanning/sorm",
"id": "71a552c11985184cb40b586380190d5014ecd7b9",
"size": "852",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/scala/sorm/test/features/MultithreadingTest.scala",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Scala",
"bytes": "227124"
}
],
"symlink_target": ""
} |
package egovframework.com.sym.ccm.ccc.service;
import java.io.Serializable;
/**
*
* 공통분류코드 VO 클래스
* @author 공통서비스 개발팀 이중호
* @since 2009.04.01
* @version 1.0
* @see
*
* <pre>
* << 개정이력(Modification Information) >>
*
* 수정일 수정자 수정내용
* ------- -------- ---------------------------
* 2009.04.01 이중호 최초 생성
*
* </pre>
*/
public class CmmnClCodeVO extends CmmnClCode implements Serializable {
/** 검색조건 */
private String searchCondition = "";
/** 검색Keyword */
private String searchKeyword = "";
/** 검색사용여부 */
private String searchUseYn = "";
/** 현재페이지 */
private int pageIndex = 1;
/** 페이지갯수 */
private int pageUnit = 10;
/** 페이지사이즈 */
private int pageSize = 10;
/** firstIndex */
private int firstIndex = 1;
/** lastIndex */
private int lastIndex = 1;
/** recordCountPerPage */
private int recordCountPerPage = 10;
/**
* searchCondition attribute 를 리턴한다.
* @return String
*/
public String getSearchCondition() {
return searchCondition;
}
/**
* searchCondition attribute 값을 설정한다.
* @param searchCondition String
*/
public void setSearchCondition(String searchCondition) {
this.searchCondition = searchCondition;
}
/**
* searchKeyword attribute 를 리턴한다.
* @return String
*/
public String getSearchKeyword() {
return searchKeyword;
}
/**
* searchKeyword attribute 값을 설정한다.
* @param searchKeyword String
*/
public void setSearchKeyword(String searchKeyword) {
this.searchKeyword = searchKeyword;
}
/**
* searchUseYn attribute 를 리턴한다.
* @return String
*/
public String getSearchUseYn() {
return searchUseYn;
}
/**
* searchUseYn attribute 값을 설정한다.
* @param searchUseYn String
*/
public void setSearchUseYn(String searchUseYn) {
this.searchUseYn = searchUseYn;
}
/**
* pageIndex attribute 를 리턴한다.
* @return int
*/
public int getPageIndex() {
return pageIndex;
}
/**
* pageIndex attribute 값을 설정한다.
* @param pageIndex int
*/
public void setPageIndex(int pageIndex) {
this.pageIndex = pageIndex;
}
/**
* pageUnit attribute 를 리턴한다.
* @return int
*/
public int getPageUnit() {
return pageUnit;
}
/**
* pageUnit attribute 값을 설정한다.
* @param pageUnit int
*/
public void setPageUnit(int pageUnit) {
this.pageUnit = pageUnit;
}
/**
* pageSize attribute 를 리턴한다.
* @return int
*/
public int getPageSize() {
return pageSize;
}
/**
* pageSize attribute 값을 설정한다.
* @param pageSize int
*/
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
/**
* firstIndex attribute 를 리턴한다.
* @return int
*/
public int getFirstIndex() {
return firstIndex;
}
/**
* firstIndex attribute 값을 설정한다.
* @param firstIndex int
*/
public void setFirstIndex(int firstIndex) {
this.firstIndex = firstIndex;
}
/**
* lastIndex attribute 를 리턴한다.
* @return int
*/
public int getLastIndex() {
return lastIndex;
}
/**
* lastIndex attribute 값을 설정한다.
* @param lastIndex int
*/
public void setLastIndex(int lastIndex) {
this.lastIndex = lastIndex;
}
/**
* recordCountPerPage attribute 를 리턴한다.
* @return int
*/
public int getRecordCountPerPage() {
return recordCountPerPage;
}
/**
* recordCountPerPage attribute 값을 설정한다.
* @param recordCountPerPage int
*/
public void setRecordCountPerPage(int recordCountPerPage) {
this.recordCountPerPage = recordCountPerPage;
}
}
| {
"content_hash": "0f3b220795f558f73b25b3cf55663363",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 71,
"avg_line_length": 18.821428571428573,
"alnum_prop": 0.6012469503930604,
"repo_name": "dasomel/egovframework",
"id": "f5645c5f9d67460241254c41cc59e347e0126676",
"size": "4025",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "common-component/v2.3.2/src/main/java/egovframework/com/sym/ccm/ccc/service/CmmnClCodeVO.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
require 'spec_helper'
require 'support/shared_examples'
require 'cisco_node_utils'
ensure_module_defined('Puppet::Provider::DomainName')
require 'puppet/provider/domain_name/cisco_nexus'
RSpec.describe Puppet::Provider::DomainName::CiscoNexus do
subject(:provider) { described_class.new }
let(:context) { instance_double('Puppet::ResourceApi::BaseContext', 'context') }
let(:domain) { instance_double('Cisco::DomainName', 'domain') }
let(:domain2) { instance_double('Cisco::DomainName', 'domain2') }
let(:domain3) { instance_double('Cisco::DomainName', 'domain3') }
let(:domainnames) do
{
'test.puppet.com' => domain,
'example.puppet.com' => domain2,
'nexus.puppet.com' => domain3,
}
end
describe '#get(_context)' do
it 'processes resources' do
allow(Cisco::DomainName).to receive(:domainnames).and_return(domainnames)
expect(provider.get(context)).to eq [
{
name: 'test.puppet.com',
ensure: 'present',
},
{
name: 'example.puppet.com',
ensure: 'present',
},
{
name: 'nexus.puppet.com',
ensure: 'present',
},
]
end
context 'get filter used without matches' do
it 'still processes' do
allow(Cisco::DomainName).to receive(:domainnames).and_return(domainnames)
expect(provider.get(context, ['www.foo.com'])).to eq []
end
end
context 'get filter used with matches' do
it 'still processes' do
allow(Cisco::DomainName).to receive(:domainnames).and_return(domainnames)
expect(provider.get(context, ['example.puppet.com'])).to eq [
{
name: 'example.puppet.com',
ensure: 'present',
}
]
end
end
end
describe '#create(_context, name, _should)' do
it 'creates the resource' do
expect(Cisco::DomainName).to receive(:new).with('test.puppet.com')
provider.create(context, 'test.puppet.com', name: 'test.puppet.com', ensure: 'present')
end
end
describe '#delete(context, name)' do
it 'deletes the resource' do
expect(Cisco::DomainName).to receive(:domainnames).and_return(domainnames)
expect(domainnames['test.puppet.com']).not_to receive(:destroy)
expect(domainnames['example.puppet.com']).to receive(:destroy)
expect(domainnames['nexus.puppet.com']).not_to receive(:destroy)
provider.delete(context, 'example.puppet.com')
end
end
it_behaves_like 'a noop canonicalizer'
end
| {
"content_hash": "e46b351a921ad602b40bbe778835adc4",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 93,
"avg_line_length": 31.493827160493826,
"alnum_prop": 0.6268130145041161,
"repo_name": "cisco/cisco-network-puppet-module",
"id": "67e7702f919e5f6129049781d4e6c55d221fee01",
"size": "2551",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "spec/unit/puppet/provider/domain_name/cisco_nexus_spec.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "31"
},
{
"name": "Puppet",
"bytes": "2912"
},
{
"name": "Python",
"bytes": "7567"
},
{
"name": "Ruby",
"bytes": "1809617"
},
{
"name": "Shell",
"bytes": "10685"
}
],
"symlink_target": ""
} |
This directory holds Fritzing projects of the custom boards used
in the Grant Lighting work. These are not kept in git since they
are binaries and would frustrate the git diff tools.
If you are interested in any of them, contact me at
bill at jamimi dot com
| {
"content_hash": "60ea749f3708e71c9bf2328d9089a4d5",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 64,
"avg_line_length": 43.166666666666664,
"alnum_prop": 0.7992277992277992,
"repo_name": "wmadill/grant-lighting",
"id": "29d4b889aa86437825432441e9a36050920d806a",
"size": "259",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "designs/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Arduino",
"bytes": "56547"
},
{
"name": "C",
"bytes": "11535"
},
{
"name": "HTML",
"bytes": "1427809"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>deepstream - Michael Ramos</title>
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="deepstream - Michael Ramos">
<meta name="twitter:description" content="">
<meta property="og:type" content="article">
<meta property="og:title" content="deepstream - Michael Ramos">
<meta property="og:description" content="">
<link href="/favicon.ico" rel="shortcut icon" type="image/x-icon">
<link href="/apple-touch-icon-precomposed.png" rel="apple-touch-icon">
<link rel="stylesheet" type="text/css" href="//mdramos.github.io/themes/my-uno/assets/css/uno.css?v=1484786788264" />
<link href="//mdramos.github.io/themes/my-uno/assets/css/style.css?v=1484786788264" rel="stylesheet" type="text/css">
<link rel="canonical" href="https://mdramos.github.io/https://mdramos.github.io/tag/deepstream/" />
<meta name="referrer" content="origin" />
<meta property="og:site_name" content="Michael Ramos" />
<meta property="og:type" content="website" />
<meta property="og:title" content="deepstream - Michael Ramos" />
<meta property="og:url" content="https://mdramos.github.io/https://mdramos.github.io/tag/deepstream/" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="deepstream - Michael Ramos" />
<meta name="twitter:url" content="https://mdramos.github.io/https://mdramos.github.io/tag/deepstream/" />
<script type="application/ld+json">
null
</script>
<meta name="generator" content="HubPress" />
<link rel="alternate" type="application/rss+xml" title="Michael Ramos" href="https://mdramos.github.io/rss/" />
</head>
<body class="tag-template tag-deepstream no-js">
<span class="mobile btn-mobile-menu">
<i class="icon icon-list btn-mobile-menu__icon"></i>
<i class="icon icon-x-circle btn-mobile-close__icon hidden"></i>
</span>
<header class="panel-cover " >
<div class="panel-main">
<div class="panel-main__inner panel-inverted">
<div class="panel-main__content">
<a href="https://mdramos.github.io" title="link to homepage for Michael Ramos"><img src="https://scontent-iad3-1.xx.fbcdn.net/v/t1.0-9/12191585_989540307734942_3264448566981964653_n.jpg?oh=94710c4bd9df55aa0f05191a53b15d08&oe=58ACE5B8" width="80" alt="Michael Ramos logo" class="panel-cover__logo logo" /></a>
<h1 class="panel-cover__title panel-title"><a href="https://mdramos.github.io" title="link to homepage for Michael Ramos">Michael Ramos</a></h1>
<hr class="panel-cover__divider" />
<p class="panel-cover__description">Just doing me, working hard, learning, growing. http://stackoverflow.com/users/2961387/rambossa</p>
<hr class="panel-cover__divider panel-cover__divider--secondary" />
<div class="navigation-wrapper">
<nav class="cover-navigation cover-navigation--primary">
<ul class="navigation">
<li class="navigation__item"><a href="https://mdramos.github.io/#blog" title="link to Michael Ramos blog" class="blog-button">Blog</a></li>
</ul>
</nav>
<nav class="cover-navigation navigation--social">
<ul class="navigation">
<!-- Twitter -->
<li class="navigation__item">
<a href="https://twitter.com/rambossa" title="Twitter account">
<i class='icon icon-social-twitter'></i>
<span class="label">Twitter</span>
</a>
</li>
<!-- Github -->
<li class="navigation__item">
<a href="https://github.com/mdramos" title="Github account">
<i class='icon icon-social-github'></i>
<span class="label">Github</span>
</a>
</li>
<!-- LinkedIn -->
<li class="navigation__item">
<a href=" https://www.linkedin.com/in/mdramos1" title="LinkedIn account">
<i class='icon icon-social-linkedin'></i>
<span class="label">LinkedIn</span>
</a>
</li>
<!-- Email -->
<li class="navigation__item">
<a href="mailto:mdramos8@gmail.com" title="Email mdramos8@gmail.com">
<i class='icon icon-mail'></i>
<span class="label">Email</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="panel-cover--overlay"></div>
</div>
</header>
<div class="content-wrapper">
<div class="content-wrapper__inner">
<h1 class="archive-title">Tag: deepstream</h1>
<hr class="section-title__divider" />
<div class="main-post-list">
<ol class="post-list">
<li>
<h2 class="post-list__post-title post-title"><a href="https://mdramos.github.io/2016/10/10/Deepstreamio-Server-on-AWS-in-progress.html" title="link to Deepstream.io Server on AWS (in-progress)">Deepstream.io Server on AWS (in-progress)</a></h2>
<p class="excerpt">We’ll be creating an initial setup of a deepstream server that integrates with MongoDB and Redis for storage and caching. All three services will be hosted on their own EC2 instances.…</p>
<div class="post-list__meta">
<time datetime="10 Oct 2016" class="post-list__meta--date date">10 Oct 2016</time> •
<span class="post-list__meta--tags tags"><a href="https://mdramos.github.io/tag/deepstreamio/#blog" title="deepstream.io">deepstream.io</a>, <a href="https://mdramos.github.io/tag/deepstream/#blog" title=" deepstream"> deepstream</a>, <a href="https://mdramos.github.io/tag/aws-ami/#blog" title=" aws ami"> aws ami</a>, <a href="https://mdramos.github.io/tag/mongo/#blog" title=" mongo"> mongo</a>, <a href="https://mdramos.github.io/tag/redis/#blog" title=" redis"> redis</a></span>
</div>
<hr class="post-list__divider" />
</li>
</ol>
<hr class="post-list__divider " />
<nav class="pagination" role="navigation">
<span class="pagination__page-number">Page 1 of 1</span>
</nav>
</div>
<footer class="footer">
<span class="footer__copyright">© 2017. All rights reserved.</span>
<span class="footer__copyright"><a href="http://uno.daleanthony.com" title="link to page for Uno Ghost theme">Uno theme</a> by <a href="http://daleanthony.com" title="link to website for Dale-Anthony">Dale-Anthony</a></span>
<span class="footer__copyright">Proudly published with <a href="http://hubpress.io" title="link to Hubpress website">Hubpress</a></span>
</footer>
</div>
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js?v="></script> <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.min.js?v="></script> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js?v="></script>
<script type="text/javascript">
jQuery( document ).ready(function() {
// change date with ago
jQuery('ago.ago').each(function(){
var element = jQuery(this).parent();
element.html( moment(element.text()).fromNow());
});
});
hljs.initHighlightingOnLoad();
</script>
<script type="text/javascript" src="//mdramos.github.io/themes/my-uno/assets/js/main.js?v=1484786788264"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-85228335-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
| {
"content_hash": "c97e0ff02e3ae088168fba75aa049519",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 495,
"avg_line_length": 45.313131313131315,
"alnum_prop": 0.5829246544806064,
"repo_name": "mdramos/mdramos.github.io",
"id": "2343b9c1286b2cfa84cc27309f4b9d8800880f0c",
"size": "8972",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tag/deepstream/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "651070"
},
{
"name": "CoffeeScript",
"bytes": "6630"
},
{
"name": "HTML",
"bytes": "480923"
},
{
"name": "JavaScript",
"bytes": "23843"
},
{
"name": "Ruby",
"bytes": "806"
},
{
"name": "Shell",
"bytes": "2265"
}
],
"symlink_target": ""
} |
package com.felhr.usbmassstorageforandroid.bulkonly;
import commandwrappers.CommandStatusWrapper;
/**
* Created by Felipe Herranz(felhr85@gmail.com) on 11/12/14.
*/
public interface BulkOnlyStatusInterface
{
public void onOperationStarted(boolean status);
public void onOperationCompleted(CommandStatusWrapper csw);
public void onDataToHost(byte[] data);
}
| {
"content_hash": "9802735070918dba0dd6ab18dba02184",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 63,
"avg_line_length": 28.692307692307693,
"alnum_prop": 0.7908847184986595,
"repo_name": "felHR85/Pincho-Usb-Mass-Storage-for-Android",
"id": "73b4fa51217a2f5adab3d93f5c2c4bad9623c0e2",
"size": "373",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/felhr/usbmassstorageforandroid/bulkonly/BulkOnlyStatusInterface.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "188778"
}
],
"symlink_target": ""
} |
#region "Copyright"
/*
FOR FURTHER DETAILS ABOUT LICENSING, PLEASE VISIT "LICENSE.txt" INSIDE THE SAGEFRAME FOLDER
*/
#endregion
#region "References"
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SageFrame.Web;
#endregion
public partial class Modules_Admin_SageFrameInfo_SageFrameInfoView : BaseAdministrationUserControl
{
public string appPath = "";
public bool LoadLiveFeed = false;
protected void Page_Load(object sender, EventArgs e)
{
appPath = GetApplicationName;
SageFrameConfig pagebase = new SageFrameConfig();
LoadLiveFeed = bool.Parse(pagebase.GetSettingValueByIndividualKey(SageFrameSettingKeys.EnableLiveFeeds));
IncludeJs("SageFrameInfo", "/js/jquery.jgfeed-min.js");
IncludeCss("SageFrameInfo", "/Modules/Admin/SageFrameInfo/module.css");
}
}
| {
"content_hash": "fed5a05eae2469075372b825fe77857d",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 113,
"avg_line_length": 31,
"alnum_prop": 0.7603686635944701,
"repo_name": "AspxCommerce/AspxCommerce2.7",
"id": "ecd9a4fc00b5af2bf905a7a5f9fda8335066369b",
"size": "1087",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "SageFrame/Modules/Admin/SageFrameInfo/SageFrameInfoView.ascx.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "3715927"
},
{
"name": "C#",
"bytes": "10277427"
},
{
"name": "CSS",
"bytes": "1062325"
},
{
"name": "ColdFusion",
"bytes": "7712"
},
{
"name": "HTML",
"bytes": "479265"
},
{
"name": "JavaScript",
"bytes": "10130108"
},
{
"name": "PHP",
"bytes": "5655"
},
{
"name": "Perl",
"bytes": "4746"
}
],
"symlink_target": ""
} |
/**
* This package provides classes for dealing with <a href="http://www.w3.org/TR/microdata/">Microdata</a> extraction.
*/
package org.apache.any23.extractor.microdata; | {
"content_hash": "4fb047fbda3f872936c7a64c35ba2c9a",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 117,
"avg_line_length": 28.833333333333332,
"alnum_prop": 0.7341040462427746,
"repo_name": "lewismc/any23",
"id": "a255c45b1af38a8861affd25e7024dd36951ba20",
"size": "971",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "core/src/main/java/org/apache/any23/extractor/microdata/package-info.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "3004550"
},
{
"name": "Java",
"bytes": "2029230"
},
{
"name": "Shell",
"bytes": "1087"
},
{
"name": "XSLT",
"bytes": "38313"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.pnambic.depan</groupId>
<artifactId>depan-parent</artifactId>
<version>0.0.3-SNAPSHOT</version>
<packaging>pom</packaging>
<name>DepAn Maven Parent</name>
<description>Maven build context for all DepAn components</description>
<properties>
<java.version>1.8</java.version>
<tycho.compiler.version>1.0.0</tycho.compiler.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<tycho.version>1.0.0</tycho.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.compiler.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<!-- Target details are merged from release parents -->
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
</configuration>
</plugin>
</plugins>
</build>
</project>
| {
"content_hash": "0664d392bd2abb86358de631577a7072",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 204,
"avg_line_length": 33.094339622641506,
"alnum_prop": 0.6505131128848347,
"repo_name": "google/depan",
"id": "b63c821fb26c614aac1d0346878da13cdbc86f00",
"size": "1754",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "depan-parent/pom.xml",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "183176"
},
{
"name": "Java",
"bytes": "3002626"
},
{
"name": "Python",
"bytes": "4089"
},
{
"name": "Shell",
"bytes": "3792"
}
],
"symlink_target": ""
} |
<?xml version="1.0" ?>
<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<resources xmlns="https://api-platform.com/schema/metadata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.payment.class%" shortName="Payment">
<attribute name="validation_groups">sylius</attribute>
<attribute name="order">
<attribute name="createdAt">DESC</attribute>
</attribute>
<collectionOperations>
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/payments</attribute>
<attribute name="filters">
<attribute>sylius.api.search_payment_filter</attribute>
</attribute>
<attribute name="normalization_context">
<attribute name="groups">admin:payment:read</attribute>
</attribute>
</collectionOperation>
</collectionOperations>
<itemOperations>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/payments/{id}</attribute>
<attribute name="normalization_context">
<attribute name="groups">admin:payment:read</attribute>
</attribute>
</itemOperation>
<itemOperation name="shop_get">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/payments/{id}</attribute>
<attribute name="normalization_context">
<attribute name="groups">shop:payment:read</attribute>
</attribute>
</itemOperation>
<itemOperation name="admin_complete">
<attribute name="method">PATCH</attribute>
<attribute name="input">false</attribute>
<attribute name="path">/admin/payments/{id}/complete</attribute>
<attribute name="controller">Sylius\Bundle\ApiBundle\Applicator\PaymentStateMachineTransitionApplicatorInterface:complete</attribute>
<attribute name="openapi_context">
<attribute name="summary">Completes Payment</attribute>
</attribute>
</itemOperation>
</itemOperations>
<subresourceOperations>
<subresourceOperation name="methods_get_subresource">
<attribute name="method">GET</attribute>
<attribute name="path">/shop/payments/{id}/methods</attribute>
<attribute name="normalization_context">
<attribute name="groups">shop:payment:read</attribute>
</attribute>
</subresourceOperation>
</subresourceOperations>
<property name="id" identifier="true" writable="false" />
<property name="createdAt" writable="false" />
<property name="updatedAt" writable="false" />
<property name="method" writable="false">
<subresource resourceClass="%sylius.model.payment_method.class%" />
</property>
<property name="currencyCode" writable="false" />
<property name="amount" writable="false" />
<property name="state" writable="false" />
<property name="details" writable="false" />
<property name="order" writable="false" />
</resource>
</resources>
| {
"content_hash": "61726492aaa5336d22e5a6a1a16a8d32",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 149,
"avg_line_length": 42.79545454545455,
"alnum_prop": 0.5966542750929368,
"repo_name": "antonioperic/Sylius",
"id": "4c1109145d697ed9621eabe930f303df9b23d0c9",
"size": "3768",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/Payment.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Gherkin",
"bytes": "1131790"
},
{
"name": "JavaScript",
"bytes": "101490"
},
{
"name": "PHP",
"bytes": "7526630"
},
{
"name": "SCSS",
"bytes": "19063"
},
{
"name": "Shell",
"bytes": "13798"
},
{
"name": "Twig",
"bytes": "416166"
}
],
"symlink_target": ""
} |
import React from "react";
import { storiesOf } from "@storybook/react";
import { action } from "@storybook/addon-actions";
import MoveSectionModal from ".";
import CustomPropTypes from "custom-prop-types";
import { ApolloProvider } from "react-apollo";
import { buildQuestionnaire } from "tests/utils/createMockQuestionnaire";
class MoveSectionStory extends React.Component {
static propTypes = {
questionnaire: CustomPropTypes.questionnaire
};
state = {
isModalOpen: true
};
handleToggleModal = () => {
this.setState({ isModalOpen: !this.state.isModalOpen });
};
render() {
const { questionnaire } = this.props;
return (
<div>
<button type="button" onClick={this.handleToggleModal}>
move section
</button>
<MoveSectionModal
isOpen={this.state.isModalOpen}
onClose={this.handleToggleModal}
questionnaire={questionnaire}
section={questionnaire.sections[0]}
onMoveSection={action("moveSection")}
/>
</div>
);
}
}
const questionnaire = buildQuestionnaire(10);
const client = {
query: () => ({
questionnaire
})
};
storiesOf("MoveSectionModal", module).add("Modal", () => (
<ApolloProvider client={client}>
<MoveSectionStory questionnaire={buildQuestionnaire()} />
</ApolloProvider>
));
| {
"content_hash": "5d42f56fba3dc43dd5e82b13f1055362",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 73,
"avg_line_length": 25.942307692307693,
"alnum_prop": 0.6553002223869533,
"repo_name": "ONSdigital/eq-author",
"id": "2b1f724bec4c76e36e0ccda4b9d83ec7c12afada",
"size": "1349",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/components/MoveSectionModal/story.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "743"
},
{
"name": "HTML",
"bytes": "3619"
},
{
"name": "JavaScript",
"bytes": "1198277"
},
{
"name": "Shell",
"bytes": "2216"
}
],
"symlink_target": ""
} |
'use strict';
/*global triggerError, removeError, isEmpty*/
app.controller('AdminEditcomponentCtrl', ['$scope', 'business', '$timeout', '$uiModal', 'FileUploader',
function ($scope, Business, $timeout, $uiModal, FileUploader) {
$scope.predicate = [];
$scope.predicate['components'] = 'name';
$scope.predicate['eval'] = 'sortOrder';
$scope.reverse = [];
$scope.statusFilterOptions = [
{code: 'A', desc: 'Active'},
{code: 'I', desc: 'Inactive'}
];
$scope.queryFilter = angular.copy(utils.queryFilter);
$scope.queryFilter.max = 500;
$scope.queryFilter.sortField = 'name';
$scope.components = [];
$scope.filteredComponents = [];
$scope.allComponentsWatch = {};
$scope.allComponentsWatch.data = [];
$scope.flags = {};
$scope.flags.showUpload = false;
$scope.componentUploadOptions = {};
$scope.selectedComponents = [];
$scope.selectAllComps = {};
$scope.selectAllComps.flag = false;
$scope.submitter = null;
$scope.pagination = {};
$scope.pagination.control = {};
$scope.pagination.control.approvalState ='ALL';
$scope.pagination.control.componentType ='ALL';
$scope.pagination.features = {'dates': false, 'max': false};
$scope.$watch('allComponentsWatch', function(){
if ($scope.allComponentsWatch.data){
$scope.filteredComponents = $scope.allComponentsWatch.data.components || [];
}
}, true);
$scope.loadLookup = function(lookup, entity, loader){
$scope.$emit('$TRIGGERLOAD', loader);
Business.lookupservice.getLookupCodes(lookup, 'A').then(function (results) {
$scope.$emit('$TRIGGERUNLOAD', loader);
if (results) {
$scope[entity]= results;
}
});
};
$scope.loadLookup('SecurityMarkingType', 'securityTypes', 'generalFormLoader');
$scope.getSecurityDesc = function(type){
var found = _.find($scope.securityTypes, {'code': type});
return found? found.description : type;
}
$scope.setPredicate = function (predicate, table) {
if ($scope.predicate[table] === predicate) {
$scope.reverse[table] = !$scope.reverse[table];
} else {
$scope.predicate[table] = predicate;
$scope.reverse[table] = false;
}
if (table === 'components') {
$scope.pagination.control.changeSortOrder(predicate);
}
};
$scope.pagination.control.setPredicate = function(val){
$scope.setPredicate(val, 'components');
};
if ($scope.pagination.control) {
$scope.pagination.control.onRefresh = function(){
$scope.selectedComponents = [];
$scope.$emit('$TRIGGERUNLOAD', 'componentLoader');
}
}
$scope.refreshComponents = function () {
if ($scope.pagination.control && $scope.pagination.control.refresh) {
$scope.$emit('$TRIGGERLOAD', 'componentLoader');
$scope.pagination.control.refresh().then(function(){
$scope.selectedComponents = [];
$scope.$emit('$TRIGGERUNLOAD', 'componentLoader');
});
}
};
$scope.$on('$REFRESH_COMPONENTS', function(){
$scope.refreshComponents();
});
$scope.editComponent = function(component){
var modalInstance = $uiModal.open({
templateUrl: 'views/admin/component/editComponent.html',
controller: 'AdminComponentEditCtrl',
backdrop: 'static',
size: 'lg',
resolve: {
component: function () {
return component;
},
editMode: function(){
return true;
},
allComponents: function(){
return $scope.filteredComponents;
}
}
});
};
$scope.addComponent = function(){
var modalInstance = $uiModal.open({
templateUrl: 'views/admin/component/editComponent.html',
controller: 'AdminComponentEditCtrl',
backdrop: 'static',
size: 'lg',
resolve: {
component: function () {
return {};
},
editMode: function(){
return false;
},
allComponents: function(){
return $scope.filteredComponents;
}
}
});
};
$scope.toggleStatus = function(component){
var mode = 'INACTIVATE';
if (component.component.activeStatus !== 'A') {
mode = 'ACTIVATE';
}
var response = window.confirm("Are you sure you want " + mode + " " + component.component.name + "?");
if (response) {
$scope.$emit('$TRIGGERLOAD', 'componentLoader');
if (component.component.activeStatus === 'A') {
Business.componentservice.inactivateComponent(component.component.componentId).then(function (results) {
$scope.refreshComponents();
$scope.$emit('$TRIGGERUNLOAD', 'componentLoader');
});
} else {
Business.componentservice.activateComponent(component.component.componentId).then(function (results) {
$scope.refreshComponents();
$scope.$emit('$TRIGGERUNLOAD', 'componentLoader');
});
}
}
};
$scope.exportComponent = function(componentId){
window.location.href = "api/v1/resource/components/" + componentId + "/export";
};
$scope.preview = function(component) {
utils.openWindow('single?id='+ component.component.componentId, 'Component Preview', "resizable=yes,scrollbars=yes,height=650,width=1000");
};
$scope.deleteComponent = function(component){
var response = window.confirm("Are you sure you want DELETE "+ component.name + "?");
if (response) {
$scope.$emit('$TRIGGERLOAD', 'componentLoader');
Business.componentservice.deleteComponent(component.componentId).then(function (result) {
$scope.$emit('$TRIGGERUNLOAD', 'componentLoader');
$scope.refreshComponents();
});
}
};
$scope.selectComponent = function(component){
if (component.selected) {
component.selected = !component.selected;
if (component.selected === false) {
$scope.selectedComponents = _.reject($scope.selectedComponents, function(id) { return id === component.component.componentId; });
} else {
$scope.selectedComponents.push(component.component.componentId);
}
} else {
component.selected = true;
$scope.selectedComponents.push(component.component.componentId);
}
};
$scope.selectAllComponents = function(){
$scope.selectedComponents = [];
_.forEach($scope.filteredComponents, function(component){
component.selected = !$scope.selectAllComps.flag; //click happens before state change
if (component.selected) {
$scope.selectedComponents.push(component.component.componentId);
}
});
};
$scope.exportAll = function(){
//$scope.exportForm.submit();
document.exportForm.submit();
// window.location.href = "api/v1/resource/components/export";
};
$scope.componentUploader = new FileUploader({
url: 'Upload.action?UploadComponent',
alias: 'uploadFile',
queueLimit: 1,
removeAfterUpload: true,
onBeforeUploadItem: function(item) {
$scope.$emit('$TRIGGERLOAD', 'componentLoader');
item.formData.push({
"componentUploadOptions.uploadReviews" : $scope.componentUploadOptions.uploadReviews
});
item.formData.push({
"componentUploadOptions.uploadQuestions" : $scope.componentUploadOptions.uploadQuestions
});
item.formData.push({
"componentUploadOptions.uploadTags" : $scope.componentUploadOptions.uploadTags
});
item.formData.push({
"componentUploadOptions.uploadIntegration" : $scope.componentUploadOptions.uploadIntegration
});
},
onSuccessItem: function (item, response, status, headers) {
$scope.$emit('$TRIGGERUNLOAD', 'componentLoader');
//check response for a fail ticket or a error model
if (response.success) {
triggerAlert('Uploaded successfully. Processing components; watch tasks for completion.', 'importComponents', 'componentWindowDiv', 3000);
$scope.flags.showUpload = false;
} else {
if (response.errors) {
var uploadError = response.errors.uploadFile;
var errorMessage = uploadError !== undefined ? uploadError : ' ';
triggerAlert('Unable to upload component(s). Message: <br> ' + errorMessage, 'importComponents', 'componentWindowDiv', 6000);
} else {
triggerAlert('Unable to upload component(s). ', 'importComponents', 'componentWindowDiv', 6000);
}
}
},
onErrorItem: function (item, response, status, headers) {
$scope.$emit('$TRIGGERUNLOAD', 'resourceFormLoader');
triggerAlert('Unable to upload component(s). Failure communicating with server. ', 'importComponents', 'componentWindowDiv', 6000);
}
});
/*{
fixedOffset: $('#header') // how far from the top the table should fix to.,
scrollableArea: $('#header') //which surrounding element is scrolling.
}*/
// to resize manually -- $(window).trigger('resize.stickyTableHeaders');
var stickThatTable = function(){
var offset = $('.top').outerHeight() + $('#editComponentToolbar').outerHeight();
$(".stickytable").stickyTableHeaders({
fixedOffset: offset
});
}
$(window).resize(stickThatTable);
$timeout(stickThatTable, 100);
}]);
app.controller('AdminComponentEditCtrl', ['$scope', '$q', '$filter', '$uiModalInstance', 'component', 'editMode', 'allComponents', 'business', '$uiModal', '$draggable', 'FileUploader', '$rootScope', '$timeout',
function ($scope, $q, $filter, $uiModalInstance, component, editMode, allComponents, Business, $uiModal, $draggable, FileUploader, $rootScope, $timeout) {
$scope.editMode = editMode;
$scope.allComponents = allComponents;
$scope.editModeText = $scope.editMode ? 'Edit ' + component.component.name : 'Add Component';
$scope.componentForm = component.component !== undefined ? angular.copy(component.component) : {};
$scope.editorOptions = getCkBasicConfig(false);
$scope.integration = {};
$scope.sendAdminMessage = $rootScope.openAdminMessage;
$scope.business = Business;
$scope.statusFilterOptions = [
{code: 'A', desc: 'Active'},
{code: 'I', desc: 'Inactive'}
];
$scope.predicate = [];
$scope.reverse = [];
$scope.setupModal = function(componentId, enabled) {
var deferred = $q.defer();
var modalInstance = $uiModal.open({
templateUrl: 'views/admin/configuration/savecompconf.html',
controller: 'SavecompconfCtrl',
size: 'lg',
backdrop: 'static',
resolve: {
componentId: function(){
return componentId;
},
enabled: function() {
return enabled;
},
size: function() {
return 'lg';
}
}
});
modalInstance.result.then(function (result) {
}, function (result) {
$scope.$emit('$TRIGGERLOAD', 'generalFormLoader');
Business.componentservice.getComponent(componentId).then(function(results){
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'generalFormLoader');
$scope.componentForm = results.component;
$scope.integration.integrationText = results.integrationManagement;
if (results.integrationManagement){
$scope.flags.showIntegrationBanner = true;
} else {
$scope.flags.showIntegrationBanner = false;
}
}, function(results){
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'generalFormLoader');
});
});
deferred.resolve();
return deferred.promise;
};
$scope.getRelationship = function(type){
var found = _.find($scope.relationshipTypes, {'code': type});
if (found){
return found.description;
}
return '(Relationship not found)';
}
$scope.getComponentName = function(id){
var components = _.pluck($scope.allComponents, 'component');
var found = _.find(components, {'componentId': id});
if (found){
return found.name;
}
return '(Component not found)';
}
$scope.sendToSubmitter = function() {
var temp = [];
var templates = {
types: [{
title: 'Please add to these sections'
},{
title: 'Please review these sections'
},{
title: 'Please remove items from these sections'
}],
templates: [{
title: 'Description'
}, {
title: 'Attributes'
}, {
title: 'Contacts'
}, {
title: 'Resources'
}, {
title: 'Media'
}, {
title: 'Dependencies'
}, {
title: 'Tags'
}
]
}
temp.push($scope.submitter);
if (temp && temp.length) {
// console.log('component', component);
$scope.sendAdminMessage('users', temp, 'Please Review Your Submission "'+ component.component.name +'"', templates, true);
} else {
triggerAlert('You are unable to send a message to this user. (They could be deactivated or without an email address)', 'failedMessage', 'body', '8000')
}
}
var basicForm = {
saveText: 'Add',
edit: false
};
var basicFilter = {
status: $scope.statusFilterOptions[0]
};
$scope.generalForm = {};
$scope.generalForm.requiredAttribute = {};
$scope.flags = {};
if (component.integrationManagement){
$scope.flags.showIntegrationBanner = true;
$scope.integration.integrationText = component.integrationManagement;
}
$scope.componentAttributeQueryFilter = angular.copy(utils.queryFilter);
$scope.attributeForm = angular.copy(basicForm);
$scope.componentAttributeViewQueryFilter = angular.copy(utils.queryFilter);
$scope.componentAttributeViewQueryFilter.status = $scope.statusFilterOptions[0].code;
$scope.relationshipForm = angular.copy(basicForm);
$scope.componentRelationshipViewQueryFilter = angular.copy(utils.queryFilter);
$scope.componentRelationshipViewQueryFilter.status = $scope.statusFilterOptions[0].code;
$scope.contactForm = angular.copy(basicForm);
$scope.contactQueryFilter = angular.copy(utils.queryFilter);
$scope.contactQueryFilter.status = $scope.statusFilterOptions[0].code;
$scope.resourceForm = angular.copy(basicForm);
$scope.resourceQueryFilter = angular.copy(utils.queryFilter);
$scope.resourceQueryFilter.status = $scope.statusFilterOptions[0].code;
$scope.mediaForm = angular.copy(basicForm);
$scope.mediaQueryFilter = angular.copy(utils.queryFilter);
$scope.mediaQueryFilter.status = $scope.statusFilterOptions[0].code;
$scope.dependencyForm = angular.copy(basicForm);
$scope.dependencyFilter = angular.copy(utils.queryFilter);
$scope.dependencyFilter.status = $scope.statusFilterOptions[0].code;
$scope.metadataForm = angular.copy(basicForm);
$scope.metadataFilter = angular.copy(utils.queryFilter);
$scope.metadataFilter.status = $scope.statusFilterOptions[0].code;
$scope.evaluationForm = {};
$scope.tagForm = angular.copy(basicForm);
$scope.tagFilter = angular.copy(utils.queryFilter);
$scope.tagFilter.status = $scope.statusFilterOptions[0].code;
$scope.reviewFilter = angular.copy(utils.queryFilter);
$scope.reviewFilter.status = $scope.statusFilterOptions[0].code;
$scope.questionFilter = angular.copy(utils.queryFilter);
$scope.questionFilter.status = $scope.statusFilterOptions[0].code;
$scope.questionDetailsShow = [];
$scope.EMAIL_REGEXP = /^[a-z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-z0-9-]+(\.[a-z0-9-]+)*$/i;
$scope.setPredicate = function (predicate, table) {
if ($scope.predicate[table] === predicate) {
$scope.reverse[table] = !$scope.reverse[table];
} else {
$scope.predicate[table] = predicate;
$scope.reverse[table] = false;
}
};
//<editor-fold desc="COMMON Section">
$scope.loadLookup = function(lookup, entity, loader){
$scope.$emit('$TRIGGERLOAD', loader);
Business.lookupservice.getLookupCodes(lookup, 'A').then(function (results) {
$scope.$emit('$TRIGGERUNLOAD', loader);
if (results) {
$scope[entity]= results;
}
});
};
$scope.loadEntity = function(entityOptions){
if ($scope.componentForm.componentId) {
$scope.$emit('$TRIGGERLOAD', entityOptions.loader);
Business.componentservice.getComponentSubEntity({
componentId: $scope.componentForm.componentId,
entity: entityOptions.entity,
queryParamFilter: entityOptions.filter
}).then(function (results) {
$scope.$emit('$TRIGGERUNLOAD', entityOptions.loader);
if (results) {
$scope[entityOptions.entity] = results;
if (entityOptions.callback){
entityOptions.callback(results);
}
}
});
}
};
$scope.toggleEntityStatus = function(entityOptions){
$scope.$emit('$TRIGGERLOAD', entityOptions.loader);
if(entityOptions.entity.activeStatus === 'A') {
Business.componentservice.inactivateEnity({
componentId: $scope.componentForm.componentId,
entityId: entityOptions.entityId,
entity: entityOptions.entityName
}).then(function (results) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', entityOptions.loader);
entityOptions.loadEntity();
});
} else {
Business.componentservice.activateEntity({
componentId: $scope.componentForm.componentId,
entityId: entityOptions.entityId,
entity: entityOptions.entityName
}).then(function (results) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', entityOptions.loader);
entityOptions.loadEntity();
});
}
};
$scope.editEntity = function(form, entity){
$scope[form] = angular.copy(entity);
$scope[form].saveText = "Update";
$scope[form].edit = true;
$scope[form].collapse = false;
};
$scope.cancelEdit = function(form){
$scope[form] = {};
$scope[form].saveText = "Add";
$scope[form].edit = false;
};
$scope.saveEntity = function(options){
$scope.$emit('$TRIGGERLOAD', options.loader);
if ($scope[options.formName].edit){
Business.componentservice.updateSubComponentEntity({
componentId: $scope.componentForm.componentId,
entityName: options.entityName,
entity: options.entity,
entityId: options.entityId
}).then(function (result) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', options.loader);
if (result) {
if (result && result !== 'false' && isNotRequestError(result)){
removeError();
triggerAlert('Saved successfully', options.alertId, options.alertDiv, 3000);
$scope.cancelEdit(options.formName);
options.loadEntity();
} else {
removeError();
triggerError(result, true);
}
}
});
} else {
Business.componentservice.addSubComponentEntity({
componentId: $scope.componentForm.componentId,
entityName: options.entityName,
entity: options.entity
}).then(function (result) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', options.loader);
if (result) {
if (result && result !== 'false' && isNotRequestError(result)){
removeError();
triggerAlert('Saved successfully', options.alertId, options.alertDiv, 3000);
$scope.cancelEdit(options.formName);
options.loadEntity();
} else {
removeError();
triggerError(result, true);
}
}
});
}
};
$scope.hardDeleteEntity = function(options){
var response = window.confirm("Are you sure you want to DELETE "+ options.entityName + "?");
if (response) {
$scope.$emit('$TRIGGERLOAD', options.loader);
Business.componentservice.forceRemoveEnity({
componentId: $scope.componentForm.componentId,
entity: options.entityPath,
entityId: options.entityId
}).then(function (result) {
$scope.$emit('$TRIGGERUNLOAD', options.loader);
options.loadEntity();
});
}
};
//</editor-fold>
//<editor-fold desc="General Section">
$scope.loadComponentList = function(){
Business.componentservice.getComponentLookupList().then(function (results) {
if (results) {
$scope.parentComponents = results;
$scope.parentComponents.push({
code: '',
description: ' '
});
$scope.generalForm.parentComp = _.find($scope.parentComponents, {code: $scope.componentForm.parentComponentId});
}
});
};
$scope.loadApprovalStatus = function(){
Business.componentservice.getComponentApproveStatus().then(function (results) {
if (results) {
$scope.approvalStatuses = results;
}
});
};
$scope.getAttributes = function (override) {
Business.getFilters(override, false).then(function (result) {
$scope.allAttributes = result ? angular.copy(result) : [];
$scope.requiredAttributes = _.filter($scope.allAttributes, {requiredFlg: true});
});
};
$scope.loadComponentAttributes = function(){
if ($scope.componentForm.componentId) {
$scope.componentAttributeQueryFilter.status = 'A';
Business.componentservice.getComponentAttributes($scope.componentForm.componentId, $scope.componentAttributeQueryFilter).then(function (results) {
if (results) {
$scope.activeComponentAttributes = results;
_.forEach($scope.activeComponentAttributes, function (item) {
$scope.generalForm.requiredAttribute[item.componentAttributePk.attributeType] = item.componentAttributePk.attributeCode;
});
}
});
}
};
$scope.loadAllComponentForms = function(){
$scope.$emit('$TRIGGERLOAD', 'generalFormLoader');
var deferred = $q.defer();
deferred.promise.then(function(){
$scope.loadComponentList();
}).then(function(){
$scope.loadApprovalStatus();
}).then(function(){
$scope.getAttributes(true);
}).then(function(){
$scope.loadComponentAttributes();
}).then(function(){
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'generalFormLoader');
});
deferred.resolve('Start');
};
$scope.loadAllComponentForms();
$scope.getCodesForType = function(type){
var foundType = _.find($scope.allAttributes, {attributeType: type});
return foundType !== undefined ? foundType.codes : [];
};
$scope.loadLookup('ComponentType', 'componentTypes', 'generalFormLoader');
$scope.loadLookup('SecurityMarkingType', 'securityTypes', 'generalFormLoader');
$scope.saveComponent = function(){
$scope.$emit('$TRIGGERLOAD', 'generalFormLoader');
var requiredForComponent = {
component: $scope.componentForm,
attributes: []
};
//default the type to Component
if (requiredForComponent.component && !requiredForComponent.ComponentType) {
requiredForComponent.component.componentType = requiredForComponent.component.componentType || 'COMP';
}
var missingRequiredAttributes = false;
_.forEach($scope.requiredAttributes, function(attribute) {
var found = false;
_.forOwn($scope.generalForm.requiredAttribute, function (value, key) {
if (attribute.attributeType === key) {
found = true;
}
});
if (found === false) {
missingRequiredAttributes = true;
}
});
if (missingRequiredAttributes) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'generalFormLoader');
triggerAlert('Missing Required Attributes. Select all required attributes before saving.', 'saveGeneralComponent', 'componentWindowDiv', 3000);
return;
}
_.forOwn($scope.generalForm.requiredAttribute, function (value, key) {
requiredForComponent.attributes.push({
componentAttributePk: {
attributeType: key,
attributeCode: value
}
});
});
if (requiredForComponent.component.releaseDate){
requiredForComponent.component.releaseDate = $filter('date')(requiredForComponent.component.releaseDate, "yyyy-MM-dd'T'HH:mm:ss.sss");
//requiredForComponent.component.releaseDate = requiredForComponent.component.releaseDate.sub
}
if ($scope.editMode){
Business.componentservice.updateComponent(requiredForComponent, $scope.componentForm.componentId).then(function (result) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'generalFormLoader');
if (result) {
if (result && result !== 'false' && isNotRequestError(result)){
removeError();
triggerAlert('Saved successfully', 'saveGeneralComponent', 'componentWindowDiv', 3000);
$scope.componentForm = result.component;
$scope.$emit('$TRIGGEREVENT', '$REFRESH_COMPONENTS');
} else {
removeError();
triggerError(result, true);
}
}
});
} else {
console.log('requiredForComponent', requiredForComponent);
Business.componentservice.addComponent(requiredForComponent).then(function (result) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'generalFormLoader');
if (result) {
if (result && result !== 'false' && isNotRequestError(result)){
removeError();
triggerAlert('Saved successfully', 'saveGeneralComponent', 'componentWindowDiv', 3000);
$scope.componentForm = result.component;
$scope.editMode = true;
$scope.editModeText = 'Edit ' + $scope.componentForm.name;
$scope.loadEvaluationInfo();
$scope.$emit('$TRIGGEREVENT', '$REFRESH_COMPONENTS');
} else {
removeError();
triggerError(result, true);
}
}
});
}
};
//</editor-fold>
//<editor-fold desc="ATTRIBUTE Section">
$scope.loadComponentAttributesView = function(){
if ($scope.componentForm.componentId) {
$scope.$emit('$TRIGGERLOAD', 'attributeFormLoader');
Business.componentservice.getComponentAttributeView($scope.componentForm.componentId, $scope.componentAttributeViewQueryFilter).then(function (results) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'attributeFormLoader');
if (results) {
$scope.componentAttributesView = results;
$scope.componentAttributesView = _.filter($scope.componentAttributesView, {requiredFlg: false});
}
});
}
};
$scope.loadComponentAttributesView();
$scope.toggleAttributeStatus = function(attribute){
$scope.$emit('$TRIGGERLOAD', 'attributeFormLoader');
if(attribute.activeStatus === 'A') {
Business.componentservice.inactivateAttribute($scope.componentForm.componentId, attribute.type, attribute.code).then(function (results) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'attributeFormLoader');
$scope.loadComponentAttributesView();
});
} else {
Business.componentservice.activateAttribute($scope.componentForm.componentId, attribute.type, attribute.code).then(function (results) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'attributeFormLoader');
$scope.loadComponentAttributesView();
});
}
};
$scope.deleteAttribute = function(attribute) {
var response = window.confirm("Are you sure you want to DELETE attribute "+ attribute.typeDescription + "?");
if (response) {
$scope.$emit('$TRIGGERLOAD', 'attributeFormLoader');
Business.componentservice.deleteAttribute($scope.componentForm.componentId, attribute.type, attribute.code).then(function (results) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'attributeFormLoader');
$scope.loadComponentAttributesView();
});
}
};
$scope.saveAttribute = function(){
$scope.$emit('$TRIGGERLOAD', 'attributeFormLoader');
var componentAttribute = {
componentAttributePk: {
attributeType : $scope.attributeForm.type,
attributeCode : $scope.attributeForm.code
}
};
Business.componentservice.saveAttribute($scope.componentForm.componentId, componentAttribute).then(function (result) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'attributeFormLoader');
if (result){
if (result && result !== 'false' && isNotRequestError(result)) {
removeError();
triggerAlert('Saved successfully', 'saveAttributes', 'componentWindowDiv', 3000);
$scope.attributeForm.type = "";
$scope.attributeForm.code = "";
$scope.loadComponentAttributesView();
} else {
removeError();
triggerError(result, true);
}
}
});
};
//</editor-fold>
//<editor-fold desc="RELATIONSHIP Section">
$scope.loadLookup('RelationshipType', 'relationshipTypes', 'relationshipFormLoader');
$scope.loadComponentRelationshipsView = function(){
if ($scope.componentForm.componentId) {
$scope.$emit('$TRIGGERLOAD', 'relationshipFormLoader');
Business.componentservice.getComponentRelationships($scope.componentForm.componentId, $scope.componentRelationshipViewQueryFilter).then(function (results) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'relationshipFormLoader');
if (results) {
$scope.componentRelationshipsView = results;
}
});
}
};
$scope.loadComponentRelationshipsView();
$scope.deleteRelationship = function(relationship) {
var response = window.confirm("Are you sure you want to DELETE relationship — "+ relationship.ownerComponentName + ' ' + relationship.relationshipTypeDescription + ' ' + relationship.targetComponentName + "?");
if (response) {
$scope.$emit('$TRIGGERLOAD', 'relationshipFormLoader');
Business.componentservice.deleteRelationship($scope.componentForm.componentId, relationship.relationshipId).then(function (results) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'relationshipFormLoader');
$scope.loadComponentRelationshipsView();
});
}
};
$scope.saveRelationship = function(){
$scope.$emit('$TRIGGERLOAD', 'relationshipFormLoader');
var componentRelationship = {
relationshipType: $scope.relationshipForm.type,
relatedComponentId: $scope.relationshipForm.target,
securityMarkingType: $scope.relationshipForm.securityMarkingType
};
Business.componentservice.saveRelationship($scope.componentForm.componentId, componentRelationship).then(function (result) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'relationshipFormLoader');
if (result){
if (result && result !== 'false' && isNotRequestError(result)) {
removeError();
triggerAlert('Saved successfully', 'saveRelationships', 'componentWindowDiv', 3000);
$scope.relationshipForm.type = "";
$scope.relationshipForm.target = "";
$scope.relationshipForm.securityMarkingType = "";
$scope.loadComponentRelationshipsView();
} else {
removeError();
triggerError(result, true);
}
}
});
};
//</editor-fold>
//<editor-fold desc="Contact Section">
$scope.loadLookup('ContactType', 'contactTypes', 'contactFormLoader');
$scope.loadContacts = function() {
$scope.loadEntity({
filter: $scope.contactQueryFilter,
entity: 'contacts',
loader: 'contactFormLoader',
callback: function(result){
var found = _.find(result, {'contactType': 'SUB'});
if (found){
$scope.submitter = angular.copy(found);
}
}
});
};
$scope.loadContacts();
$scope.toggleContactStatus = function(contact){
$scope.toggleEntityStatus({
entity: contact,
entityId: contact.contactId,
entityName: 'contacts',
loader: 'contactFormLoader',
loadEntity: function(){
$scope.loadContacts();
}
});
};
$scope.saveContact = function () {
delete $scope.contactForm.type;
$scope.saveEntity({
alertId: 'saveContact',
alertDiv: 'contactManagementDivId',
loader: 'contactFormLoader',
entityName: 'contacts',
entity: $scope.contactForm,
entityId: $scope.contactForm.contactId,
formName: 'contactForm',
loadEntity: function () {
$scope.loadContacts();
}
});
};
//</editor-fold>
//<editor-fold desc="Resource Section">
$scope.loadLookup('ResourceType', 'resourceTypes', 'resourceFormLoader');
$scope.loadResources = function() {
$scope.loadEntity({
filter: $scope.resourceQueryFilter,
entity: 'resources',
loader: 'resourceFormLoader'
});
};
$scope.loadResources();
$scope.toggleResourceStatus = function(resource){
$scope.toggleEntityStatus({
entity: resource,
entityId: resource.resourceId,
entityName: 'resources',
loader: 'resourceFormLoader',
loadEntity: function(){
$scope.loadResources();
}
});
};
$scope.deleteResource = function(resource){
$scope.hardDeleteEntity({
loader: 'resourceFormLoader',
entityName: 'Resource',
entityPath: 'resources',
entityId: resource.resourceId,
loadEntity: function(){
$scope.loadResources();
}
});
};
$scope.saveResource = function () {
$scope.resourceForm.link = $scope.resourceForm.originalLink;
if ($scope.resourceForm.originalLink ||
$scope.resourceUploader.queue.length === 0) {
if (!$scope.resourceForm.originalLink) {
$scope.resourceForm.fileName = $scope.resourceForm.localResourceName;
$scope.resourceForm.originalName = $scope.resourceForm.originalFileName;
} else {
$scope.resourceForm.mimeType = '';
}
$scope.saveEntity({
alertId: 'saveResource',
alertDiv: 'componentWindowDiv',
loader: 'resourceFormLoader',
entityName: 'resources',
entity: $scope.resourceForm,
entityId: $scope.resourceForm.resourceId,
formName: 'resourceForm',
loadEntity: function () {
$scope.loadResources();
}
});
} else {
$scope.resourceUploader.uploadAll();
}
};
$scope.cancelResourceEdit = function () {
$scope.cancelEdit('resourceForm');
};
$scope.resourceUploader = new FileUploader({
url: 'Resource.action?UploadResource',
alias: 'file',
queueLimit: 1,
removeAfterUpload: true,
onAfterAddingFile: function(file){
if (file._file && file._file.size && file._file.size >= 104857600) {
triggerAlert('The file you have selected exceeds the file size limit of 100MB and will not be uploaded.', 'mediaLoader', 'body', 7000);
this.removeFromQueue(file);
$scope.cancelResourceEdit();
return;
}
},
onBeforeUploadItem: function(item) {
$scope.$emit('$TRIGGERLOAD', 'resourceFormLoader');
item.formData.push({
"componentResource.componentId" : $scope.componentForm.componentId
});
item.formData.push({
"componentResource.resourceType" : $scope.resourceForm.resourceType
});
item.formData.push({
"componentResource.description" : $scope.resourceForm.description
});
item.formData.push({
"componentResource.restricted" : $scope.resourceForm.restricted
});
item.formData.push({
"componentResource.securityMarkingType" : $scope.resourceForm.securityMarkingType
});
if ($scope.resourceForm.resourceId) {
item.formData.push({
"componentResource.resourceId" : $scope.resourceForm.resourceId
});
}
},
onSuccessItem: function (item, response, status, headers) {
$scope.$emit('$TRIGGERUNLOAD', 'resourceFormLoader');
//check response for a fail ticket or a error model
if (response.success) {
triggerAlert('Uploaded successfully', 'saveResource', 'componentWindowDiv', 3000);
$scope.cancelResourceEdit();
$scope.loadResources();
} else {
if (response.errors) {
var uploadError = response.errors.file;
var enityError = response.errors.componentResource;
var errorMessage = uploadError !== undefined ? uploadError : ' ' + enityError !== undefined ? enityError : '';
triggerAlert('Unable to upload resource. Message: <br> ' + errorMessage, 'saveResource', 'componentWindowDiv', 6000);
} else {
triggerAlert('Unable to upload resource. ', 'saveResource', 'componentWindowDiv', 6000);
}
}
},
onErrorItem: function (item, response, status, headers) {
$scope.$emit('$TRIGGERUNLOAD', 'resourceFormLoader');
triggerAlert('Unable to upload resource. Failure communicating with server. ', 'saveResource', 'componentWindowDiv', 6000);
},
onCompleteAll: function(){
document.resourceUIForm.uploadFile.value = null;
$scope.resourceUploader.queue = [];
}
});
//</editor-fold>
//<editor-fold desc="Media Section">
$scope.loadLookup('MediaType', 'mediaTypes', 'mediaFormLoader');
$scope.loadMedia = function () {
$scope.loadEntity({
filter: $scope.mediaQueryFilter,
entity: 'media',
loader: 'mediaFormLoader'
});
};
$scope.loadMedia();
$scope.deleteMedia = function(media){
$scope.hardDeleteEntity({
loader: 'mediaFormLoader',
entityName: 'Media',
entityPath: 'media',
entityId: media.componentMediaId,
loadEntity: function(){
$scope.loadMedia();
}
});
};
$scope.toggleMediaStatus = function(media){
$scope.toggleEntityStatus({
entity: media,
entityId: media.componentMediaId,
entityName: 'media',
loader: 'mediaFormLoader',
loadEntity: function(){
$scope.loadMedia();
}
});
};
$scope.setUploadInput = function(uploader, form){
if ($scope[uploader]
&& $scope[uploader]._directives
&& $scope[uploader]._directives.select
&& $scope[uploader]._directives.select.length
&& $scope[uploader]._directives.select[0].element
&& $scope[uploader]._directives.select[0].element.length
&& $scope[uploader]._directives.select[0].element[0].files
&& $scope[uploader]._directives.select[0].element[0].files.length) {
$scope[form].uploadInput = true;
} else {
$scope[uploader].clearQueue();
$scope[form].uploadInput = false;
}
}
$scope.saveMedia = function () {
$scope.mediaForm.link = $scope.mediaForm.originalLink;
if ($scope.mediaForm.originalLink ||
$scope.mediaUploader.queue.length === 0) {
if (!$scope.mediaForm.originalLink) {
$scope.mediaForm.originalName = $scope.mediaForm.originalFileName;
} else {
$scope.mediaForm.mimeType = '';
}
$scope.saveEntity({
alertId: 'saveMedia',
alertDiv: 'componentWindowDiv',
loader: 'mediaFormLoader',
entityName: 'media',
entity: $scope.mediaForm,
entityId: $scope.mediaForm.componentMediaId,
formName: 'mediaForm',
loadEntity: function () {
$scope.loadMedia();
}
});
} else {
$scope.mediaUploader.uploadAll();
}
};
$scope.cancelMediaEdit = function () {
$scope.cancelEdit('mediaForm');
};
$scope.mediaUploader = new FileUploader({
url: 'Media.action?UploadMedia',
alias: 'file',
queueLimit: 1,
removeAfterUpload: true,
onAfterAddingFile: function(file){
if (file._file && file._file.size && file._file.size >= 104857600) {
triggerAlert('The file you have selected exceeds the file size limit of 100MB and will not be uploaded.', 'mediaLoader', 'body', 7000);
this.removeFromQueue(file);
$scope.cancelMediaEdit();
return;
}
},
onBeforeUploadItem: function(item) {
$scope.$emit('$TRIGGERLOAD', 'mediaFormLoader');
item.formData.push({
"componentMedia.componentId" : $scope.componentForm.componentId
});
item.formData.push({
"componentMedia.mediaTypeCode" : $scope.mediaForm.mediaTypeCode
});
item.formData.push({
"componentMedia.securityMarkingType" : $scope.mediaForm.securityMarkingType
});
if ($scope.mediaForm.caption) {
item.formData.push({
"componentMedia.caption": $scope.mediaForm.caption
});
}
if ($scope.mediaForm.componentMediaId) {
item.formData.push({
"componentMedia.componentMediaId": $scope.mediaForm.componentMediaId
});
}
console.log('item', item);
},
onSuccessItem: function (item, response, status, headers) {
$scope.$emit('$TRIGGERUNLOAD', 'mediaFormLoader');
//check response for a fail ticket or a error model
if (response.success) {
triggerAlert('Uploaded successfully', 'saveResource', 'componentWindowDiv', 3000);
$scope.cancelMediaEdit();
$scope.loadMedia();
} else {
if (response.errors) {
var uploadError = response.errors.file;
var enityError = response.errors.componentMedia;
var errorMessage = uploadError !== undefined ? uploadError : ' ' + enityError !== undefined ? enityError : '';
triggerAlert('Unable to upload media. Message: <br> ' + errorMessage, 'saveMedia', 'componentWindowDiv', 6000);
} else {
triggerAlert('Unable to upload media. ', 'saveMedia', 'componentWindowDiv', 6000);
}
}
},
onErrorItem: function (item, response, status, headers) {
$scope.$emit('$TRIGGERUNLOAD', 'mediaFormLoader');
triggerAlert('Unable to upload media. Failure communicating with server. ', 'saveMedia', 'componentWindowDiv', 6000);
},
onCompleteAll: function(){
document.mediaUIForm.uploadFile.value = null;
$scope.mediaUploader.queue = [];
}
});
//</editor-fold>
//<editor-fold desc="Dependancy Section">
$scope.loadDependancies = function() {
$scope.loadEntity({
filter: $scope.dependencyFilter,
entity: 'dependencies',
loader: 'dependencyFormLoader'
});
};
$scope.loadDependancies();
$scope.toggleDependancyStatus = function(depend){
$scope.toggleEntityStatus({
entity: depend,
entityId: depend.dependencyId,
entityName: 'dependencies',
loader: 'dependencyFormLoader',
loadEntity: function(){
$scope.loadDependancies();
}
});
};
$scope.saveDependancy = function () {
$scope.saveEntity({
alertId: 'saveDependancy',
alertDiv: 'componentWindowDiv',
loader: 'dependencyFormLoader',
entityName: 'dependencies',
entity: $scope.dependencyForm,
entityId: $scope.dependencyForm.dependencyId,
formName: 'dependencyForm',
loadEntity: function () {
$scope.loadDependancies();
}
});
};
//</editor-fold>
//<editor-fold desc="Metadata Section">
$scope.loadMetadata = function() {
$scope.loadEntity({
filter: $scope.metadataFilter,
entity: 'metadata',
loader: 'metadataFormLoader'
});
};
$scope.loadMetadata();
$scope.toggleMetadataStatus = function(meta){
$scope.toggleEntityStatus({
entity: meta,
entityId: meta.metadataId,
entityName: 'metadata',
loader: 'metadataFormLoader',
loadEntity: function(){
$scope.loadMetadata();
}
});
};
$scope.saveMetadata = function () {
$scope.saveEntity({
alertId: 'saveMetadata',
alertDiv: 'componentWindowDiv',
loader: 'metadataFormLoader',
entityName: 'metadata',
entity: $scope.metadataForm,
entityId: $scope.metadataForm.metadataId,
formName: 'metadataForm',
loadEntity: function () {
$scope.loadMetadata();
}
});
};
//</editor-fold>
//<editor-fold desc="Evaluation Section">
$scope.loadEvaluationInfo = function(){
$scope.$emit('$TRIGGERLOAD', 'evaluationLoader');
Business.lookupservice.getLookupCodes('EvaluationSection', 'A').then(function (results) {
if (results) {
$scope.activeSections = results;
if ($scope.componentForm.componentId) {
Business.componentservice.getEvaluationSections($scope.componentForm.componentId).then(function (data) {
$scope.$emit('$TRIGGERUNLOAD', 'evaluationLoader');
if (data) {
$scope.allSections = data;
$scope.sections = [];
$scope.oldSections = [];
_.forEach($scope.allSections, function(record){
var foundSection = _.find($scope.activeSections, {code : record.evaluationSection});
if (foundSection) {
$scope.sections.push(record);
} else {
$scope.oldSections.push(record);
}
});
_.forEach($scope.activeSections, function(record){
var foundSection = _.find($scope.allSections, {evaluationSection : record.code});
if (!foundSection) {
$scope.sections.push({
name: record.description,
evaluationSection: record.code,
sortOrder: record.sortOrder
});
}
});
var found = false;
_.each($scope.sections, function(section){
if (section.sortOrder) {
found = true;
}
})
if (found) {
$scope.sections = _.sortBy($scope.sections, 'sortOrder');
} else {
$scope.sections = _.sortBy($scope.sections, 'name');
}
$scope.oldSections = _.sortBy($scope.oldSections, 'name');
}
});
} else {
$scope.$emit('$TRIGGERUNLOAD', 'evaluationLoader');
}
}
});
};
$scope.loadEvaluationInfo();
$scope.clearAllEvaluationSections = function(){
var response = window.confirm("Are you sure you want to DELETE all evaluation information for this component?");
if (response) {
$scope.$emit('$TRIGGERLOAD', 'evaluationLoader');
Business.componentservice.deleteAllEvaluationSection($scope.componentForm.componentId).then(function (results) {
$scope.$emit('$TRIGGERUNLOAD', 'evaluationLoader');
triggerAlert('Remove all successfully', 'saveEvalSection', 'componentWindowDiv', 3000);
$scope.loadEvaluationInfo();
});
}
};
$scope.saveEvalSection = function(section){
if (section.actualScore) {
if (section.actualScore < 1){
section.actualScore = 1;
} else if (section.actualScore > 5){
section.actualScore = 5;
}
}
$scope.saveEntity({
alertId: 'saveEvalSection',
alertDiv: 'componentWindowDiv',
loader: 'evaluationFormLoader',
entityName: 'sections',
entity: {
"componentEvaluationSectionPk": {
"evaluationSection": section.evaluationSection
},
"actualScore": section.actualScore,
"notAvailable": section.notAvailable
},
entityId: section.evaluationSection,
formName: 'evaluationForm',
loadEntity: function () {
$scope.loadEvaluationInfo();
}
});
};
$scope.removeEvaluationSection = function(section){
var response = window.confirm("Are you sure you want to DELETE section " + section.name + " for this component? (This will reset any unsaved changes)");
if (response) {
$scope.$emit('$TRIGGERLOAD', 'evaluationLoader');
Business.componentservice.deleteEvaluationSection($scope.componentForm.componentId, section.evaluationSection).then(function (results) {
$scope.$emit('$TRIGGERUNLOAD', 'evaluationLoader');
$scope.loadEvaluationInfo();
});
}
};
$scope.checkEvalScore = function(section){
if (section.actualScore) {
if (section.actualScore < 1) {
section.actualScore = 1;
} else if (section.actualScore > 5) {
section.actualScore = 5;
}
}
};
$scope.saveAllEvalSections = function () {
var allSections = [];
_.forEach($scope.sections, function (section) {
if (section.actualScore) {
if (section.actualScore < 1) {
section.actualScore = 1;
} else if (section.actualScore > 5) {
section.actualScore = 5;
}
}
allSections.push({
"componentEvaluationSectionPk": {
"evaluationSection": section.evaluationSection
},
"actualScore": section.actualScore,
"notAvailable": section.notAvailable
});
});
$scope.$emit('$TRIGGERLOAD', 'evaluationLoader');
Business.componentservice.saveAllEvaluationSections({
componentId: $scope.componentForm.componentId,
sections: allSections
}).then(function (results) {
$scope.$emit('$TRIGGERUNLOAD', 'evaluationLoader');
triggerAlert('Saved all successfully', 'saveEvalSection', 'componentWindowDiv', 3000);
$scope.loadEvaluationInfo();
});
};
//</editor-fold>
//<editor-fold desc="Tags Section">
$scope.loadTags = function() {
if ($scope.componentForm.componentId) {
$scope.$emit('$TRIGGERLOAD', 'tagFormLoader');
Business.componentservice.getComponentTagViews($scope.componentForm.componentId).then(function (results) {
$scope.$emit('$TRIGGERUNLOAD', 'tagFormLoader');
if (results) {
$scope.tags = results;
}
}, function(){
});
}
$scope.tagForm.securityMarkingType = '';
$scope.tagForm.text = '';
};
$scope.loadTags();
$scope.saveTag = function () {
$scope.saveEntity({
alertId: 'saveTag',
alertDiv: 'componentWindowDiv',
loader: 'tagFormLoader',
entityName: 'tags',
entity: $scope.tagForm,
entityId: $scope.tagForm.tagId,
formName: 'tagForm',
loadEntity: function () {
$scope.loadTags();
}
});
};
$scope.removeTag = function(tag){
$scope.$emit('$TRIGGERLOAD', 'tagFormLoader');
Business.componentservice.inactivateEnity({
componentId: $scope.componentForm.componentId,
entityId: tag.tagId,
entity: 'tags'
}).then(function (results) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'tagFormLoader');
$scope.loadTags();
});
};
//</editor-fold>
//<editor-fold desc="Reviews Section">
$scope.loadReviews = function() {
$scope.loadEntity({
filter: $scope.reviewFilter,
entity: 'reviews',
loader: 'reviewFormLoader'
});
};
$scope.loadReviews();
$scope.toggleReviewStatus = function(review){
$scope.toggleEntityStatus({
entity: review,
entityId: review.reviewId,
entityName: 'reviews',
loader: 'reviewFormLoader',
loadEntity: function(){
$scope.loadReviews();
}
});
};
//</editor-fold>
//<editor-fold desc="Questions Section">
$scope.loadQuestions = function() {
$scope.loadEntity({
filter: $scope.questionFilter,
entity: 'questions',
loader: 'questionFormLoader',
callback: function(results){
_.forEach(results, function(question){
if (!($scope.questionDetailsShow[question.questionId])){
$scope.questionDetailsShow[question.questionId] = {};
$scope.questionDetailsShow[question.questionId].flag = false;
$scope.questionDetailsShow[question.questionId].showResponsesText = 'Show';
}
});
}
});
};
$scope.loadQuestions();
$scope.toggleQuestionStatus = function(question){
$scope.toggleEntityStatus({
entity: question,
entityId: question.questionId,
entityName: 'questions',
loader: 'questionFormLoader',
loadEntity: function(){
$scope.loadQuestions();
}
});
};
$scope.showQuestionResponses = function(question){
$scope.questionDetailsShow[question.questionId].flag = !$scope.questionDetailsShow[question.questionId].flag;
if ($scope.questionDetailsShow[question.questionId].flag === false){
$scope.questionDetailsShow[question.questionId].showResponsesText = 'Show';
} else {
$scope.questionDetailsShow[question.questionId].showResponsesText = 'Hide';
}
};
$scope.toggleQuestionResponseStatus = function(questionResponse, question){
$scope.$emit('$TRIGGERLOAD', 'questionFormLoader');
if (questionResponse.activeStatus === 'A') {
Business.componentservice.inactivateQuestionResponse({
componentId: $scope.componentForm.componentId,
questionId: question.questionId,
responseId: questionResponse.responseId
}).then(function (results) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'questionFormLoader');
$scope.loadQuestions();
});
} else {
Business.componentservice.activateQuestionResponse({
componentId: $scope.componentForm.componentId,
questionId: question.questionId,
responseId: questionResponse.responseId
}).then(function (results) {
$scope.$emit('$TRIGGEREVENT', '$TRIGGERUNLOAD', 'questionFormLoader');
$scope.loadQuestions();
});
}
};
//</editor-fold>
$scope.close = function () {
$scope.$emit('$TRIGGEREVENT', '$CLOSEMSG');
$uiModalInstance.dismiss('close');
};
}]);
app.controller('messageSubmitterCtrl',['$scope', '$draggableInstance', 'submitter', 'business', '$location', function ($scope, $draggableInstance, submitter, Business, $location) {
$scope.submitter = submitter || {};
$scope.ok = function () {
$draggableInstance.close();
};
$scope.cancel = function () {
$draggableInstance.dismiss('cancel');
};
$scope.$on('$CLOSEMSG', function(){
$draggableInstance.dismiss('cancel');
})
}]);
| {
"content_hash": "49968246b4ac739ce12e71dc0075d4ca",
"timestamp": "",
"source": "github",
"line_count": 1615,
"max_line_length": 218,
"avg_line_length": 33.35356037151703,
"alnum_prop": 0.6326068391935544,
"repo_name": "skycow/openstorefront",
"id": "75edbe59bcd07ca9c38f24ed5ef7c9104026c131",
"size": "53866",
"binary": false,
"copies": "1",
"ref": "refs/heads/v1.5",
"path": "client/openstorefront/app/scripts/controllers/admin/editcomponent.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "24139"
},
{
"name": "CSS",
"bytes": "235452"
},
{
"name": "HTML",
"bytes": "909915"
},
{
"name": "Java",
"bytes": "2171522"
},
{
"name": "JavaScript",
"bytes": "1481458"
},
{
"name": "PHP",
"bytes": "2199"
},
{
"name": "Ruby",
"bytes": "44"
}
],
"symlink_target": ""
} |
/**
*
*/
package me.learn.personal.month6;
import java.util.Arrays;
/**
* Title 1198 :
*
* Date : Jan 14, 2021
*
* @author bramanarayan
*
*/
public class FindSmallestCommonElementInRowSortedMatrix {
/**
* @param args
*/
public static void main(String[] args) {
// initializing unsorted array
int arr[] = { 2, 10, 22, 29 };
// sorting array
Arrays.sort(arr);
// let us print all the elements available
System.out.println("The sorted array is:");
for (int number : arr) {
System.out.println("Number = " + number);
}
// entering the value to be searched
int searchVal = 7;
int retVal = Arrays.binarySearch(arr, searchVal);
System.out.println("The index of element 22 is : " + retVal);
}
// you can simply sort this using kway merge technique
// or take every element of first array
// now search its existence in all other arrays i.e index 1 to n-1
// the first element you find in all the arrays, that would be the smalles
// common element
public int smallestCommonElement(int[][] mat) {
int m = mat.length;
int n = mat[0].length;
for (int j = 0; j < n; j++) {
int element = mat[0][j];
// now search for element in rest of the matrices
boolean notFound = false;
for (int i = 1; i < m; i++) {
if (Arrays.binarySearch(mat[i], element) < 0) {
notFound = true;
break;
}
}
if (!notFound) // if all found
return element;
}
return -1;
}
}
| {
"content_hash": "914c6c00717aff244445ba3bae5ba1d3",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 75,
"avg_line_length": 19.373333333333335,
"alnum_prop": 0.6283551273227804,
"repo_name": "balajiboggaram/algorithms",
"id": "e1dcabb249decf5b3e53d4c5eeeca1405169ed4b",
"size": "1453",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/me/learn/personal/month6/FindSmallestCommonElementInRowSortedMatrix.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "20090"
}
],
"symlink_target": ""
} |
namespace fileapi {
namespace {
FilePath::StringType GetRegisterNameForPath(const FilePath& path) {
// If it's not a root path simply return a base name.
if (path.DirName() != path)
return path.BaseName().value();
#if defined(FILE_PATH_USES_DRIVE_LETTERS)
FilePath::StringType name;
for (size_t i = 0;
i < path.value().size() && !FilePath::IsSeparator(path.value()[i]);
++i) {
if (path.value()[i] == L':') {
name.append(L"_drive");
break;
}
name.append(1, path.value()[i]);
}
return name;
#else
return FILE_PATH_LITERAL("<root>");
#endif
}
}
static base::LazyInstance<IsolatedContext>::Leaky g_isolated_context =
LAZY_INSTANCE_INITIALIZER;
IsolatedContext::FileInfo::FileInfo() {}
IsolatedContext::FileInfo::FileInfo(
const std::string& name, const FilePath& path)
: name(name), path(path) {}
IsolatedContext::FileInfoSet::FileInfoSet() {}
IsolatedContext::FileInfoSet::~FileInfoSet() {}
std::string IsolatedContext::FileInfoSet::AddPath(
const FilePath& path) {
FilePath::StringType name = GetRegisterNameForPath(path);
std::string utf8name = FilePath(name).AsUTF8Unsafe();
bool inserted = fileset_.insert(FileInfo(utf8name, path)).second;
if (!inserted) {
int suffix = 1;
std::string basepart = FilePath(name).RemoveExtension().AsUTF8Unsafe();
std::string ext = FilePath(FilePath(name).Extension()).AsUTF8Unsafe();
while (!inserted) {
utf8name = base::StringPrintf("%s (%d)", basepart.c_str(), suffix++);
if (!ext.empty())
utf8name.append(ext);
inserted = fileset_.insert(FileInfo(utf8name, path)).second;
}
}
return utf8name;
}
bool IsolatedContext::FileInfoSet::AddPathWithName(
const FilePath& path, const std::string& name) {
return fileset_.insert(FileInfo(name, path)).second;
}
// static
IsolatedContext* IsolatedContext::GetInstance() {
return g_isolated_context.Pointer();
}
std::string IsolatedContext::RegisterFileSystem(const FileInfoSet& files) {
base::AutoLock locker(lock_);
std::string filesystem_id = GetNewFileSystemId();
// Stores name to fullpath map, as we store the name as a key in
// the filesystem's toplevel entries.
FileSet toplevels;
for (std::set<FileInfo>::const_iterator iter = files.fileset().begin();
iter != files.fileset().end();
++iter) {
const FileInfo& info = *iter;
// The given path should not contain any '..' and should be absolute.
if (info.path.ReferencesParent() || !info.path.IsAbsolute())
continue;
// Register the basename -> fullpath map. (We only expose the basename
// part to the user scripts)
FilePath fullpath = info.path.NormalizePathSeparators();
const bool inserted = toplevels.insert(
FileInfo(info.name, fullpath)).second;
DCHECK(inserted);
}
// TODO(kinuko): we may not want to register the file system if there're
// no valid paths in the given file set.
toplevel_map_[filesystem_id] = toplevels;
// Each file system is created with refcount == 0.
ref_counts_[filesystem_id] = 0;
return filesystem_id;
}
std::string IsolatedContext::RegisterFileSystemForFile(
const FilePath& path,
std::string* register_name) {
FileInfoSet files;
if (register_name && !register_name->empty()) {
const bool added = files.AddPathWithName(path, *register_name);
DCHECK(added);
} else {
std::string name = files.AddPath(path);
if (register_name)
register_name->assign(name);
}
return RegisterFileSystem(files);
}
void IsolatedContext::RevokeFileSystem(const std::string& filesystem_id) {
base::AutoLock locker(lock_);
RevokeWithoutLocking(filesystem_id);
}
void IsolatedContext::AddReference(const std::string& filesystem_id) {
base::AutoLock locker(lock_);
DCHECK(ref_counts_.find(filesystem_id) != ref_counts_.end());
ref_counts_[filesystem_id]++;
}
void IsolatedContext::RemoveReference(const std::string& filesystem_id) {
base::AutoLock locker(lock_);
// This could get called for non-existent filesystem if it has been
// already deleted by RevokeFileSystem.
if (ref_counts_.find(filesystem_id) == ref_counts_.end())
return;
DCHECK(ref_counts_[filesystem_id] > 0);
if (--ref_counts_[filesystem_id] == 0)
RevokeWithoutLocking(filesystem_id);
}
bool IsolatedContext::CrackIsolatedPath(const FilePath& virtual_path,
std::string* filesystem_id,
FileInfo* root_info,
FilePath* platform_path) const {
DCHECK(filesystem_id);
DCHECK(platform_path);
// This should not contain any '..' references.
if (virtual_path.ReferencesParent())
return false;
// The virtual_path should comprise <filesystem_id> and <relative_path> parts.
std::vector<FilePath::StringType> components;
virtual_path.GetComponents(&components);
if (components.size() < 1)
return false;
base::AutoLock locker(lock_);
std::string fsid = FilePath(components[0]).MaybeAsASCII();
if (fsid.empty())
return false;
IDToFileSet::const_iterator found_toplevels = toplevel_map_.find(fsid);
if (found_toplevels == toplevel_map_.end())
return false;
*filesystem_id = fsid;
if (components.size() == 1) {
platform_path->clear();
return true;
}
// components[1] should be a name of the dropped paths.
FileSet::const_iterator found = found_toplevels->second.find(
FileInfo(FilePath(components[1]).AsUTF8Unsafe(), FilePath()));
if (found == found_toplevels->second.end())
return false;
if (root_info)
*root_info = *found;
FilePath path = found->path;
for (size_t i = 2; i < components.size(); ++i)
path = path.Append(components[i]);
*platform_path = path;
return true;
}
bool IsolatedContext::GetRegisteredFileInfo(
const std::string& filesystem_id, std::vector<FileInfo>* files) const {
DCHECK(files);
base::AutoLock locker(lock_);
IDToFileSet::const_iterator found = toplevel_map_.find(filesystem_id);
if (found == toplevel_map_.end())
return false;
files->assign(found->second.begin(), found->second.end());
return true;
}
FilePath IsolatedContext::CreateVirtualRootPath(
const std::string& filesystem_id) const {
return FilePath().AppendASCII(filesystem_id);
}
IsolatedContext::IsolatedContext() {
}
IsolatedContext::~IsolatedContext() {
}
void IsolatedContext::RevokeWithoutLocking(
const std::string& filesystem_id) {
toplevel_map_.erase(filesystem_id);
ref_counts_.erase(filesystem_id);
}
std::string IsolatedContext::GetNewFileSystemId() const {
// Returns an arbitrary random string which must be unique in the map.
uint32 random_data[4];
std::string id;
do {
base::RandBytes(random_data, sizeof(random_data));
id = base::HexEncode(random_data, sizeof(random_data));
} while (toplevel_map_.find(id) != toplevel_map_.end());
return id;
}
} // namespace fileapi
| {
"content_hash": "5129dc7ca0e5b0c335acb244470a63b2",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 80,
"avg_line_length": 31.457013574660632,
"alnum_prop": 0.6783659378596087,
"repo_name": "keishi/chromium",
"id": "d590f442b010facdf51b823d288e86f7dba6fa32",
"size": "7385",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "webkit/fileapi/isolated_context.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "853"
},
{
"name": "Arduino",
"bytes": "464"
},
{
"name": "Assembly",
"bytes": "1172794"
},
{
"name": "C",
"bytes": "67452317"
},
{
"name": "C#",
"bytes": "1132"
},
{
"name": "C++",
"bytes": "132681259"
},
{
"name": "F#",
"bytes": "381"
},
{
"name": "Go",
"bytes": "19048"
},
{
"name": "Java",
"bytes": "361412"
},
{
"name": "JavaScript",
"bytes": "16603687"
},
{
"name": "Objective-C",
"bytes": "9609581"
},
{
"name": "PHP",
"bytes": "97796"
},
{
"name": "Perl",
"bytes": "918683"
},
{
"name": "Python",
"bytes": "6407891"
},
{
"name": "R",
"bytes": "524"
},
{
"name": "Shell",
"bytes": "4192593"
},
{
"name": "Tcl",
"bytes": "277077"
}
],
"symlink_target": ""
} |
class message;
//Extend this to make your own message types
class message_data
{
public:
virtual std::unique_ptr<message_data> copy() const = 0;
//Derived classes should make static functions to make their message
//types, but none are declared here because those would necessitate
//implementation with those specific arguments.
//static message create_message();
virtual ~message_data();
protected:
message_data() = default;
message_data(const message_data &) = default;
message_data(message_data &&) = default;
message_data &operator=(const message_data &) = default;
message_data &operator=(message_data &&) = default;
};
inline message_data::~message_data() = default;
//These fit into message queues
class message
{
public:
message() = default;
message(const message &m) : type(m.type), priority(m.priority), data(m.data ? m.data->copy() : nullptr) {}
message(message &&) = default;
message(std::string t, int p, std::unique_ptr<message_data> &&d) : type(t), priority(p), data(std::move(d)) {}
message &operator=(const message &m) {type=m.type; priority=m.priority; if (m.data) data=std::move(m.data->copy()); return *this;}
message &operator=(message &&) = default;
//the variables might become private later, so use these functions
std::string gettype() const {return type;}
int getpriority() const {return priority;}
message &change_priority(int p) {priority=p; return *this;}
message &decrement_priority() {--priority; return *this;}
//This gets deleted when the message destructs, so be careful
message_data *getdata() const {return data.get();}
static const int initial_priority=32767;
std::string type;
int priority;
std::unique_ptr<message_data> data;
};
static message message_create(const std::string &s, message_data *d) {return message(s, message::initial_priority, std::unique_ptr<message_data>(d));}
class empty_message : public message_data
{
public:
virtual std::unique_ptr<message_data> copy() const {return std::unique_ptr<message_data>(nullptr);}
static message create() {return message_create("", nullptr);}
};
#endif
| {
"content_hash": "29a69c0b1a79e17668411c146728c053",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 150,
"avg_line_length": 35.32203389830509,
"alnum_prop": 0.7202495201535508,
"repo_name": "m42a/Lirch",
"id": "ae7df5e2ea38b5876b2e6e6786e5df1e989404c7",
"size": "2160",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/message.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "2434"
},
{
"name": "C++",
"bytes": "162897"
},
{
"name": "Objective-C",
"bytes": "1291"
}
],
"symlink_target": ""
} |
<?php
namespace PlaygroundFacebookTest\Entity;
use PlaygroundFacebookTest\Bootstrap;
use \PlaygroundFacebook\Entity\Page as PageEntity;
class PageTest extends \PHPUnit_Framework_TestCase
{
protected $traceError = true;
protected $pageData;
public function setUp()
{
// Set fake data
$this->pageData = array(
'pageId' => '111222333444555',
'pageName' => 'MyPage',
);
parent::setUp();
}
public function testGetPageId()
{
$app = new PageEntity();
$app->populate($this->pageData);
$this->assertEquals($this->pageData['pageId'], $app->getPageId());
}
public function testGetPageName()
{
$app = new PageEntity();
$app->populate($this->pageData);
$this->assertEquals($this->pageData['pageName'], $app->getPageName());
}
}
| {
"content_hash": "ad80c0dbf60635806b8d6a6346e1ea6e",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 78,
"avg_line_length": 18.958333333333332,
"alnum_prop": 0.5758241758241758,
"repo_name": "gregorybesson/PlaygroundFacebook",
"id": "eeaca4aaf2197acafb3f0bb60b64e34abeaad3ce",
"size": "910",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "tests/PlaygroundFacebookTest/Entity/PageTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "17044"
},
{
"name": "PHP",
"bytes": "139695"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.devilwwj.library"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.devilwwj.library.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
| {
"content_hash": "769bcb42d0262154715a888d2a20220f",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 76,
"avg_line_length": 31.74074074074074,
"alnum_prop": 0.6079346557759626,
"repo_name": "devilWwj/Android-Tech",
"id": "ac9bf83e0647f376bf7473babd6a4fb250e25159",
"size": "857",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Library/AndroidManifest.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "70"
},
{
"name": "C",
"bytes": "1685"
},
{
"name": "C++",
"bytes": "1458"
},
{
"name": "Groovy",
"bytes": "12702"
},
{
"name": "Java",
"bytes": "123973"
},
{
"name": "Makefile",
"bytes": "32685"
}
],
"symlink_target": ""
} |
package org.apache.maven.continuum.notification;
import org.apache.continuum.model.project.ProjectScmRoot;
import org.apache.maven.continuum.model.project.BuildDefinition;
import org.apache.maven.continuum.model.project.BuildResult;
import org.apache.maven.continuum.model.project.Project;
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
* @todo use build result for all of these? need project for those that do?
*/
public interface ContinuumNotificationDispatcher
{
String ROLE = ContinuumNotificationDispatcher.class.getName();
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
String MESSAGE_ID_BUILD_STARTED = "BuildStarted";
String MESSAGE_ID_CHECKOUT_STARTED = "CheckoutStarted";
String MESSAGE_ID_CHECKOUT_COMPLETE = "CheckoutComplete";
String MESSAGE_ID_RUNNING_GOALS = "RunningGoals";
String MESSAGE_ID_GOALS_COMPLETED = "GoalsCompleted";
String MESSAGE_ID_BUILD_COMPLETE = "BuildComplete";
String MESSAGE_ID_PREPARE_BUILD_COMPLETE = "PrepareBuildComplete";
String CONTEXT_BUILD = "build";
String CONTEXT_BUILD_OUTPUT = "build-output";
String CONTEXT_PROJECT = "project";
String CONTEXT_BUILD_DEFINITION = "buildDefinition";
String CONTEXT_PROJECT_NOTIFIER = "projectNotifier";
String CONTEXT_BUILD_RESULT = "result";
String CONTEXT_UPDATE_SCM_RESULT = "scmResult";
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
void buildStarted( Project project, BuildDefinition buildDefinition );
void checkoutStarted( Project project, BuildDefinition buildDefinition );
void checkoutComplete( Project project, BuildDefinition buildDefinition );
void runningGoals( Project project, BuildDefinition buildDefinition, BuildResult buildResult );
void goalsCompleted( Project project, BuildDefinition buildDefinition, BuildResult buildResult );
void buildComplete( Project project, BuildDefinition buildDefinition, BuildResult buildResult );
void prepareBuildComplete( ProjectScmRoot projectScmRoot );
}
| {
"content_hash": "812dc0323f526075ca278375c0a16c99",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 101,
"avg_line_length": 33.865671641791046,
"alnum_prop": 0.6562362274129573,
"repo_name": "apache/continuum",
"id": "e27027a342fe42747764315a4030954847db57d0",
"size": "3076",
"binary": false,
"copies": "2",
"ref": "refs/heads/trunk",
"path": "continuum-api/src/main/java/org/apache/maven/continuum/notification/ContinuumNotificationDispatcher.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1698"
},
{
"name": "CSS",
"bytes": "22727"
},
{
"name": "FreeMarker",
"bytes": "3703"
},
{
"name": "HTML",
"bytes": "33178"
},
{
"name": "Java",
"bytes": "5429571"
},
{
"name": "Shell",
"bytes": "43242"
}
],
"symlink_target": ""
} |
import LinearProgress from '@material-ui/core/LinearProgress';
import makeStyles from '@material-ui/core/styles/makeStyles';
import * as React from 'react';
import * as zxcvbn from 'zxcvbn';
const useStyles = makeStyles({
progressBar: {
color: '#000000',
display: 'flex',
flexGrow: 1,
},
progressBarColorHigh: {
backgroundColor: '#4caf50',
},
progressBarColorLow: {
backgroundColor: '#ff5722',
},
progressBarColorMedium: {
backgroundColor: '#ffc107',
},
});
const measureStrength = (password: string): number =>
Math.min(
// @ts-expect-error
zxcvbn.default(password).guesses_log10 * 10,
100,
);
interface IStrengthBarProps {
newPassword: string;
}
export const PasswordStrengthBar: React.FunctionComponent<IStrengthBarProps> = ({ newPassword }: IStrengthBarProps) => {
const classes = useStyles({});
const getProgressColor = (strength: number) => ({
barColorPrimary:
strength < 33
? classes.progressBarColorLow
: strength < 66
? classes.progressBarColorMedium
: classes.progressBarColorHigh,
});
const newStrength = measureStrength(newPassword);
const primeColor = getProgressColor(newStrength);
return (
<LinearProgress
classes={primeColor}
variant="determinate"
value={newStrength}
className={classes.progressBar}
/>
);
};
| {
"content_hash": "5f004e9774902c97c1c7c7a35d67e6cd",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 120,
"avg_line_length": 26.736842105263158,
"alnum_prop": 0.6108923884514436,
"repo_name": "unosquare/passcore",
"id": "59af528e750ed3ecfbcca859dc1b8f0ea561dbc6",
"size": "1524",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Unosquare.PassCore.Web/ClientApp/Components/PasswordStrengthBar.tsx",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "70577"
},
{
"name": "Dockerfile",
"bytes": "485"
},
{
"name": "HTML",
"bytes": "716"
},
{
"name": "JavaScript",
"bytes": "1541"
},
{
"name": "PowerShell",
"bytes": "4204"
},
{
"name": "TypeScript",
"bytes": "35323"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "cbeec53405687dafd92f7e47965faa7f",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "598373d97a0dae1758349a3ac8be0b48030eb255",
"size": "182",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Pulicaria/Pulicaria antidysenterica/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>net-pipe: Main Page</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">net-pipe
 <span id="projectnumber">0.0.1r2</span>
</div>
<div id="projectbrief">A crayon stupid style network piping server.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li class="current"><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">net-pipe Documentation</div> </div>
</div><!--header-->
<div class="contents">
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.10
</small></address>
</body>
</html>
| {
"content_hash": "212c36b3004eb2788e07e3632f3485bc",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 154,
"avg_line_length": 38.81318681318681,
"alnum_prop": 0.6472253680634201,
"repo_name": "Qwartz/net-pipe",
"id": "72d14091a5f6c31a5fbc214764719393b04f99a7",
"size": "3532",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "html/index.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "677"
},
{
"name": "C",
"bytes": "4510"
},
{
"name": "CSS",
"bytes": "31169"
},
{
"name": "HTML",
"bytes": "181796"
},
{
"name": "JavaScript",
"bytes": "31482"
},
{
"name": "Makefile",
"bytes": "508"
},
{
"name": "TeX",
"bytes": "37861"
}
],
"symlink_target": ""
} |
from unittest import mock
from neutron_lib.api.definitions import portbindings as pb
from neutron_lib.api.definitions import provider_net as pnet
from neutron_lib import context as n_context
from neutron_lib.db import api as db_api
from neutron_lib import exceptions
from oslo_utils import uuidutils
from neutron.db.models.plugins.ml2 import geneveallocation
from neutron.db.models.plugins.ml2 import vxlanallocation
from neutron.objects import ports as port_obj
from neutron.objects import trunk as trunk_obj
from neutron.plugins.ml2.drivers.ovn import db_migration
from neutron.tests.unit.plugins.ml2.drivers.ovn.mech_driver import (
test_mech_driver)
class TestMigrateNeutronDatabaseToOvn(
test_mech_driver.TestOVNMechanismDriverBase):
def _create_ml2_ovs_test_resources(self, vif_details_list):
self.subport_profiles = {}
ctx = n_context.get_admin_context()
for sid in range(1, 6):
net_arg = {pnet.NETWORK_TYPE: 'vxlan',
pnet.SEGMENTATION_ID: sid}
network_id = self._make_network(self.fmt, 'net%d' % sid, True,
arg_list=(pnet.NETWORK_TYPE,
pnet.SEGMENTATION_ID,),
**net_arg)['network']['id']
for vif_details in vif_details_list:
port = self._make_port(self.fmt, network_id)['port']
port_o = port_obj.PortBinding.get_object(
ctx, port_id=port['id'], host='')
port_o.vif_type = 'ovs'
port_o.vif_details = vif_details
port_o.update()
for i in range(1, 4):
port = self._make_port(self.fmt, network_id)['port']
subport1 = self._make_port(self.fmt, network_id)['port']
subport2 = self._make_port(self.fmt, network_id)['port']
trunk_id = uuidutils.generate_uuid()
subports = [trunk_obj.SubPort(
ctx,
port_id=subport1['id'],
trunk_id=trunk_id,
segmentation_type="vlan",
segmentation_id=i * 10 + j) for j in range(2)]
trunk = trunk_obj.Trunk(
ctx,
id=trunk_id,
port_id=port['id'],
project_id='foo',
subports=subports)
trunk.create()
subport_pb = port_obj.PortBinding.get_object(
ctx, port_id=subport1['id'], host='')
self.assertFalse(subport_pb.profile)
self.subport_profiles[subport1['id']] = {"parent_name": port['id'],
"tag": i * 10}
self.subport_profiles[subport2['id']] = {"parent_name": port['id'],
"tag": i * 10 + 1}
# set something to the last subport port binding
subport_pb = port_obj.PortBinding.get_object(
ctx, port_id=subport2['id'], host='')
# need to generate new id
subport_pb.profile = subport_pb.profile.copy()
subport_pb.profile['foo'] = 'bar'
subport_pb.update()
self.subport_profiles[subport2['id']]["foo"] = "bar"
def _validate_resources_after_migration(self, expected_vif_details):
ctx = n_context.get_admin_context()
# Check network types
networks = self.plugin.get_networks(ctx)
for network in networks:
self.assertEqual("geneve", network["provider:network_type"])
with db_api.CONTEXT_READER.using(ctx) as session:
# Check there are no vxlan allocations
vxlan_allocations = session.query(
vxlanallocation.VxlanAllocation).filter(
vxlanallocation.VxlanAllocation.allocated == True # noqa
).all()
self.assertFalse(vxlan_allocations)
# Check all the networks have Geneve allocations
geneve_allocations = session.query(
geneveallocation.GeneveAllocation).filter(
geneveallocation.GeneveAllocation.allocated == True # noqa
).all()
self.assertEqual(len(networks), len(geneve_allocations))
# Check port bindings vif details are as expected
ports = self.plugin.get_ports(ctx)
for port in ports:
self.assertIn(port['binding:vif_details'], expected_vif_details)
# Check port profiles for subport ports
for trunk in trunk_obj.Trunk.get_objects(ctx):
for subport in trunk.sub_ports:
port = self.plugin.get_port(ctx, id=subport.port_id)
self.assertEqual(
self.subport_profiles[subport.port_id],
port["binding:profile"])
def test_db_migration(self):
"""Test the DB migration
It creates 5 vxlan networks, each should get a vxlan vni allocated.
Then it creates 3 ports with different vif details.
After the DB migration the vxlan networks should not be allocated but
be geneve type and have geneve allocations. Also the port binding vif
details should not contain hybrid plugging, bridge name for trunk and
l2 connectivity for OVS agent.
"""
vif_details_list = [
{pb.CAP_PORT_FILTER: "true",
pb.OVS_HYBRID_PLUG: "true",
pb.VIF_DETAILS_BRIDGE_NAME: "foo",
pb.VIF_DETAILS_CONNECTIVITY: pb.CONNECTIVITY_L2},
{pb.CAP_PORT_FILTER: "true",
pb.VIF_DETAILS_BRIDGE_NAME: "foo"},
{"foo": "bar"},
{},
]
expected_vif_details = [
{pb.CAP_PORT_FILTER: "true",
pb.OVS_HYBRID_PLUG: "true",
pb.VIF_DETAILS_CONNECTIVITY: pb.CONNECTIVITY_L2},
{pb.CAP_PORT_FILTER: "true"},
{"foo": "bar"},
{},
]
self._create_ml2_ovs_test_resources(vif_details_list)
db_migration.migrate_neutron_database_to_ovn()
self._validate_resources_after_migration(expected_vif_details)
def test_db_migration_with_pb_not_found(self):
vif_details_list = [
{pb.CAP_PORT_FILTER: "true",
pb.OVS_HYBRID_PLUG: "true",
pb.VIF_DETAILS_BRIDGE_NAME: "foo",
pb.VIF_DETAILS_CONNECTIVITY: "l2"},
{pb.CAP_PORT_FILTER: "true",
pb.VIF_DETAILS_BRIDGE_NAME: "foo"},
{"foo": "bar"},
{},
]
self._create_ml2_ovs_test_resources(vif_details_list)
with mock.patch.object(
port_obj.PortBinding, 'update',
side_effect=exceptions.ObjectNotFound(id='foo')):
with mock.patch.object(trunk_obj.Trunk, 'get_objects',
return_value=[]):
db_migration.migrate_neutron_database_to_ovn()
self._validate_resources_after_migration(vif_details_list)
| {
"content_hash": "fe5cfb92bcb3f9b1c6a3e64af743beb0",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 79,
"avg_line_length": 40.54385964912281,
"alnum_prop": 0.5707485936823886,
"repo_name": "mahak/neutron",
"id": "ad7d56a39ec41c68e6084b0b89336fc80bc39449",
"size": "7539",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "neutron/tests/unit/plugins/ml2/drivers/ovn/test_db_migration.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Jinja",
"bytes": "2773"
},
{
"name": "Mako",
"bytes": "1047"
},
{
"name": "Python",
"bytes": "15942116"
},
{
"name": "Ruby",
"bytes": "1257"
},
{
"name": "Shell",
"bytes": "83270"
}
],
"symlink_target": ""
} |
let allPostResponse;
function loadPosts() {
fetch(`/group-post?groupId=${groupId}`).then(response => response.json()).then((postResponse) => {
allPostResponse = postResponse;
const posts = postResponse["posts"];
const allPostsList = document.getElementById('posts-container');
allPostsList.innerHTML = '';
for (let i = 0; i < posts.length; i++) {
allPostsList.appendChild(createSinglePost(posts[i], postResponse["likedPosts"]));
}
addCommentInputListener();
addLikeButtonListener();
});
}
function addCommentInputListener() {
let elements = document.getElementsByClassName(
"post-btn align-vertical comment-btn"
);
for (let i = 0; i < elements.length; i++) {
elements[i].addEventListener("click", function() {
postComment(this.id, this.id + "comment-input");
});
}
}
function addLikeButtonListener() {
let likeBtns = document.getElementsByClassName("like-icon vertical-align");
for (let i = 0; i < likeBtns.length; i++) {
likeBtns[i].addEventListener("click", function() {
const postId = parseInt(getPostIdFromsLikesId(this.id));
let userLikedPosts = allPostResponse["likedPosts"];
if (userLikedPosts.includes(postId)) {
likeToggled(this.id, false);
} else {
likeToggled(this.id, true);
}
});
}
}
function likeToggled(likeId, liked) {
const postId = getPostIdFromsLikesId(likeId);
let request = new Request(`/update-likes?id=${postId}&liked=${liked}`, {
method: "POST"
});
fetch(request).then(() => {
loadPosts();
});
}
/* likeId = postId + "like"
use substring to just get the postId. */
function getPostIdFromsLikesId(likeId) {
return likeId.substring(0, likeId.length - 4);
}
// Performs POST request to add comment to post
function postComment(buttonId, commentBoxId) {
const commentVal = document.getElementById(commentBoxId).value;
let request = new Request(
`/post-comment?id=${buttonId}&comment-text=${commentVal}`,
{ method: "POST" }
);
fetch(request).then(() => {
loadPosts();
});
}
function createSinglePost(post, likedPosts) {
const postDiv = document.createElement("div");
postDiv.className = "post-div";
postDiv.appendChild(createProfileImg(post));
postDiv.append(createAuthor(post));
postDiv.append(createPostText(post));
if (post.img != null && post.img != "") {
postDiv.append(createPostImage(post));
}
postDiv.append(createLikesContainer(post, likedPosts));
postDiv.append(createCommentsContainer(post));
postDiv.append(createCommentBox(post));
return postDiv;
}
// Create HTML element for post profile img
function createProfileImg(post) {
const profileImgDiv = document.createElement("div");
profileImgDiv.className = "post-img-div align-vertical";
if (post.authorPic != null && post.authorPic != "") {
const authorProfileImg = document.createElement("img");
authorProfileImg.className = "post-img";
authorProfileImg.src = "serve?blob-key=" + post.authorPic;
profileImgDiv.append(authorProfileImg);
}
return profileImgDiv;
}
// Create HTML element for post author name
function createAuthor(post) {
const postAuthor = document.createElement("h3");
postAuthor.className = "post-author align-vertical";
postAuthor.innerText = post.authorName;
return postAuthor;
}
// Create HTML element for post text
function createPostText(post) {
const postContent = document.createElement("p");
postContent.className = "post-content";
postContent.innerText = post.postText;
return postContent;
}
// Create HTML element for post img
function createPostImage(post) {
const imageDiv = document.createElement("div");
imageDiv.className = "img-div";
let imageContent = document.createElement("img");
imageContent.className = "uploadedImage";
imageContent.src = "serve?blob-key=" + post.img;
imageDiv.appendChild(imageContent);
return imageDiv;
}
// Create HTML elements for like icon and string
function createLikesContainer(post, likedPosts) {
const likesDiv = document.createElement("div");
likesDiv.className = "likes-div";
// Set number of likes label
const likesLabel = document.createElement("p");
likesLabel.className = "likes-label vertical-align";
likesLabel.id = post.postId + "likes-label";
const numLikes = post["likes"].length;
const likesString = numLikes > 1 ? `${numLikes} likes` : `${numLikes} like`;
const labelString = numLikes == 0 ? "" : likesString;
likesLabel.innerText = `${labelString}`;
likesDiv.appendChild(likesLabel);
// Set like icon state (filled or only outline)
const likeIcon = document.createElement("ion-icon");
if (likedPosts.includes(post.postId)) {
likeIcon.className = "like-icon vertical-align liked";
} else {
likeIcon.className = "like-icon vertical-align unliked";
}
likeIcon.name = "heart";
likeIcon.id = post.postId + "like";
likesDiv.appendChild(likeIcon);
return likesDiv;
}
// Create container for all post comments
function createCommentsContainer(post) {
const commentsContainer = document.createElement("div");
commentsContainer.className = "comments-content";
const allComments = document.createElement("ul");
for (comment of post.comments) {
allComments.appendChild(createSingleComment(comment));
}
commentsContainer.appendChild(allComments);
return commentsContainer;
}
function createSingleComment(comment) {
const commentContainer = document.createElement("li");
commentContainer.className = "comment-content";
const commentUser = document.createElement("span");
commentUser.className = "comment-user align-vertical";
commentContainer.appendChild(commentUser);
if (comment.userProfilePic != null && comment.userProfilePic != "") {
const commentUserImg = document.createElement("img");
commentUserImg.className = "comment-user-img";
commentUserImg.src = "serve?blob-key=" + comment.userProfilePic;
commentUser.append(commentUserImg);
}
const commentTextDiv = document.createElement("div");
commentTextDiv.className = "comment-text-div align-vertical";
commentContainer.appendChild(commentTextDiv);
const commentText = document.createElement("p");
commentText.className = "comment-text align-vertical";
commentText.innerText = comment.commentText;
commentTextDiv.appendChild(commentText);
return commentContainer;
}
// Create comment input HTML element
function createCommentBox(post) {
const commentBoxDiv = document.createElement("div");
commentBoxDiv.className = "comment-box-div";
const commentBox = document.createElement("input");
commentBox.type = "text";
commentBox.name = "comment-input";
commentBox.placeholder = "Write a comment";
commentBox.className = "comment-input";
commentBox.id = post.postId + "comment-input";
commentBoxDiv.appendChild(commentBox);
const commentBtn = document.createElement("button");
commentBtn.className = "post-btn align-vertical comment-btn";
commentBtn.type = "submit";
commentBtn.id = post.postId;
commentBtn.innerHTML =
"<img class='small-icon' src='images/send_plane.png' alt/>";
commentBoxDiv.appendChild(commentBtn);
return commentBoxDiv;
}
// Gets URL for uploaded image
function fetchBlobstoreUrlAndShowForm() {
fetch(`/post-image-servlet?groupId=${groupId}`)
.then(response => {
return response.text();
})
.then(imageUploadUrl => {
const messageForm = document.getElementById("post-form");
messageForm.action = imageUploadUrl;
});
}
| {
"content_hash": "c0997758b8bef229b831b20f15699979",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 100,
"avg_line_length": 33.190265486725664,
"alnum_prop": 0.7157712305025996,
"repo_name": "googleinterns/step100-2020",
"id": "129855457e6e7204bf4ea3438df42204183ad436",
"size": "7501",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "capstone/src/main/webapp/scripts/post.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "27622"
},
{
"name": "HTML",
"bytes": "14690"
},
{
"name": "Java",
"bytes": "382380"
},
{
"name": "JavaScript",
"bytes": "47676"
}
],
"symlink_target": ""
} |
This is the Cordova Testing Framework project for `cordova-plugin-qrscanner`.
To generate this package, clone and `npm install` the `cordova-plugin-qrscanner`, and then run `npm run manual-tests` inside that project.
Becuase this project requires `cordova-plugin-qrscanner` and it's tests as plugins, building this project inside the `cordova-plugin-qrscanner` directory would cause an infinite recursion.
Since `cordova prepare` is not intended to handle this scenario (which may at some point be resolved/added by the Cordova CLI), this package is first copied into a sibling directory called `cordova-plugin-test-projects`. The path from the root of `cordova-plugin-qrscanner` is `../cordova-plugin-test-projects/cordova-plugin-qrscanner-tests/`.
## Running Tests
Run the app on each platform to test functionality. The "Auto Tests" run a sanity check on the plugin's globally exposed javascript interface. The "Manual Tests" allow for human confirmation that each function performs as expected.
### iOS
Run tests on connected device: `cordova run ios --device`
Run tests on ios simulator: `cordova emulate ios`
Open test project in xcode: `open platforms/ios/HelloCordova.xcodeproj/`
XCode will usually ask if you'd like to "Convert [the project] to [the] Latest Swift Syntax" – the plugin uses the latest syntax, but the project generated by `cordova build` doesn't seem to verify this for XCode. It's safe to ignore ("Cancel") the dialog.
## Android
Before testing with Android, please install [Java Development Kit (JDK) 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html), [Android Studio](https://developer.android.com/studio/index.html), and the SDK packages for whatever [API level](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) you wish to target.
Cordova's CLI tools require some environment variables to be set in order to function correctly. The CLI will attempt to set these variables for you, but in certain cases you may need to set them manually. Please refer to [Cordova's Android Platform Guide](https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html) for more information.
Please make sure you have Gradle updated. If you get an error stating `Gradle Version 2.10 is required`, ensure you select `Use default Gradle wrapper` when starting Android Studio. Then edit the `Project/gradle/wrapper/gradle-wrapper.properties` file and change the distributionUrl line to `distributionUrl=http\://services.gradle.org/distributions/gradle-2.10-all.zip`.
## Other Notes
We use a timestamp in the `config.xml`'s `<widget>` `id` field so the app has a different identifier for each build. This allows us to test user-granted permissions – as if the app has never been installed – every time we re-build.
The seemingly unecessary dependency on `lodash-node` prevents an occasional and elusive bug in the `cordova build` command.
| {
"content_hash": "d7a586bc2f955f3f9b5eeacc74d44bba",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 378,
"avg_line_length": 84.34285714285714,
"alnum_prop": 0.7869241192411924,
"repo_name": "bitpay/cordova-plugin-qrscanner",
"id": "fa594027026fe11fd381ccec23a4f0c7ddd0481a",
"size": "2992",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/project/readme.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "22931"
},
{
"name": "CSS",
"bytes": "1551"
},
{
"name": "HTML",
"bytes": "4207"
},
{
"name": "Java",
"bytes": "28162"
},
{
"name": "JavaScript",
"bytes": "53124"
},
{
"name": "Swift",
"bytes": "19193"
}
],
"symlink_target": ""
} |
using namespace cv;
using namespace std;
using namespace firesight;
bool Pipeline::apply_normalize(json_t *pStage, json_t *pStageModel, Model &model) {
vector<float> domain = jo_vectorf(pStage, "domain", vector<float>(), model.argMap);
vector<float> range = jo_vectorf(pStage, "range", vector<float>(), model.argMap);
double alpha = 1;
double beta = 0;
string normTypeStr = jo_string(pStage, "normType", "NORM_L2", model.argMap);
int normType;
string errMsg;
if (errMsg.empty()) {
if (model.image.depth() == CV_8U) {
if (domain.size() == 0) {
domain.push_back(0);
domain.push_back(255);
}
}
if (domain.size() > 0) {
if (domain.size() != 2 || domain[0] >= domain[1]) {
errMsg = "Expected domain interval with 2 inclusive values (mininum, maximum)";
}
}
}
if (errMsg.empty() && domain.size() > 0) {
if (model.image.depth() == CV_8U) {
if (domain[1] != 255) {
threshold(model.image, model.image, domain[1], domain[1], THRESH_TRUNC);
}
} else {
threshold(model.image, model.image, domain[1], domain[1], THRESH_TRUNC);
}
if (domain[0] != 0) {
subtract(model.image, Scalar::all(domain[0]), model.image);
}
}
if (errMsg.empty()) {
if (model.image.depth() == CV_8U) {
if (range.size() == 0) {
range.push_back(0);
range.push_back(255);
}
}
if (range.size() > 0) {
if (range.size() != 2 || range[0] >= range[1]) {
errMsg = "Expected range interval with 2 values (mininum, maximum)";
}
}
}
if (errMsg.empty()) {
if (normTypeStr.compare("NORM_L2") == 0) {
normType = NORM_L2;
if (model.image.depth() == CV_8U) {
alpha = sqrt((double) model.image.cols * (double) model.image.rows * range[1] * range[1]);
}
} else if (normTypeStr.compare("NORM_L1") == 0) {
normType = NORM_L1;
if (model.image.depth() == CV_8U) {
alpha = (double) model.image.cols * (double) model.image.rows * range[1];
}
} else if (normTypeStr.compare("NORM_INF") == 0) {
normType = NORM_INF;
if (model.image.depth() == CV_8U) {
alpha = range[1];
}
} else if (normTypeStr.compare("NORM_MINMAX") == 0) {
normType = NORM_MINMAX;
if (model.image.depth() == CV_8U) {
alpha = range[0];
beta = range[1];
}
} else {
errMsg = "Unknown normType: ";
errMsg = errMsg + normTypeStr;
}
}
if (errMsg.empty() && normType != NORM_MINMAX) {
if (range[0] != 0) {
errMsg = "Range minimum can only be non-zero for NORM_MINMAX";
}
}
if (errMsg.empty()) {
alpha = jo_float(pStage, "alpha", alpha, model.argMap);
beta = jo_float(pStage, "beta", beta, model.argMap);
normalize(model.image, model.image, alpha, beta, normType);
}
return stageOK("apply_normalize(%s) %s", errMsg.c_str(), pStage, pStageModel);
}
| {
"content_hash": "1db4d35700e46e1c5c78241d4f346663",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 91,
"avg_line_length": 29.484536082474225,
"alnum_prop": 0.58006993006993,
"repo_name": "simonfojtu/FireSight",
"id": "2bd735a1ebd5c7cfa3d750a02f5b4466c51a40ef",
"size": "3194",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "stages/normalize.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "3827"
},
{
"name": "C++",
"bytes": "359128"
},
{
"name": "CMake",
"bytes": "11720"
},
{
"name": "Shell",
"bytes": "22064"
}
],
"symlink_target": ""
} |
require File.join(File.dirname(__FILE__), 'resource_database')
class Chef
class Resource
class DatabaseUser < Chef::Resource::Database
def initialize(name, run_context=nil)
super
@resource_name = :database_user
@username = name
@database_name = nil
@table = nil
@host = 'localhost'
@privileges = [:all]
@grant_option = false
@allowed_actions.push(:create, :drop, :grant)
@action = :create
end
def database_name(arg=nil)
set_or_return(
:database_name,
arg,
:kind_of => String
)
end
def username(arg=nil)
set_or_return(
:username,
arg,
:kind_of => String
)
end
def password(arg=nil)
set_or_return(
:password,
arg,
:kind_of => String,
:required => true
)
end
def table(arg=nil)
set_or_return(
:table,
arg,
:kind_of => String
)
end
def host(arg=nil)
set_or_return(
:host,
arg,
:kind_of => String
)
end
def privileges(arg=nil)
set_or_return(
:privileges,
arg,
:kind_of => Array
)
end
def grant_option(arg=nil)
set_or_return(
:grant_option,
arg,
:kind_of => [ TrueClass, FalseClass ], :default => false
)
end
end
end
end
| {
"content_hash": "02f5ff545f1ee7cdccb1c537bdf90188",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 66,
"avg_line_length": 19.878048780487806,
"alnum_prop": 0.4392638036809816,
"repo_name": "unok/vagrant-playframework",
"id": "6eefc9545357128b8b1b3abb54275ef2d75287d7",
"size": "2335",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chef/cookbooks/database/libraries/resource_database_user.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "481474"
}
],
"symlink_target": ""
} |
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkPath.h"
#include "src/core/SkAdvancedTypefaceMetrics.h"
#include "src/core/SkGlyph.h"
#include "src/core/SkRectPriv.h"
#include "tools/fonts/RandomScalerContext.h"
class SkDescriptor;
class RandomScalerContext : public SkScalerContext {
public:
RandomScalerContext(sk_sp<SkRandomTypeface>,
const SkScalerContextEffects&,
const SkDescriptor*,
bool fFakeIt);
protected:
unsigned generateGlyphCount() override;
bool generateAdvance(SkGlyph*) override;
void generateMetrics(SkGlyph*) override;
void generateImage(const SkGlyph&) override;
bool generatePath(SkGlyphID, SkPath*) override;
void generateFontMetrics(SkFontMetrics*) override;
private:
SkRandomTypeface* getRandomTypeface() const {
return static_cast<SkRandomTypeface*>(this->getTypeface());
}
std::unique_ptr<SkScalerContext> fProxy;
bool fFakeIt;
};
RandomScalerContext::RandomScalerContext(sk_sp<SkRandomTypeface> face,
const SkScalerContextEffects& effects,
const SkDescriptor* desc,
bool fakeIt)
: SkScalerContext(std::move(face), effects, desc)
, fProxy(getRandomTypeface()->proxy()->createScalerContext(SkScalerContextEffects(), desc))
, fFakeIt(fakeIt) {
fProxy->forceGenerateImageFromPath();
}
unsigned RandomScalerContext::generateGlyphCount() { return fProxy->getGlyphCount(); }
bool RandomScalerContext::generateAdvance(SkGlyph* glyph) { return fProxy->generateAdvance(glyph); }
void RandomScalerContext::generateMetrics(SkGlyph* glyph) {
// Here we will change the mask format of the glyph
// NOTE: this may be overridden by the base class (e.g. if a mask filter is applied).
switch (glyph->getGlyphID() % 4) {
case 0: glyph->fMaskFormat = SkMask::kLCD16_Format; break;
case 1: glyph->fMaskFormat = SkMask::kA8_Format; break;
case 2: glyph->fMaskFormat = SkMask::kARGB32_Format; break;
case 3: glyph->fMaskFormat = SkMask::kBW_Format; break;
}
fProxy->getMetrics(glyph);
if (fFakeIt || (glyph->getGlyphID() % 4) != 2) {
return;
}
SkPath path;
if (!fProxy->getPath(glyph->getPackedID(), &path)) {
return;
}
glyph->fMaskFormat = SkMask::kARGB32_Format;
SkRect storage;
const SkPaint& paint = this->getRandomTypeface()->paint();
const SkRect& newBounds =
paint.doComputeFastBounds(path.getBounds(), &storage, SkPaint::kFill_Style);
SkIRect ibounds;
newBounds.roundOut(&ibounds);
glyph->fLeft = ibounds.fLeft;
glyph->fTop = ibounds.fTop;
glyph->fWidth = ibounds.width();
glyph->fHeight = ibounds.height();
}
void RandomScalerContext::generateImage(const SkGlyph& glyph) {
// TODO: can force down but not up
/*
SkMask::Format format = (SkMask::Format)glyph.fMaskFormat;
switch (glyph.getGlyphID() % 4) {
case 0: format = SkMask::kLCD16_Format; break;
case 1: format = SkMask::kA8_Format; break;
case 2: format = SkMask::kARGB32_Format; break;
case 3: format = SkMask::kBW_Format; break;
}
const_cast<SkGlyph&>(glyph).fMaskFormat = format;
*/
if (fFakeIt) {
sk_bzero(glyph.fImage, glyph.imageSize());
return;
}
if (SkMask::kARGB32_Format != glyph.fMaskFormat) {
fProxy->getImage(glyph);
return;
}
// If the format is ARGB, just draw the glyph from path.
SkPath path;
if (!fProxy->getPath(glyph.getPackedID(), &path)) {
fProxy->getImage(glyph);
return;
}
SkBitmap bm;
bm.installPixels(SkImageInfo::MakeN32Premul(glyph.fWidth, glyph.fHeight),
glyph.fImage,
glyph.rowBytes());
bm.eraseColor(0);
SkCanvas canvas(bm);
canvas.translate(-SkIntToScalar(glyph.fLeft), -SkIntToScalar(glyph.fTop));
canvas.drawPath(path, this->getRandomTypeface()->paint());
}
bool RandomScalerContext::generatePath(SkGlyphID glyph, SkPath* path) {
return fProxy->generatePath(glyph, path);
}
void RandomScalerContext::generateFontMetrics(SkFontMetrics* metrics) {
fProxy->getFontMetrics(metrics);
}
///////////////////////////////////////////////////////////////////////////////
SkRandomTypeface::SkRandomTypeface(sk_sp<SkTypeface> proxy, const SkPaint& paint, bool fakeIt)
: SkTypeface(proxy->fontStyle(), false)
, fProxy(std::move(proxy))
, fPaint(paint)
, fFakeIt(fakeIt) {}
SkScalerContext* SkRandomTypeface::onCreateScalerContext(const SkScalerContextEffects& effects,
const SkDescriptor* desc) const {
return new RandomScalerContext(
sk_ref_sp(const_cast<SkRandomTypeface*>(this)), effects, desc, fFakeIt);
}
void SkRandomTypeface::onFilterRec(SkScalerContextRec* rec) const {
fProxy->filterRec(rec);
rec->setHinting(SkFontHinting::kNone);
rec->fMaskFormat = SkMask::kARGB32_Format;
}
void SkRandomTypeface::getGlyphToUnicodeMap(SkUnichar* glyphToUnicode) const {
fProxy->getGlyphToUnicodeMap(glyphToUnicode);
}
std::unique_ptr<SkAdvancedTypefaceMetrics> SkRandomTypeface::onGetAdvancedMetrics() const {
return fProxy->getAdvancedMetrics();
}
std::unique_ptr<SkStreamAsset> SkRandomTypeface::onOpenStream(int* ttcIndex) const {
return fProxy->openStream(ttcIndex);
}
sk_sp<SkTypeface> SkRandomTypeface::onMakeClone(const SkFontArguments& args) const {
sk_sp<SkTypeface> proxy = fProxy->makeClone(args);
if (!proxy) {
return nullptr;
}
return sk_make_sp<SkRandomTypeface>(proxy, fPaint, fFakeIt);
}
void SkRandomTypeface::onGetFontDescriptor(SkFontDescriptor* desc, bool* isLocal) const {
// TODO: anything that uses this typeface isn't correctly serializable, since this typeface
// cannot be deserialized.
fProxy->getFontDescriptor(desc, isLocal);
}
void SkRandomTypeface::onCharsToGlyphs(const SkUnichar* uni, int count, SkGlyphID glyphs[]) const {
fProxy->unicharsToGlyphs(uni, count, glyphs);
}
int SkRandomTypeface::onCountGlyphs() const { return fProxy->countGlyphs(); }
int SkRandomTypeface::onGetUPEM() const { return fProxy->getUnitsPerEm(); }
void SkRandomTypeface::onGetFamilyName(SkString* familyName) const {
fProxy->getFamilyName(familyName);
}
SkTypeface::LocalizedStrings* SkRandomTypeface::onCreateFamilyNameIterator() const {
return fProxy->createFamilyNameIterator();
}
void SkRandomTypeface::getPostScriptGlyphNames(SkString* names) const {
return fProxy->getPostScriptGlyphNames(names);
}
int SkRandomTypeface::onGetVariationDesignPosition(
SkFontArguments::VariationPosition::Coordinate coordinates[],
int coordinateCount) const {
return fProxy->onGetVariationDesignPosition(coordinates, coordinateCount);
}
int SkRandomTypeface::onGetVariationDesignParameters(SkFontParameters::Variation::Axis parameters[],
int parameterCount) const {
return fProxy->onGetVariationDesignParameters(parameters, parameterCount);
}
int SkRandomTypeface::onGetTableTags(SkFontTableTag tags[]) const {
return fProxy->getTableTags(tags);
}
size_t SkRandomTypeface::onGetTableData(SkFontTableTag tag,
size_t offset,
size_t length,
void* data) const {
return fProxy->getTableData(tag, offset, length, data);
}
| {
"content_hash": "a6d0aeab2f5489ae04f166ca91b0a206",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 100,
"avg_line_length": 36.00456621004566,
"alnum_prop": 0.6522511097019658,
"repo_name": "endlessm/chromium-browser",
"id": "1fe188a2a6c4d6b6c56b10c9c44e4c984a62d0ab",
"size": "8028",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "third_party/skia/tools/fonts/RandomScalerContext.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using BattleAxe;
namespace BattleAxe.Test {
[TestClass]
public class TestSettingGettingOfNullableTypes {
[TestMethod]
public void TestInt() {
Assert.IsTrue(TestSetOfValue("NullableInt", 4));
}
[TestMethod]
public void TestIntForNull() {
var obj = new NullableTestClass();
obj.NullableInt = 4;
Assert.IsTrue(TestSetOfValue("NullableInt", null));
}
[TestMethod]
public void TestBoolean() {
object b = true;
Assert.IsTrue(TestSetOfValue("NullableBoolean", b));
}
[TestMethod]
public void TestBooleanForNull() {
var obj = new NullableTestClass();
obj.NullableBoolean = true;
Assert.IsTrue(TestSetOfValue("NullableBoolean", null));
}
[TestMethod]
public void TestDouble() {
Assert.IsTrue(TestSetOfValue("NullableDouble", 1));
}
[TestMethod]
public void TestDoubleForNull() {
var obj = new NullableTestClass();
obj.NullableDouble = 1;
Assert.IsTrue(TestSetOfValue("NullableDouble", null));
}
[TestMethod]
public void TestAllFields() {
var dict = new System.Collections.Generic.Dictionary<string, object>();
dict.Add("NullableInt", 1);
dict.Add("NullableBoolean", true);
dict.Add("NullableDouble", (double)10);
dict.Add("NullableByte", (byte)1);
dict.Add("NullableShort", (short)1);
dict.Add("NullableLong", (long)1);
dict.Add("NullableSingle", (Single)1);
dict.Add("NullableDecimal", (byte)1);
dict.Add("NullableChar", (char)';');
dict.Add("NullableGuid", Guid.NewGuid());
dict.Add("NullableDateTime", DateTime.Now);
bool passed = true;
var obj = new NullableTestClass();
foreach (System.Collections.Generic.KeyValuePair<string, object> item in dict) {
if (!TestSetOfValue(item.Key, item.Value, obj)) {
passed = false;
}
}
Assert.IsTrue(passed);
}
[TestMethod]
public void TestAllFieldsGoBackToNull() {
var dict = new System.Collections.Generic.Dictionary<string, object>();
dict.Add("NullableInt", 1);
dict.Add("NullableBoolean", true);
dict.Add("NullableDouble", (double)10);
dict.Add("NullableByte", (byte)1);
dict.Add("NullableShort", (short)1);
dict.Add("NullableLong", (long)1);
dict.Add("NullableSingle", (Single)1);
dict.Add("NullableDecimal", (byte)1);
dict.Add("NullableChar", (char)';');
dict.Add("NullableGuid", Guid.NewGuid());
dict.Add("NullableDateTime", DateTime.Now);
bool passed = true;
var obj = new NullableTestClass();
foreach (System.Collections.Generic.KeyValuePair<string, object> item in dict) {
TestSetOfValue(item.Key, item.Value, obj);
if(!TestSetOfValue(item.Key, null, obj)) {
passed = false;
}
}
Assert.IsTrue(passed);
}
public static bool TestSetOfValue(string property, object value, NullableTestClass obj = null) {
obj = obj ?? new NullableTestClass();
var setMethod = Compiler.SetMethod(obj);
var getMethod = Compiler.GetMethod(obj);
setMethod(obj, property, value);
var currentValue = getMethod(obj, property);
if(currentValue == null && value == null) {
return true;
}
return currentValue.ToString() == value.ToString();
}
}
public class NullableTestClass {
public int? NullableInt { get; set; }
public bool? NullableBoolean { get; set; }
public double? NullableDouble { get; set; }
public byte? NullableByte { get; set; }
public short? NullableShort { get; set; }
public long? NullableLong { get; set; }
public Single? NullableSingle { get; set; }
public decimal? NullableDecimal { get; set; }
public char? NullableChar { get; set; }
public Guid? NullableGuid { get; set; }
public DateTime? NullableDateTime { get; set; }
}
}
| {
"content_hash": "3c0cada0bc4236bfa796e082ab7cbbbb",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 104,
"avg_line_length": 36.672,
"alnum_prop": 0.5541012216404887,
"repo_name": "DNCarroll/BattleAxe",
"id": "fcc38338fb055e5c03c9539730b6b38d77492d36",
"size": "4586",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "BattleAxe.Test/NullableTesting.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "186060"
},
{
"name": "CSS",
"bytes": "1868"
},
{
"name": "HTML",
"bytes": "3527"
}
],
"symlink_target": ""
} |
package ethanjones.cubes.side.server.command;
import ethanjones.cubes.core.localization.Localization;
import ethanjones.cubes.core.logging.Log;
import ethanjones.cubes.side.server.commands.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
public class CommandManager {
public static HashMap<String, CommandBuilder> commands = new HashMap<String, CommandBuilder>();
protected static void register(CommandBuilder commandBuilder) {
if (!commands.containsKey(commandBuilder.getCommandString())) {
commands.put(commandBuilder.getCommandString(), commandBuilder);
}
}
public static void run(String command, CommandSender commandSender) {
if (command == null || commandSender == null) return;
ArrayList<String> arg = new ArrayList<String>();
arg.addAll(Arrays.asList(command.split(" *")));
if (arg.size() == 0 || !commands.containsKey(arg.get(0))) {
unknownCommand(commandSender);
return;
}
CommandBuilder commandBuilder = commands.get(arg.get(0));
ArrayList<CommandArgument> commandArguments = new ArrayList<CommandArgument>();
commandArguments.add(new CommandArgument<CommandBuilder>(commandBuilder, CommandValue.command));
if (!check(commandSender, commandBuilder, arg, commandArguments, 1, command)) {
HelpCommand.print(commandBuilder, commandSender);
}
}
private static boolean check(CommandSender sender, CommandBuilder commandBuilder, ArrayList<String> arg, ArrayList<CommandArgument> arguments, int i, String str) {
boolean success = false;
if (i < arg.size()) {
for (CommandBuilder builder : commandBuilder.getChildren()) {
if (success) break;
String a = arg.get(i);
try {
if (builder.getCommandString() != null) {
if (builder.getCommandString().equals(a)) {
CommandArgument<String> commandArgument = new CommandArgument<String>(a, null);
ArrayList<CommandArgument> c = new ArrayList<CommandArgument>();
c.addAll(arguments);
c.add(commandArgument);
success = check(sender, builder, arg, c, i + 1, str);
}
} else {
Object o = builder.getCommandValue().getArgument(a, sender);
CommandArgument commandArgument = new CommandArgument(o, builder.getCommandValue());
ArrayList<CommandArgument> c = new ArrayList<CommandArgument>();
c.addAll(arguments);
c.add(commandArgument);
success = check(sender, builder, arg, c, i + 1, str);
}
} catch (Exception e) {
if (e instanceof CommandParsingException) {
sender.print(Localization.get(e.getMessage()));
} else {
Log.warning(e.getClass().getSimpleName() + " while running command \"" + str + "\"", e);
sender.print(Localization.get("command.common.exception", e.getClass().getSimpleName()));
}
return true;
}
}
} else {
if (commandBuilder.getCommandListener() != null) {
success = true;
if (CommandPermission.check(commandBuilder.getCommandPermission(), sender.getPermissionLevel())) {
CommandListener commandListener = commandBuilder.getCommandListener();
commandListener.onCommand(commandBuilder, arguments, sender);
} else {
permissionCheckFailed(sender);
}
}
}
return success;
}
public static void unknownCommand(CommandSender commandSender) {
commandSender.print(Localization.get("command.common.unknownCommand"));
}
public static void permissionCheckFailed(CommandSender commandSender) {
commandSender.print(Localization.get("command.common.failedPermissionCheck"));
}
public static void reset() {
commands.clear();
init();
}
protected static void init() {
HelpCommand.init();
SaveCommand.init();
TeleportCommand.init();
TimeCommand.init();
RainCommand.init();
NoClipCommand.init();
StopCommand.init();
ThreadDumpCommand.init();
}
}
| {
"content_hash": "796c206d7c75f5cb14388ee907bc3328",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 165,
"avg_line_length": 37.55045871559633,
"alnum_prop": 0.6638162716833619,
"repo_name": "ictrobot/Cubes",
"id": "505a3308309aee36f0c12950a744b8953ecffc0b",
"size": "4093",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/src/ethanjones/cubes/side/server/command/CommandManager.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "GLSL",
"bytes": "4334"
},
{
"name": "Java",
"bytes": "1080177"
},
{
"name": "Lua",
"bytes": "2666"
},
{
"name": "Shell",
"bytes": "245"
}
],
"symlink_target": ""
} |
<ion-view view-title="<%= moduleName %> debug">
<!-- do you want padding? -->
<ion-content class="padding">
<!-- content goes here -->
<ion-list>
<ion-item class="item item-divider">
Some basic checks
</ion-item>
<ion-item class="item item-icon">
icons working?
<i class="icon ion-checkmark-circled"></i>
</ion-item>
<ion-item class="item item-thumbnail">
images working?<br>
<img width="75" src="base/main/assets/images/yo@2x.png">
</ion-item>
<ion-item class="item">{{ctrl.someData.binding}}</ion-item>
<ion-item class="item item-divider">Environment variables:</ion-item>
<ion-item class="item item-text-wrap">
<pre>{{ctrl.ENV | json}}</pre>
</ion-item>
<ion-item class="item item-divider">Build variables:</ion-item>
<ion-item class="item item-text-wrap">
<pre>{{ctrl.BUILD | json}}</pre>
</ion-item>
<ion-item class="item item-divider">Device:</ion-item>
<ion-item class="item item-text-wrap">
<pre>{{ctrl.device | json}}</pre>
</ion-item>
<ion-item class="item item-divider">Password Test:</ion-item>
<ion-item class="item item-text-wrap">
<label class="item item-input">
<span class="input-label">Password</span>
<input type="password"
ng-model="ctrl.password.input"
ng-change="ctrl.grade()">
</label>
</ion-item>
<ion-item class="item item-text-wrap">
Strength
<span class="badge"
ng-class="{
'badge-assertive': ctrl.password.strength === 'weak',
'badge-balanced': ctrl.password.strength === 'strong',
'badge-energized': ctrl.password.strength === 'medium'
}"
ng-bind="ctrl.password.strength"></span>
</ion-item>
</ion-list>
</ion-content>
</ion-view>
| {
"content_hash": "618d2e7d720b7095bc506b4f9d929287",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 75,
"avg_line_length": 34.19642857142857,
"alnum_prop": 0.5650130548302872,
"repo_name": "marcelinobadin/generator-misha",
"id": "82235fa1236095b7278153009bedc7a0c02125f2",
"size": "1915",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "generators/template/templates/_debug.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1312"
},
{
"name": "HTML",
"bytes": "6328"
},
{
"name": "JavaScript",
"bytes": "157633"
},
{
"name": "Shell",
"bytes": "1893"
}
],
"symlink_target": ""
} |
namespace absl {
ABSL_NAMESPACE_BEGIN
// Defined and documented later on in this file.
template <typename T>
struct is_trivially_destructible;
// Defined and documented later on in this file.
template <typename T>
struct is_trivially_move_assignable;
namespace type_traits_internal {
// Silence MSVC warnings about the destructor being defined as deleted.
#if defined(_MSC_VER) && !defined(__GNUC__)
#pragma warning(push)
#pragma warning(disable : 4624)
#endif // defined(_MSC_VER) && !defined(__GNUC__)
template <class T>
union SingleMemberUnion {
T t;
};
// Restore the state of the destructor warning that was silenced above.
#if defined(_MSC_VER) && !defined(__GNUC__)
#pragma warning(pop)
#endif // defined(_MSC_VER) && !defined(__GNUC__)
template <class T>
struct IsTriviallyMoveConstructibleObject
: std::integral_constant<
bool, std::is_move_constructible<
type_traits_internal::SingleMemberUnion<T>>::value &&
absl::is_trivially_destructible<T>::value> {};
template <class T>
struct IsTriviallyCopyConstructibleObject
: std::integral_constant<
bool, std::is_copy_constructible<
type_traits_internal::SingleMemberUnion<T>>::value &&
absl::is_trivially_destructible<T>::value> {};
template <class T>
struct IsTriviallyMoveAssignableReference : std::false_type {};
template <class T>
struct IsTriviallyMoveAssignableReference<T&>
: absl::is_trivially_move_assignable<T>::type {};
template <class T>
struct IsTriviallyMoveAssignableReference<T&&>
: absl::is_trivially_move_assignable<T>::type {};
template <typename... Ts>
struct VoidTImpl {
using type = void;
};
// This trick to retrieve a default alignment is necessary for our
// implementation of aligned_storage_t to be consistent with any implementation
// of std::aligned_storage.
template <size_t Len, typename T = std::aligned_storage<Len>>
struct default_alignment_of_aligned_storage;
template <size_t Len, size_t Align>
struct default_alignment_of_aligned_storage<Len,
std::aligned_storage<Len, Align>> {
static constexpr size_t value = Align;
};
////////////////////////////////
// Library Fundamentals V2 TS //
////////////////////////////////
// NOTE: The `is_detected` family of templates here differ from the library
// fundamentals specification in that for library fundamentals, `Op<Args...>` is
// evaluated as soon as the type `is_detected<Op, Args...>` undergoes
// substitution, regardless of whether or not the `::value` is accessed. That
// is inconsistent with all other standard traits and prevents lazy evaluation
// in larger contexts (such as if the `is_detected` check is a trailing argument
// of a `conjunction`. This implementation opts to instead be lazy in the same
// way that the standard traits are (this "defect" of the detection idiom
// specifications has been reported).
template <class Enabler, template <class...> class Op, class... Args>
struct is_detected_impl {
using type = std::false_type;
};
template <template <class...> class Op, class... Args>
struct is_detected_impl<typename VoidTImpl<Op<Args...>>::type, Op, Args...> {
using type = std::true_type;
};
template <template <class...> class Op, class... Args>
struct is_detected : is_detected_impl<void, Op, Args...>::type {};
template <class Enabler, class To, template <class...> class Op, class... Args>
struct is_detected_convertible_impl {
using type = std::false_type;
};
template <class To, template <class...> class Op, class... Args>
struct is_detected_convertible_impl<
typename std::enable_if<std::is_convertible<Op<Args...>, To>::value>::type,
To, Op, Args...> {
using type = std::true_type;
};
template <class To, template <class...> class Op, class... Args>
struct is_detected_convertible
: is_detected_convertible_impl<void, To, Op, Args...>::type {};
template <typename T>
using IsCopyAssignableImpl =
decltype(std::declval<T&>() = std::declval<const T&>());
template <typename T>
using IsMoveAssignableImpl = decltype(std::declval<T&>() = std::declval<T&&>());
} // namespace type_traits_internal
// MSVC 19.20 has a regression that causes our workarounds to fail, but their
// std forms now appear to be compliant.
#if defined(_MSC_VER) && !defined(__clang__) && (_MSC_VER >= 1920)
template <typename T>
using is_copy_assignable = std::is_copy_assignable<T>;
template <typename T>
using is_move_assignable = std::is_move_assignable<T>;
#else
template <typename T>
struct is_copy_assignable : type_traits_internal::is_detected<
type_traits_internal::IsCopyAssignableImpl, T> {
};
template <typename T>
struct is_move_assignable : type_traits_internal::is_detected<
type_traits_internal::IsMoveAssignableImpl, T> {
};
#endif
// void_t()
//
// Ignores the type of any its arguments and returns `void`. In general, this
// metafunction allows you to create a general case that maps to `void` while
// allowing specializations that map to specific types.
//
// This metafunction is designed to be a drop-in replacement for the C++17
// `std::void_t` metafunction.
//
// NOTE: `absl::void_t` does not use the standard-specified implementation so
// that it can remain compatible with gcc < 5.1. This can introduce slightly
// different behavior, such as when ordering partial specializations.
template <typename... Ts>
using void_t = typename type_traits_internal::VoidTImpl<Ts...>::type;
// conjunction
//
// Performs a compile-time logical AND operation on the passed types (which
// must have `::value` members convertible to `bool`. Short-circuits if it
// encounters any `false` members (and does not compare the `::value` members
// of any remaining arguments).
//
// This metafunction is designed to be a drop-in replacement for the C++17
// `std::conjunction` metafunction.
template <typename... Ts>
struct conjunction : std::true_type {};
template <typename T, typename... Ts>
struct conjunction<T, Ts...>
: std::conditional<T::value, conjunction<Ts...>, T>::type {};
template <typename T>
struct conjunction<T> : T {};
// disjunction
//
// Performs a compile-time logical OR operation on the passed types (which
// must have `::value` members convertible to `bool`. Short-circuits if it
// encounters any `true` members (and does not compare the `::value` members
// of any remaining arguments).
//
// This metafunction is designed to be a drop-in replacement for the C++17
// `std::disjunction` metafunction.
template <typename... Ts>
struct disjunction : std::false_type {};
template <typename T, typename... Ts>
struct disjunction<T, Ts...> :
std::conditional<T::value, T, disjunction<Ts...>>::type {};
template <typename T>
struct disjunction<T> : T {};
// negation
//
// Performs a compile-time logical NOT operation on the passed type (which
// must have `::value` members convertible to `bool`.
//
// This metafunction is designed to be a drop-in replacement for the C++17
// `std::negation` metafunction.
template <typename T>
struct negation : std::integral_constant<bool, !T::value> {};
// is_function()
//
// Determines whether the passed type `T` is a function type.
//
// This metafunction is designed to be a drop-in replacement for the C++11
// `std::is_function()` metafunction for platforms that have incomplete C++11
// support (such as libstdc++ 4.x).
//
// This metafunction works because appending `const` to a type does nothing to
// function types and reference types (and forms a const-qualified type
// otherwise).
template <typename T>
struct is_function
: std::integral_constant<
bool, !(std::is_reference<T>::value ||
std::is_const<typename std::add_const<T>::type>::value)> {};
// is_trivially_destructible()
//
// Determines whether the passed type `T` is trivially destructible.
//
// This metafunction is designed to be a drop-in replacement for the C++11
// `std::is_trivially_destructible()` metafunction for platforms that have
// incomplete C++11 support (such as libstdc++ 4.x). On any platforms that do
// fully support C++11, we check whether this yields the same result as the std
// implementation.
//
// NOTE: the extensions (__has_trivial_xxx) are implemented in gcc (version >=
// 4.3) and clang. Since we are supporting libstdc++ > 4.7, they should always
// be present. These extensions are documented at
// https://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html#Type-Traits.
template <typename T>
struct is_trivially_destructible
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
: std::is_trivially_destructible<T> {
#else
: std::integral_constant<bool, __has_trivial_destructor(T) &&
std::is_destructible<T>::value> {
#endif
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
private:
static constexpr bool compliant = std::is_trivially_destructible<T>::value ==
is_trivially_destructible::value;
static_assert(compliant || std::is_trivially_destructible<T>::value,
"Not compliant with std::is_trivially_destructible; "
"Standard: false, Implementation: true");
static_assert(compliant || !std::is_trivially_destructible<T>::value,
"Not compliant with std::is_trivially_destructible; "
"Standard: true, Implementation: false");
#endif // ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
};
// is_trivially_default_constructible()
//
// Determines whether the passed type `T` is trivially default constructible.
//
// This metafunction is designed to be a drop-in replacement for the C++11
// `std::is_trivially_default_constructible()` metafunction for platforms that
// have incomplete C++11 support (such as libstdc++ 4.x). On any platforms that
// do fully support C++11, we check whether this yields the same result as the
// std implementation.
//
// NOTE: according to the C++ standard, Section: 20.15.4.3 [meta.unary.prop]
// "The predicate condition for a template specialization is_constructible<T,
// Args...> shall be satisfied if and only if the following variable
// definition would be well-formed for some invented variable t:
//
// T t(declval<Args>()...);
//
// is_trivially_constructible<T, Args...> additionally requires that the
// variable definition does not call any operation that is not trivial.
// For the purposes of this check, the call to std::declval is considered
// trivial."
//
// Notes from https://en.cppreference.com/w/cpp/types/is_constructible:
// In many implementations, is_nothrow_constructible also checks if the
// destructor throws because it is effectively noexcept(T(arg)). Same
// applies to is_trivially_constructible, which, in these implementations, also
// requires that the destructor is trivial.
// GCC bug 51452: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51452
// LWG issue 2116: http://cplusplus.github.io/LWG/lwg-active.html#2116.
//
// "T obj();" need to be well-formed and not call any nontrivial operation.
// Nontrivially destructible types will cause the expression to be nontrivial.
template <typename T>
struct is_trivially_default_constructible
#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE)
: std::is_trivially_default_constructible<T> {
#else
: std::integral_constant<bool, __has_trivial_constructor(T) &&
std::is_default_constructible<T>::value &&
is_trivially_destructible<T>::value> {
#endif
#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE) && \
!defined( \
ABSL_META_INTERNAL_STD_CONSTRUCTION_TRAITS_DONT_CHECK_DESTRUCTION)
private:
static constexpr bool compliant =
std::is_trivially_default_constructible<T>::value ==
is_trivially_default_constructible::value;
static_assert(compliant || std::is_trivially_default_constructible<T>::value,
"Not compliant with std::is_trivially_default_constructible; "
"Standard: false, Implementation: true");
static_assert(compliant || !std::is_trivially_default_constructible<T>::value,
"Not compliant with std::is_trivially_default_constructible; "
"Standard: true, Implementation: false");
#endif // ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
};
// is_trivially_move_constructible()
//
// Determines whether the passed type `T` is trivially move constructible.
//
// This metafunction is designed to be a drop-in replacement for the C++11
// `std::is_trivially_move_constructible()` metafunction for platforms that have
// incomplete C++11 support (such as libstdc++ 4.x). On any platforms that do
// fully support C++11, we check whether this yields the same result as the std
// implementation.
//
// NOTE: `T obj(declval<T>());` needs to be well-formed and not call any
// nontrivial operation. Nontrivially destructible types will cause the
// expression to be nontrivial.
template <typename T>
struct is_trivially_move_constructible
#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE)
: std::is_trivially_move_constructible<T> {
#else
: std::conditional<
std::is_object<T>::value && !std::is_array<T>::value,
type_traits_internal::IsTriviallyMoveConstructibleObject<T>,
std::is_reference<T>>::type::type {
#endif
#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE) && \
!defined( \
ABSL_META_INTERNAL_STD_CONSTRUCTION_TRAITS_DONT_CHECK_DESTRUCTION)
private:
static constexpr bool compliant =
std::is_trivially_move_constructible<T>::value ==
is_trivially_move_constructible::value;
static_assert(compliant || std::is_trivially_move_constructible<T>::value,
"Not compliant with std::is_trivially_move_constructible; "
"Standard: false, Implementation: true");
static_assert(compliant || !std::is_trivially_move_constructible<T>::value,
"Not compliant with std::is_trivially_move_constructible; "
"Standard: true, Implementation: false");
#endif // ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
};
// is_trivially_copy_constructible()
//
// Determines whether the passed type `T` is trivially copy constructible.
//
// This metafunction is designed to be a drop-in replacement for the C++11
// `std::is_trivially_copy_constructible()` metafunction for platforms that have
// incomplete C++11 support (such as libstdc++ 4.x). On any platforms that do
// fully support C++11, we check whether this yields the same result as the std
// implementation.
//
// NOTE: `T obj(declval<const T&>());` needs to be well-formed and not call any
// nontrivial operation. Nontrivially destructible types will cause the
// expression to be nontrivial.
template <typename T>
struct is_trivially_copy_constructible
: std::conditional<
std::is_object<T>::value && !std::is_array<T>::value,
type_traits_internal::IsTriviallyCopyConstructibleObject<T>,
std::is_lvalue_reference<T>>::type::type {
#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE) && \
!defined( \
ABSL_META_INTERNAL_STD_CONSTRUCTION_TRAITS_DONT_CHECK_DESTRUCTION)
private:
static constexpr bool compliant =
std::is_trivially_copy_constructible<T>::value ==
is_trivially_copy_constructible::value;
static_assert(compliant || std::is_trivially_copy_constructible<T>::value,
"Not compliant with std::is_trivially_copy_constructible; "
"Standard: false, Implementation: true");
static_assert(compliant || !std::is_trivially_copy_constructible<T>::value,
"Not compliant with std::is_trivially_copy_constructible; "
"Standard: true, Implementation: false");
#endif // ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
};
// is_trivially_move_assignable()
//
// Determines whether the passed type `T` is trivially move assignable.
//
// This metafunction is designed to be a drop-in replacement for the C++11
// `std::is_trivially_move_assignable()` metafunction for platforms that have
// incomplete C++11 support (such as libstdc++ 4.x). On any platforms that do
// fully support C++11, we check whether this yields the same result as the std
// implementation.
//
// NOTE: `is_assignable<T, U>::value` is `true` if the expression
// `declval<T>() = declval<U>()` is well-formed when treated as an unevaluated
// operand. `is_trivially_assignable<T, U>` requires the assignment to call no
// operation that is not trivial. `is_trivially_copy_assignable<T>` is simply
// `is_trivially_assignable<T&, T>`.
template <typename T>
struct is_trivially_move_assignable
: std::conditional<
std::is_object<T>::value && !std::is_array<T>::value &&
std::is_move_assignable<T>::value,
std::is_move_assignable<type_traits_internal::SingleMemberUnion<T>>,
type_traits_internal::IsTriviallyMoveAssignableReference<T>>::type::
type {
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
private:
static constexpr bool compliant =
std::is_trivially_move_assignable<T>::value ==
is_trivially_move_assignable::value;
static_assert(compliant || std::is_trivially_move_assignable<T>::value,
"Not compliant with std::is_trivially_move_assignable; "
"Standard: false, Implementation: true");
static_assert(compliant || !std::is_trivially_move_assignable<T>::value,
"Not compliant with std::is_trivially_move_assignable; "
"Standard: true, Implementation: false");
#endif // ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
};
// is_trivially_copy_assignable()
//
// Determines whether the passed type `T` is trivially copy assignable.
//
// This metafunction is designed to be a drop-in replacement for the C++11
// `std::is_trivially_copy_assignable()` metafunction for platforms that have
// incomplete C++11 support (such as libstdc++ 4.x). On any platforms that do
// fully support C++11, we check whether this yields the same result as the std
// implementation.
//
// NOTE: `is_assignable<T, U>::value` is `true` if the expression
// `declval<T>() = declval<U>()` is well-formed when treated as an unevaluated
// operand. `is_trivially_assignable<T, U>` requires the assignment to call no
// operation that is not trivial. `is_trivially_copy_assignable<T>` is simply
// `is_trivially_assignable<T&, const T&>`.
template <typename T>
struct is_trivially_copy_assignable
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
: std::is_trivially_copy_assignable<T> {
#else
: std::integral_constant<
bool, __has_trivial_assign(typename std::remove_reference<T>::type) &&
absl::is_copy_assignable<T>::value> {
#endif
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
private:
static constexpr bool compliant =
std::is_trivially_copy_assignable<T>::value ==
is_trivially_copy_assignable::value;
static_assert(compliant || std::is_trivially_copy_assignable<T>::value,
"Not compliant with std::is_trivially_copy_assignable; "
"Standard: false, Implementation: true");
static_assert(compliant || !std::is_trivially_copy_assignable<T>::value,
"Not compliant with std::is_trivially_copy_assignable; "
"Standard: true, Implementation: false");
#endif // ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
};
#if defined(__cpp_lib_remove_cvref) && __cpp_lib_remove_cvref >= 201711L
template <typename T>
using remove_cvref = std::remove_cvref<T>;
template <typename T>
using remove_cvref_t = typename std::remove_cvref<T>::type;
#else
// remove_cvref()
//
// C++11 compatible implementation of std::remove_cvref which was added in
// C++20.
template <typename T>
struct remove_cvref {
using type =
typename std::remove_cv<typename std::remove_reference<T>::type>::type;
};
template <typename T>
using remove_cvref_t = typename remove_cvref<T>::type;
#endif
namespace type_traits_internal {
// is_trivially_copyable()
//
// Determines whether the passed type `T` is trivially copyable.
//
// This metafunction is designed to be a drop-in replacement for the C++11
// `std::is_trivially_copyable()` metafunction for platforms that have
// incomplete C++11 support (such as libstdc++ 4.x). We use the C++17 definition
// of TriviallyCopyable.
//
// NOTE: `is_trivially_copyable<T>::value` is `true` if all of T's copy/move
// constructors/assignment operators are trivial or deleted, T has at least
// one non-deleted copy/move constructor/assignment operator, and T is trivially
// destructible. Arrays of trivially copyable types are trivially copyable.
//
// We expose this metafunction only for internal use within absl.
#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE)
template <typename T>
struct is_trivially_copyable : std::is_trivially_copyable<T> {};
#else
template <typename T>
class is_trivially_copyable_impl {
using ExtentsRemoved = typename std::remove_all_extents<T>::type;
static constexpr bool kIsCopyOrMoveConstructible =
std::is_copy_constructible<ExtentsRemoved>::value ||
std::is_move_constructible<ExtentsRemoved>::value;
static constexpr bool kIsCopyOrMoveAssignable =
absl::is_copy_assignable<ExtentsRemoved>::value ||
absl::is_move_assignable<ExtentsRemoved>::value;
public:
static constexpr bool kValue =
(__has_trivial_copy(ExtentsRemoved) || !kIsCopyOrMoveConstructible) &&
(__has_trivial_assign(ExtentsRemoved) || !kIsCopyOrMoveAssignable) &&
(kIsCopyOrMoveConstructible || kIsCopyOrMoveAssignable) &&
is_trivially_destructible<ExtentsRemoved>::value &&
// We need to check for this explicitly because otherwise we'll say
// references are trivial copyable when compiled by MSVC.
!std::is_reference<ExtentsRemoved>::value;
};
template <typename T>
struct is_trivially_copyable
: std::integral_constant<
bool, type_traits_internal::is_trivially_copyable_impl<T>::kValue> {};
#endif
} // namespace type_traits_internal
// -----------------------------------------------------------------------------
// C++14 "_t" trait aliases
// -----------------------------------------------------------------------------
template <typename T>
using remove_cv_t = typename std::remove_cv<T>::type;
template <typename T>
using remove_const_t = typename std::remove_const<T>::type;
template <typename T>
using remove_volatile_t = typename std::remove_volatile<T>::type;
template <typename T>
using add_cv_t = typename std::add_cv<T>::type;
template <typename T>
using add_const_t = typename std::add_const<T>::type;
template <typename T>
using add_volatile_t = typename std::add_volatile<T>::type;
template <typename T>
using remove_reference_t = typename std::remove_reference<T>::type;
template <typename T>
using add_lvalue_reference_t = typename std::add_lvalue_reference<T>::type;
template <typename T>
using add_rvalue_reference_t = typename std::add_rvalue_reference<T>::type;
template <typename T>
using remove_pointer_t = typename std::remove_pointer<T>::type;
template <typename T>
using add_pointer_t = typename std::add_pointer<T>::type;
template <typename T>
using make_signed_t = typename std::make_signed<T>::type;
template <typename T>
using make_unsigned_t = typename std::make_unsigned<T>::type;
template <typename T>
using remove_extent_t = typename std::remove_extent<T>::type;
template <typename T>
using remove_all_extents_t = typename std::remove_all_extents<T>::type;
template <size_t Len, size_t Align = type_traits_internal::
default_alignment_of_aligned_storage<Len>::value>
using aligned_storage_t = typename std::aligned_storage<Len, Align>::type;
template <typename T>
using decay_t = typename std::decay<T>::type;
template <bool B, typename T = void>
using enable_if_t = typename std::enable_if<B, T>::type;
template <bool B, typename T, typename F>
using conditional_t = typename std::conditional<B, T, F>::type;
template <typename... T>
using common_type_t = typename std::common_type<T...>::type;
template <typename T>
using underlying_type_t = typename std::underlying_type<T>::type;
namespace type_traits_internal {
#if (defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703L) || \
(defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
// std::result_of is deprecated (C++17) or removed (C++20)
template<typename> struct result_of;
template<typename F, typename... Args>
struct result_of<F(Args...)> : std::invoke_result<F, Args...> {};
#else
template<typename F> using result_of = std::result_of<F>;
#endif
} // namespace type_traits_internal
template<typename F>
using result_of_t = typename type_traits_internal::result_of<F>::type;
namespace type_traits_internal {
// In MSVC we can't probe std::hash or stdext::hash because it triggers a
// static_assert instead of failing substitution. Libc++ prior to 4.0
// also used a static_assert.
//
#if defined(_MSC_VER) || (defined(_LIBCPP_VERSION) && \
_LIBCPP_VERSION < 4000 && _LIBCPP_STD_VER > 11)
#define ABSL_META_INTERNAL_STD_HASH_SFINAE_FRIENDLY_ 0
#else
#define ABSL_META_INTERNAL_STD_HASH_SFINAE_FRIENDLY_ 1
#endif
#if !ABSL_META_INTERNAL_STD_HASH_SFINAE_FRIENDLY_
template <typename Key, typename = size_t>
struct IsHashable : std::true_type {};
#else // ABSL_META_INTERNAL_STD_HASH_SFINAE_FRIENDLY_
template <typename Key, typename = void>
struct IsHashable : std::false_type {};
template <typename Key>
struct IsHashable<
Key,
absl::enable_if_t<std::is_convertible<
decltype(std::declval<std::hash<Key>&>()(std::declval<Key const&>())),
std::size_t>::value>> : std::true_type {};
#endif // !ABSL_META_INTERNAL_STD_HASH_SFINAE_FRIENDLY_
struct AssertHashEnabledHelper {
private:
static void Sink(...) {}
struct NAT {};
template <class Key>
static auto GetReturnType(int)
-> decltype(std::declval<std::hash<Key>>()(std::declval<Key const&>()));
template <class Key>
static NAT GetReturnType(...);
template <class Key>
static std::nullptr_t DoIt() {
static_assert(IsHashable<Key>::value,
"std::hash<Key> does not provide a call operator");
static_assert(
std::is_default_constructible<std::hash<Key>>::value,
"std::hash<Key> must be default constructible when it is enabled");
static_assert(
std::is_copy_constructible<std::hash<Key>>::value,
"std::hash<Key> must be copy constructible when it is enabled");
static_assert(absl::is_copy_assignable<std::hash<Key>>::value,
"std::hash<Key> must be copy assignable when it is enabled");
// is_destructible is unchecked as it's implied by each of the
// is_constructible checks.
using ReturnType = decltype(GetReturnType<Key>(0));
static_assert(std::is_same<ReturnType, NAT>::value ||
std::is_same<ReturnType, size_t>::value,
"std::hash<Key> must return size_t");
return nullptr;
}
template <class... Ts>
friend void AssertHashEnabled();
};
template <class... Ts>
inline void AssertHashEnabled() {
using Helper = AssertHashEnabledHelper;
Helper::Sink(Helper::DoIt<Ts>()...);
}
} // namespace type_traits_internal
// An internal namespace that is required to implement the C++17 swap traits.
// It is not further nested in type_traits_internal to avoid long symbol names.
namespace swap_internal {
// Necessary for the traits.
using std::swap;
// This declaration prevents global `swap` and `absl::swap` overloads from being
// considered unless ADL picks them up.
void swap();
template <class T>
using IsSwappableImpl = decltype(swap(std::declval<T&>(), std::declval<T&>()));
// NOTE: This dance with the default template parameter is for MSVC.
template <class T,
class IsNoexcept = std::integral_constant<
bool, noexcept(swap(std::declval<T&>(), std::declval<T&>()))>>
using IsNothrowSwappableImpl = typename std::enable_if<IsNoexcept::value>::type;
// IsSwappable
//
// Determines whether the standard swap idiom is a valid expression for
// arguments of type `T`.
template <class T>
struct IsSwappable
: absl::type_traits_internal::is_detected<IsSwappableImpl, T> {};
// IsNothrowSwappable
//
// Determines whether the standard swap idiom is a valid expression for
// arguments of type `T` and is noexcept.
template <class T>
struct IsNothrowSwappable
: absl::type_traits_internal::is_detected<IsNothrowSwappableImpl, T> {};
// Swap()
//
// Performs the swap idiom from a namespace where valid candidates may only be
// found in `std` or via ADL.
template <class T, absl::enable_if_t<IsSwappable<T>::value, int> = 0>
void Swap(T& lhs, T& rhs) noexcept(IsNothrowSwappable<T>::value) {
swap(lhs, rhs);
}
// StdSwapIsUnconstrained
//
// Some standard library implementations are broken in that they do not
// constrain `std::swap`. This will effectively tell us if we are dealing with
// one of those implementations.
using StdSwapIsUnconstrained = IsSwappable<void()>;
} // namespace swap_internal
namespace type_traits_internal {
// Make the swap-related traits/function accessible from this namespace.
using swap_internal::IsNothrowSwappable;
using swap_internal::IsSwappable;
using swap_internal::Swap;
using swap_internal::StdSwapIsUnconstrained;
} // namespace type_traits_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_META_TYPE_TRAITS_H_
| {
"content_hash": "040dab44215e5a33b52e0b1717e5904a",
"timestamp": "",
"source": "github",
"line_count": 762,
"max_line_length": 80,
"avg_line_length": 38.846456692913385,
"alnum_prop": 0.6919698658829093,
"repo_name": "nwjs/chromium.src",
"id": "46b76906997c08ca7e90c94381076f3f5c00bde0",
"size": "32095",
"binary": false,
"copies": "5",
"ref": "refs/heads/nw70",
"path": "third_party/abseil-cpp/absl/meta/type_traits.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
package org.netbeans.cubeon.javanet.tasks;
import java.awt.Image;
import java.net.URL;
import java.util.Calendar;
import java.util.List;
import org.kohsuke.jnt.IssueStatus;
import org.kohsuke.jnt.IssueType;
import org.kohsuke.jnt.JNIssue;
import org.netbeans.cubeon.javanet.repository.JavanetTaskRepository;
import org.netbeans.cubeon.tasks.spi.Notifier;
import org.netbeans.cubeon.tasks.spi.task.TaskElement;
import org.netbeans.cubeon.tasks.spi.task.TaskElementChangeAdapter;
import org.openide.util.Lookup;
import org.openide.util.ImageUtilities;
import org.openide.util.lookup.Lookups;
import org.netbeans.cubeon.common.ui.TaskTypeBadge;
/**
*
* @author Tomas Knappek
*/
public class JavanetTask implements TaskElement {
JNIssue _jnIssue = null;
JavanetTaskRepository _repo = null;
JavanetTaskElementNotifier _notifier = null;
JavanetTaskEditorProviderImpl _editorProvider = null;
public JavanetTask(JavanetTaskRepository repo, JNIssue jnIssue) {
_jnIssue = jnIssue;
_repo = repo;
_notifier = new JavanetTaskElementNotifier(this);
_editorProvider = new JavanetTaskEditorProviderImpl(this);
}
public String getId() {
String ret = null;
if (_jnIssue != null) {
ret = Integer.toString(_jnIssue.getId());
}
return ret;
}
public String getName() {
if (_jnIssue != null) {
StringBuilder sb = new StringBuilder(getId());
sb.append(" ");
String shortDesc = _jnIssue.getShortDescription();
sb.append(shortDesc.substring(0, 10));
if (shortDesc.length() > 10) {
sb.append("...");
}
return sb.toString();
} else {
return null;
}
}
public String getDisplayName() {
if (_jnIssue != null) {
return getId() + " " + _jnIssue.getShortDescription();
} else {
return null;
}
}
public String getDescription() {
if (_jnIssue != null) {
List<JNIssue.Description> descs =_jnIssue.getDescriptions();
StringBuilder sbDesc = new StringBuilder();
for (JNIssue.Description description : descs) {
sbDesc.append(description.getText());
sbDesc.append("\n");
}
return sbDesc.toString();
} else {
return null;
}
}
public String getSummary() {
if (_jnIssue != null) {
return _jnIssue.getShortDescription();
} else {
return null;
}
}
public String getSubComponent() {
if (_jnIssue != null) {
return _jnIssue.getSubComponent();
} else {
return null;
}
}
public String getVersion() {
if (_jnIssue != null) {
return _jnIssue.getVersion().toString();
}
return null;
}
public String getMilestone() {
if (_jnIssue != null) {
return _jnIssue.getTargetMilestone();
}
return null;
}
public String getIssueType() {
if (_jnIssue != null) {
return _jnIssue.getType().toString();
}
return null;
}
public String getPriority() {
if (_jnIssue != null) {
return _jnIssue.getPriority().toString();
}
return null;
}
public String getPlatform() {
if (_jnIssue != null) {
return _jnIssue._getPlatform();
}
return null;
}
public String getOpSystem() {
if (_jnIssue != null) {
return _jnIssue.getOpSystem();
}
return null;
}
public String getReporter() {
if (_jnIssue != null) {
return _jnIssue.getReporter().getName();
}
return null;
}
public JavanetTaskRepository getTaskRepository() {
return _repo;
}
public Lookup getLookup() {
return Lookups.fixed(this, _repo, _editorProvider, _notifier);
}
public boolean isCompleted() {
if (_jnIssue.getStatus().equals(IssueStatus.RESOLVED)
|| (_jnIssue.getStatus().equals(IssueStatus.CLOSED)
|| (_jnIssue.getStatus().equals(IssueStatus.VERIFIED)))) {
return true;
}
return false;
}
public Image getImage() {
Image image = TaskTypeBadge.getTaskImage();
//FIXME
if (_jnIssue != null) {
IssueType type = _jnIssue.getType();
switch (type) {
case DEFECT:
image = ImageUtilities.mergeImages(image, TaskTypeBadge.getBadge(TaskTypeBadge.DEFACT), 0, 0);
break;
case ENHANCEMENT:
image = ImageUtilities.mergeImages(image, TaskTypeBadge.getBadge(TaskTypeBadge.ENHANCEMENT), 0, 0);
break;
case FEATURE:
image = ImageUtilities.mergeImages(image, TaskTypeBadge.getBadge(TaskTypeBadge.FEATURE), 0, 0);
break;
case TASK:
image = ImageUtilities.mergeImages(image, TaskTypeBadge.getBadge(TaskTypeBadge.TASK), 0, 0);
break;
}
}
return image;
}
public URL getUrl() {
return null;
// if (_jnIssue != null) {
// return _jnIssue.getURL();
// } else {
// return null;
// }
}
public boolean isModified() {
return false;
}
public Calendar getCreationDate() {
return _jnIssue.getCreationDate();
}
public Calendar getLastModified() {
return _jnIssue.getLastModified();
}
public String getAssignedTo() {
return _jnIssue.getAssignedTo();
}
public String getStatus() {
return _jnIssue.getStatus().toString();
}
public String getComponent() {
return _jnIssue.getComponent();
}
public void synchronize() {
}
public Notifier<TaskElementChangeAdapter> getNotifier() {
return _notifier;
}
}
| {
"content_hash": "714a0c740801ff89a71cefa2069ddb68",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 120,
"avg_line_length": 26.493562231759658,
"alnum_prop": 0.5569415195204924,
"repo_name": "theanuradha/cubeon",
"id": "086fe731a8696ed668f61e83faf85898adc41f86",
"size": "6807",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "connectors/javanet/core/src/main/java/org/netbeans/cubeon/javanet/tasks/JavanetTask.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2006529"
}
],
"symlink_target": ""
} |
package com.Da_Technomancer.crossroads.client.TESR;
import com.Da_Technomancer.crossroads.API.Properties;
import com.Da_Technomancer.crossroads.Main;
import com.Da_Technomancer.crossroads.tileentities.technomancy.PrototypingTableTileEntity;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class PrototypingTableRenderer extends TileEntitySpecialRenderer<PrototypingTableTileEntity>{
private static final ResourceLocation TEXTURE = new ResourceLocation(Main.MODID, "textures/gui/field.png");
@Override
public void render(PrototypingTableTileEntity te, double x, double y, double z, float partialTicks, int destroyStage, float alpha){
if(te == null || !te.getWorld().isBlockLoaded(te.getPos(), false) || !te.visible){
return;
}
GlStateManager.pushMatrix();
GlStateManager.pushAttrib();
GlStateManager.enableBlend();
GlStateManager.disableLighting();
GlStateManager.disableCull();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1, 100F / 255F, 0, 0.25F);
float brightX = OpenGlHelper.lastBrightnessX;
float brightY = OpenGlHelper.lastBrightnessY;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
GlStateManager.translate(x + 0.5D, y + 0.5D, z + 0.5D);
GlStateManager.rotate(te.getWorld().getBlockState(te.getPos()).getValue(Properties.HORIZONTAL_FACING).getHorizontalAngle(), 0, 1, 0);
GlStateManager.translate(0.5D, 0.5D, 0.5D);
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
BufferBuilder vb = Tessellator.getInstance().getBuffer();
vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
vb.pos(-0.01D, -0.01D, 0).tex(0D, 0).endVertex();
vb.pos(16.01D, -0.01D, 0).tex(1, 0).endVertex();
vb.pos(16.01D, -0.01D, 16.01D).tex(1, 1).endVertex();
vb.pos(-0.01D, -0.01D, 16.01D).tex(0D, 1).endVertex();
vb.pos(-0.01D, 16.01D, 0).tex(0D, 0).endVertex();
vb.pos(16.01D, 16.01D, 0).tex(1, 0).endVertex();
vb.pos(16.01D, 16.01D, 16.01D).tex(1, 1).endVertex();
vb.pos(-0.01D, 16.01D, 16.01D).tex(0, 1).endVertex();
vb.pos(16.01D, -0.01D, 0).tex(0, 0).endVertex();
vb.pos(16.01D, 16.01D, 0).tex(1, 0).endVertex();
vb.pos(16.01D, 16.01D, 16.01D).tex(1, 1).endVertex();
vb.pos(16.01D, -0.01D, 16.01D).tex(0, 1).endVertex();
vb.pos(-0.01D, -0.01D, 0).tex(0, 0).endVertex();
vb.pos(-0.01D, 16.01D, 0).tex(1, 0).endVertex();
vb.pos(-0.01D, 16.01D, 16.01D).tex(1, 1).endVertex();
vb.pos(-0.01D, -0.01D, 16.01D).tex(0, 1).endVertex();
vb.pos(-0.01D, -0.01D, 0).tex(0, 0).endVertex();
vb.pos(16.01D, -0.01D, 0).tex(1, 0).endVertex();
vb.pos(16.01D, 16.01D, 0).tex(1, 1).endVertex();
vb.pos(-0.01D, 16.01D, 0).tex(0, 1).endVertex();
vb.pos(-0.01D, -0.01D, 16.01D).tex(0, 0).endVertex();
vb.pos(16.01D, -0.01D, 16.01D).tex(1, 0).endVertex();
vb.pos(16.01D, 16.01D, 16.01D).tex(1, 1).endVertex();
vb.pos(-0.01D, 16.01D, 16.01D).tex(0, 1).endVertex();
Tessellator.getInstance().draw();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX, brightY);
GlStateManager.color(1, 1, 1, 1);
GlStateManager.enableCull();
GlStateManager.enableLighting();
GlStateManager.disableBlend();
GlStateManager.popAttrib();
GlStateManager.popMatrix();
}
@Override
public boolean isGlobalRenderer(PrototypingTableTileEntity te){
return te.visible;
}
}
| {
"content_hash": "995b80f8756616f957472127e2150b15",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 135,
"avg_line_length": 42.333333333333336,
"alnum_prop": 0.7249343832020997,
"repo_name": "Da-Technomancer/Crossroads",
"id": "231ed9e4f672146729c067bfd87ae43d088fba16",
"size": "3810",
"binary": false,
"copies": "1",
"ref": "refs/heads/1.12-Schism",
"path": "src/main/java/com/Da_Technomancer/crossroads/client/TESR/PrototypingTableRenderer.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "2072999"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "f191677d3aee18371346b97d570bfee9",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "dad4de5e8f422d178725cfe4a48c033bae669177",
"size": "189",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Orchidaceae/Dendrophylax/Dendrophylax funalis/ Syn. Polyrrhiza funalis/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NPoco")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NPoco")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b94ddfd4-21fa-4a25-aae7-85f4a77ddab0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "71178200e60e4b4ff91e7356ed6959ed",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 38.416666666666664,
"alnum_prop": 0.7425885755603759,
"repo_name": "asterd/NPoco.iSeries",
"id": "9a592f846b9a94076770ef5d6764bf916dfd1d0c",
"size": "1386",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "NPoco/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "461509"
}
],
"symlink_target": ""
} |
<?php include "functions.php"; ?>
<?php include "includes/header.php";?>
<section class="content">
<aside class="col-xs-4">
<?php Navigation();?>
</aside><!--SIDEBAR-->
<article class="main-content col-xs-8">
<?php
/* Step 1: Use the Make a class called Dog
Step 2: Set some properties for Dog, Example, eye colors, nose, or fur color
Step 4: Make a method named ShowAll that echos all the properties
Step 5: Instantiate the class / create object and call it pitbull
Step 6: Call the method ShowAll
*/
class Dog {
public $eyeColor = "brown";
public $age = 1;
function showAll() {
echo $this->eyeColor . "<br>";
echo $this->age . "<br>";
}
}
$pitbull = new Dog();
$pitbull->showAll();
?>
</article><!--MAIN CONTENT-->
<?php include "includes/footer.php"; ?> | {
"content_hash": "3f4f159fd9ef4a42fca7de3c7581cbaa",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 78,
"avg_line_length": 18.555555555555557,
"alnum_prop": 0.615568862275449,
"repo_name": "wlabatey/PHP_Edwin_Diaz",
"id": "ae16e3a36eacc1e1cf2403b64b2a246ccb1ec17b",
"size": "835",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_practical-app/10.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "814"
},
{
"name": "JavaScript",
"bytes": "1317"
},
{
"name": "PHP",
"bytes": "52173"
}
],
"symlink_target": ""
} |
@interface ViewController : UIViewController <UIWebViewDelegate,NSURLConnectionDelegate>
@property (weak, nonatomic) IBOutlet UIWebView *webView;
@property (strong, nonatomic) NSURLConnection * connection;
@end
| {
"content_hash": "67aa231ab79fd7b0f791bca8f5fc8641",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 88,
"avg_line_length": 26.875,
"alnum_prop": 0.813953488372093,
"repo_name": "systems-powercom/appTemplate",
"id": "ead299d12eaa768d50a5705224284f3d8f7db902",
"size": "393",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "webViewTest/webViewTest/ViewController.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "9305"
},
{
"name": "Objective-C",
"bytes": "1017180"
},
{
"name": "Ruby",
"bytes": "65"
},
{
"name": "Shell",
"bytes": "15997"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<mvc:resources location="/css/" mapping="/css/**"/>
<mvc:resources location="/img/" mapping="/img/**"/>
<mvc:resources location="/js/" mapping="/js/**"/>
<mvc:annotation-driven/>
<mvc:view-controller path="/about" view-name="about"/>
<mvc:view-controller path="/home" view-name="home"/>
<mvc:interceptors>
<bean id="webContentInterceptor"
class="org.springframework.web.servlet.mvc.WebContentInterceptor">
<property name="cacheSeconds" value="0" />
<property name="useExpiresHeader" value="true" />
<property name="useCacheControlHeader" value="true" />
<property name="useCacheControlNoStore" value="true" />
<property name="cacheMappings">
<props>
<prop key="**/stocks">0</prop>
<prop key="**/users">0</prop>
<prop key="**/watchlists">0</prop>
</props>
</property>
</bean>
</mvc:interceptors>
<context:component-scan base-package="org.stockwatcher.web"/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
<property name="order" value="2"/>
</bean>
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver">
<property name="order" value="1"/>
</bean>
<bean name="watchList.rss" class="org.stockwatcher.web.rss.WatchListRssView">
<property name="feedGenerator" value="The $tockWatcher"/>
<property name="feedLink" value="http://www.stockwatcher.org"/>
<property name="itemAuthor" value="LearningPatterns"/>
</bean>
<bean name="mostWatched.rss" class="org.stockwatcher.web.rss.MostWatchedStocksRssView">
<property name="feedTitle" value="Most Watched Stocks"/>
<property name="feedDescription" value="The most watched stocks in $tockWatcher"/>
<property name="feedGenerator" value="The $tockWatcher"/>
<property name="feedLink" value="http://www.stockwatcher.org"/>
<property name="itemAuthor" value="LearningPatterns"/>
</bean>
</beans> | {
"content_hash": "0eca04ffe7589e965298bf427724292e",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 88,
"avg_line_length": 41.015151515151516,
"alnum_prop": 0.7114887329146656,
"repo_name": "tonypiazza/stockwatcher",
"id": "42e52ef60a8f92b5d1c12f1811028e930893791b",
"size": "2707",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/webapp/WEB-INF/webContext.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "141660"
}
],
"symlink_target": ""
} |
package sn.executor;
/**
* Created by Sumanth on 16/10/14.
*/
public class TickMsg {
}
| {
"content_hash": "a6fb1ed0c96cca9a443e229f590fbc3a",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 34,
"avg_line_length": 12.857142857142858,
"alnum_prop": 0.6555555555555556,
"repo_name": "sumanthn/executor",
"id": "f50571189326010bfc2ba5d8f566841208f6bc77",
"size": "90",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/sn/executor/TickMsg.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "69622"
}
],
"symlink_target": ""
} |
"""
Convert to and from Roman numerals.
This file is adapted from the roman package that is available on PyPI,
which has the following copyright/license information:
Copyright (c) 2001 Mark Pilgrim
This program is free software; you can redistribute it and/or modify
it under the terms of the Python 2.1.1 license, available at
https://www.python.org/download/releases/2.1.1/license/
"""
__all__ = [
"to_roman",
"from_roman",
"is_roman_numeral",
]
import numpy as np
import re
from numbers import Integral
from typing import Union
from plasmapy.utils.exceptions import InvalidRomanNumeralError, OutOfRangeError
# Define digit mapping
_romanNumeralMap = (
("M", 1000),
("CM", 900),
("D", 500),
("CD", 400),
("C", 100),
("XC", 90),
("L", 50),
("XL", 40),
("X", 10),
("IX", 9),
("V", 5),
("IV", 4),
("I", 1),
)
# Define pattern to detect valid Roman numerals
_romanNumeralPattern = re.compile(
"""
^ # beginning of string
M{0,4} # thousands - 0 to 4 M's
(CM|CD|D?C{0,3}) # hundreds - 900 (CM), 400 (CD), 0-300 (0 to 3 C's),
# or 500-800 (D, followed by 0 to 3 C's)
(XC|XL|L?X{0,3}) # tens - 90 (XC), 40 (XL), 0-30 (0 to 3 X's),
# or 50-80 (L, followed by 0 to 3 X's)
(IX|IV|V?I{0,3}) # ones - 9 (IX), 4 (IV), 0-3 (0 to 3 I's),
# or 5-8 (V, followed by 0 to 3 I's)
$ # end of string
""",
re.VERBOSE,
)
def to_roman(n: Union[Integral, np.integer]) -> str:
"""
Convert an integer to a Roman numeral.
Parameters
----------
n : `int` or `~numpy.integer`
The integer to be converted to a Roman numeral that must be
between 1 and 4999, inclusive.
Returns
-------
result : `str`
The number in Roman numeral notation.
Raises
------
`TypeError`
If the input is not an integer.
`~plasmapy.utils.exceptions.OutOfRangeError`
If the number is not between 1 and 4999, inclusive.
See Also
--------
from_roman
Examples
--------
>>> to_roman(5)
'V'
>>> to_roman(2525)
'MMDXXV'
"""
if not isinstance(n, (Integral, np.integer)):
raise TypeError(f"{n} cannot be converted to a Roman numeral.")
if not (0 < n < 5000):
raise OutOfRangeError("Number is out of range (need 0 < n < 5000)")
result = ""
for numeral, integer in _romanNumeralMap:
while n >= integer:
result += numeral
n -= integer
return result
def from_roman(s: str) -> Integral:
"""
Convert a Roman numeral to an integer.
Parameters
----------
s : `str`
A Roman numeral.
Returns
-------
result : `int`
The positive integer corresponding to the Roman numeral.
Raises
------
`TypeError`
The argument is not a `str`.
`~plasmapy.utils.exceptions.InvalidRomanNumeralError`
The argument is not a valid Roman numeral.
See Also
--------
to_roman
Examples
--------
>>> from_roman('V')
5
>>> from_roman('MMMMCCCLXVII')
4367
"""
if not isinstance(s, str):
raise TypeError("The argument to from_roman must be a string.")
if not _romanNumeralPattern.search(s):
raise InvalidRomanNumeralError(f"Invalid Roman numeral: {s}")
result = 0
index = 0
for numeral, integer in _romanNumeralMap:
while s[index : index + len(numeral)] == numeral:
result += integer
index += len(numeral)
return result
def is_roman_numeral(s: str) -> bool:
"""
Check whether or not a string is a valid Roman numeral.
Parameters
----------
s : `str`
The possible Roman numeral.
Returns
-------
result : `bool`
`True` if the `str` input is a valid Roman numeral, and `False`
if it is not.
Raises
------
`TypeError`
If the argument is not a `str`.
See Also
--------
to_roman
from_roman
Examples
--------
>>> is_roman_numeral("CXVII")
True
>>> is_roman_numeral("42")
False
"""
if not isinstance(s, str):
raise TypeError("Only strings may be tested ")
return bool(_romanNumeralPattern.match(s))
| {
"content_hash": "94bf59c39fecc9e6eb988169010abef3",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 79,
"avg_line_length": 22.803108808290155,
"alnum_prop": 0.5487389229720518,
"repo_name": "StanczakDominik/PlasmaPy",
"id": "75119c7b691008de56d6fd697beed8fe2d45af75",
"size": "4401",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "plasmapy/utils/roman.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Jupyter Notebook",
"bytes": "1285"
},
{
"name": "Python",
"bytes": "2148684"
}
],
"symlink_target": ""
} |
# Global vars and configs
SO:=$(shell uname -s | awk '{print tolower($$0)}')
AZK_VERSION:=$(shell cat package.json | grep -e "version" | cut -d' ' -f4 | sed -n 's/\"//p' | sed -n 's/\"//p' | sed -n 's/,//p')
AZK_ROOT_PATH:=$(shell pwd)
AZK_LIB_PATH:=${AZK_ROOT_PATH}/lib
AZK_NPM_PATH:=${AZK_ROOT_PATH}/node_modules
NVM_BIN_PATH:=${AZK_ROOT_PATH}/src/libexec/nvm.sh
export AZK_ENV:=development
AZK_BIN:=${AZK_ROOT_PATH}/bin/azk
# Load dependencies versions
include .dependencies
# default target
all: bootstrap
###### Bootstrap session ######
NVM_DIR := ${AZK_LIB_PATH}/nvm
NVM_NODE_VERSION := $(shell cat ${AZK_ROOT_PATH}/.nvmrc)
NODE = ${NVM_DIR}/${NVM_NODE_VERSION}/bin/node
VM_DISKS_DIR := ${AZK_LIB_PATH}/vm/${AZK_ISO_VERSION}
# Locking npm and clingwrap version
NPM_VERSION_FILE := ${NVM_DIR}/npm_version
CLINGWRAP_VERSION_FILE := ${NVM_DIR}/clingwrap_version
NCU_VERSION_FILE := ${NVM_DIR}/ncu_version
finished:
@echo "Finished!"
check_node_dependencies: ${NODE}
@echo "Checking node dependencies versions..."
@if [ ! "$$(${AZK_BIN} nvm npm --version)" = "${NPM_VERSION}" ] ; then \
rm -f ${NPM_VERSION_FILE}; \
fi
@if [ ! "$$(${AZK_BIN} nvm clingwrap --version)" = "${CLINGWRAP_VERSION}" ] ; then \
rm -f ${CLINGWRAP_VERSION_FILE}; \
fi
@if [ ! "$$(${AZK_BIN} nvm ncu --version)" = "${NCU_VERSION}" ] ; then \
rm -f ${NCU_VERSION_FILE}; \
fi
SRC_JS = $(shell cd ${AZK_ROOT_PATH} && find ./src -name '*.*' -print 2>/dev/null)
teste_envs:
@echo ${LIBNSS_RESOLVER_VERSION}
@echo ${AZK_ISO_VERSION}
${AZK_LIB_PATH}/azk: $(SRC_JS) ${NPM_VERSION_FILE} ${CLINGWRAP_VERSION_FILE} ${NCU_VERSION_FILE} ${AZK_NPM_PATH}/.install
@echo "task: $@"
@export AZK_LIB_PATH=${AZK_LIB_PATH} && \
export AZK_NPM_PATH=${AZK_NPM_PATH} && \
${AZK_BIN} nvm gulp babel && touch ${AZK_LIB_PATH}/azk
${AZK_NPM_PATH}/.install: npm-shrinkwrap.json package.json
@echo "task: $@"
@mkdir -p ${AZK_NPM_PATH}
@export AZK_LIB_PATH=${AZK_LIB_PATH} && \
${AZK_BIN} nvm npm install && \
touch ${AZK_NPM_PATH}/.install
${NPM_VERSION_FILE}:
@echo "task: install npm ${NPM_VERSION}"
@rm -Rf ${AZK_NPM_PATH}/*
@rm -Rf ${AZK_NPM_PATH}/.install
@touch package.json
@${AZK_BIN} nvm npm install npm@${NPM_VERSION} -g
@${AZK_BIN} nvm npm --version > ${NPM_VERSION_FILE}
${CLINGWRAP_VERSION_FILE}:
@echo "task: install clingwrap ${CLINGWRAP_VERSION}"
@${AZK_BIN} nvm npm install clingwrap@${CLINGWRAP_VERSION} -g
@${AZK_BIN} nvm clingwrap --version > ${CLINGWRAP_VERSION_FILE}
${NCU_VERSION_FILE}:
@echo "task: install npm-check-updates ${NCU_VERSION}"
@${AZK_BIN} nvm npm install npm-check-updates@${NCU_VERSION} -g
@${AZK_BIN} nvm ncu --version > ${NCU_VERSION_FILE}
${NODE}:
@echo "task: $@: ${NVM_NODE_VERSION}"
@export NVM_DIR=${NVM_DIR} && \
mkdir -p ${NVM_DIR} && \
. ${NVM_BIN_PATH} && \
nvm install $(NVM_NODE_VERSION)
clean:
@echo "task: $@"
@find ${AZK_LIB_PATH} -maxdepth 1 -not -name "lib" | egrep -v '\/vm$$' | xargs rm -Rf
@rm -Rf ${AZK_NPM_PATH}/..?* ${AZK_NPM_PATH}/.[!.]* ${AZK_NPM_PATH}/*
@rm -Rf ${NVM_DIR}/..?* ${NVM_DIR}/.[!.]* ${NVM_DIR}/*
bootstrap: check_node_dependencies ${AZK_LIB_PATH}/azk dependencies finished
dependencies: ${AZK_LIB_PATH}/bats ${VM_DISKS_DIR}/azk.iso ${VM_DISKS_DIR}/azk-agent.vmdk.gz
S3_URL=https://s3-sa-east-1.amazonaws.com/repo.azukiapp.com/vm_disks/${AZK_ISO_VERSION}
${VM_DISKS_DIR}/azk.iso:
@echo Downloading: ${S3_URL}/azk.iso ...
@mkdir -p ${VM_DISKS_DIR}
@curl ${S3_URL}/azk.iso -o ${VM_DISKS_DIR}/azk.iso
${VM_DISKS_DIR}/azk-agent.vmdk.gz:
@echo Downloading: ${S3_URL}/azk-agent.vmdk.gz ...
@curl ${S3_URL}/azk-agent.vmdk.gz -o ${VM_DISKS_DIR}/azk-agent.vmdk.gz
${AZK_LIB_PATH}/bats:
@git clone -b ${BATS_VERSION} https://github.com/sstephenson/bats ${AZK_LIB_PATH}/bats
fast_test: TEST_FAST=:fast
fast_test: test
@echo "task: $@"
test: bootstrap
@echo "task: $@"
${AZK_BIN} nvm npm run test${TEST_FAST} $(if $(filter undefined,$(origin TEST_GREP)),,-- --grep "${TEST_GREP}")
###### Package session ######
AZK_PACKAGE_PATH:=${AZK_ROOT_PATH}/package
AZK_PACKAGE_PREFIX:=${AZK_PACKAGE_PATH}/v${AZK_VERSION}
PATH_USR_LIB_AZK:=${AZK_PACKAGE_PREFIX}/usr/lib/azk
PATH_USR_BIN:=${AZK_PACKAGE_PREFIX}/usr/bin
PATH_NODE_MODULES:=${PATH_USR_LIB_AZK}/node_modules
PATH_AZK_LIB:=${PATH_USR_LIB_AZK}/lib
PATH_AZK_NVM:=${PATH_AZK_LIB}/nvm
NODE_PACKAGE = ${PATH_AZK_NVM}/${NVM_NODE_VERSION}/bin/node
PATH_MAC_PACKAGE:=${AZK_PACKAGE_PATH}/azk_${AZK_VERSION}.tar.gz
# Locking npm version
PACKAGE_NPM_VERSION_FILE := ${PATH_AZK_NVM}/npm_versions
package_check_node_dependencies: ${NODE_PACKAGE}
@if [ ! "$$(${AZK_BIN} nvm npm --version)" = "${NPM_VERSION}" ] ; then \
rm ${PACKAGE_NPM_VERSION_FILE}; \
fi
# Build package folders tree
package_brew: package_build fix_permissions check_version ${PATH_AZK_LIB}/vm/${AZK_ISO_VERSION} ${PATH_MAC_PACKAGE}
package_mac:
@export AZK_PACKAGE_PATH=${AZK_PACKAGE_PATH}/brew && \
mkdir -p $$AZK_PACKAGE_PATH && \
make -e package_brew
# Alias to create a distro package
LINUX_CLEAN:="--clean"
package_linux: package_build creating_symbolic_links fix_permissions check_version
package_deb:
@mkdir -p package
@./src/libexec/package.sh deb ${LINUX_CLEAN}
package_rpm:
@mkdir -p package
@./src/libexec/package.sh rpm ${LINUX_CLEAN}
package_clean:
@echo "task: $@"
@rm -Rf ${AZK_PACKAGE_PREFIX}/..?* ${AZK_PACKAGE_PREFIX}/.[!.]* ${AZK_PACKAGE_PREFIX}/*
check_version: NEW_AZK_VERSION=$(shell ${PATH_USR_LIB_AZK}/bin/azk version | sed -e 's/^azk //; s/^version //; s/,.*//' )
check_version:
@echo "task: $@"
@if [ ! "${AZK_VERSION}" = "${NEW_AZK_VERSION}" ] ; then \
echo 'Error to run: ${PATH_USR_LIB_AZK}/bin/azk version'; \
echo 'Expect: azk ${AZK_VERSION}'; \
echo 'Output: azk ${NEW_AZK_VERSION}'; \
exit 1; \
fi
${PATH_NODE_MODULES}: ${PACKAGE_NPM_VERSION_FILE} ${PATH_USR_LIB_AZK}/npm-shrinkwrap.json
@echo "task: $@"
@cd ${PATH_USR_LIB_AZK} && ${AZK_BIN} nvm npm install --production
${PATH_USR_LIB_AZK}/npm-shrinkwrap.json: ${PATH_USR_LIB_AZK}/package.json
@echo "task: $@"
@test -e ${PATH_NODE_MODULES} && rm -rf ${PATH_NODE_MODULES} || true
@ln -s ${AZK_NPM_PATH} ${PATH_NODE_MODULES}
@cd ${PATH_USR_LIB_AZK} && ${AZK_BIN} nvm npm shrinkwrap
@rm ${PATH_NODE_MODULES}
${PACKAGE_NPM_VERSION_FILE}:
@echo "task: $@"
@${AZK_BIN} nvm npm install npm@${NPM_VERSION} -g
@${AZK_BIN} nvm npm --version > ${PACKAGE_NPM_VERSION_FILE}
${NODE_PACKAGE}:
@echo "task: $@"
@export NVM_DIR=${PATH_AZK_NVM} && \
mkdir -p ${PATH_AZK_NVM} && \
. ${NVM_BIN_PATH} && \
nvm install $(NVM_NODE_VERSION)
define COPY_FILES
$(abspath $(2)/$(3)): $(abspath $(1)/$(3))
@echo "task: copy from $$< to $$@"
@mkdir -p $$(dir $$@)
@if [ -d "$$<" ]; then \
if [ -d "$$@" ]; then \
touch $$@; \
else \
mkdir -p $$@; \
fi \
fi
@[ -d $$< ] || cp -f $$< $$@
endef
# copy regular files
FILES_FILTER = package.json bin shared .nvmrc CHANGELOG.md LICENSE README.md .dependencies .package-envs
FILES_ALL = $(shell cd ${AZK_ROOT_PATH} && find $(FILES_FILTER) -print 2>/dev/null | grep -v shared/completions)
FILES_TARGETS = $(foreach file,$(addprefix $(PATH_USR_LIB_AZK)/, $(FILES_ALL)),$(abspath $(file)))
$(foreach file,$(FILES_ALL),$(eval $(call COPY_FILES,$(AZK_ROOT_PATH),$(PATH_USR_LIB_AZK),$(file))))
# Copy transpiled files
copy_transpiled_files:
@echo "task: $@"
@mkdir -p ${PATH_AZK_LIB}/azk
@cp -R $(AZK_LIB_PATH)/azk ${PATH_AZK_LIB}
fix_permissions:
@chmod 755 ${PATH_USR_LIB_AZK}/bin/*
creating_symbolic_links:
@echo "task: $@"
@mkdir -p ${PATH_USR_BIN}
@ln -sf ../lib/azk/bin/azk ${PATH_USR_BIN}/azk
@ln -sf ../lib/azk/bin/adocker ${PATH_USR_BIN}/adocker
${PATH_AZK_LIB}/vm/${AZK_ISO_VERSION}: ${AZK_LIB_PATH}/vm
@mkdir -p ${PATH_AZK_LIB}/vm/${AZK_ISO_VERSION}
@cp -r ${VM_DISKS_DIR} ${PATH_AZK_LIB}/vm
${PATH_MAC_PACKAGE}: ${AZK_PACKAGE_PREFIX}
@cd ${PATH_USR_LIB_AZK}/.. && tar -czf ${PATH_MAC_PACKAGE} ./
package_build: bootstrap $(FILES_TARGETS) copy_transpiled_files package_check_node_dependencies ${PATH_NODE_MODULES}
###### Shell completion session ######
AZK_SHARED_PATH=${AZK_ROOT_PATH}/shared
USAGE_FILE_PATH=${AZK_SHARED_PATH}/locales/usage-en-US.txt
COMPLETIONS_PATH=${AZK_SHARED_PATH}/completions
BASH_COMPLETION_FILE=${COMPLETIONS_PATH}/azk.sh
ZSH_COMPLETION_FILE=${COMPLETIONS_PATH}/_azk
DOCOPT_COMPLETION_VERSION=0.2.6
${BASH_COMPLETION_FILE} ${ZSH_COMPLETION_FILE}: ${USAGE_FILE_PATH}
@if ! which docopt-completion > /dev/null 2>&1; then \
echo "task: install/upgrade docopt-completion"; \
sudo pip install infi.docopt-completion==${DOCOPT_COMPLETION_VERSION}; \
fi
@echo "task: generate shell completion to bash"
@docopt-completion ${AZK_BIN} --manual-bash &>/dev/null
@mv -f azk.sh ${COMPLETIONS_PATH}
@echo "Completion file written to ${BASH_COMPLETION_FILE}"
@echo "task: generate shell completion to zsh"
@docopt-completion ${AZK_BIN} --manual-zsh &>/dev/null
@mv -f _azk ${COMPLETIONS_PATH}
@echo "Completion file written to ${ZSH_COMPLETION_FILE}"
generate_shell_completion: ${AZK_LIB_PATH}/azk ${BASH_COMPLETION_FILE} ${ZSH_COMPLETION_FILE}
ZSH_COMPLETION_PATHS=~/.oh-my-zsh/completions ~/.oh-my-zsh /usr/share/zsh/*/site-functions /usr/share/zsh/*/functions/Completion /usr/share/zsh/site-functions /usr/share/zsh/functions/Completion
BASH_COMPLETION_PATH=$(wildcard /etc/bash_completion.d)
ZSH_COMPLETION_PATH=$(word 1, $(wildcard $(ZSH_COMPLETION_PATHS)))
COMPLETIONS_FILES=
ifdef BASH_COMPLETION_PATH
COMPLETIONS_FILES+=${BASH_COMPLETION_PATH}/azk.sh
endif
ifdef ZSH_COMPLETION_PATH
COMPLETIONS_FILES+=${ZSH_COMPLETION_PATH}/_azk
endif
${BASH_COMPLETION_PATH}/azk.sh: ${BASH_COMPLETION_FILE}
@echo "task: $@"
@sudo cp -f ${COMPLETIONS_PATH}/azk.sh $(BASH_COMPLETION_PATH)/
@echo "Shell completion scripts installed in $(BASH_COMPLETION_PATH)/azk.sh"
${ZSH_COMPLETION_PATH}/_azk: ${ZSH_COMPLETION_FILE}
@echo "task: $@"
@if [ $(findstring $(wildcard ~/), ${ZSH_COMPLETION_PATH}) ]; then \
cp -f ${COMPLETIONS_PATH}/_azk $(ZSH_COMPLETION_PATH)/; \
else \
sudo cp -f ${COMPLETIONS_PATH}/_azk $(ZSH_COMPLETION_PATH)/; \
fi
@echo "Shell completion scripts installed in $(ZSH_COMPLETION_PATH)/_azk"
install_shell_completion: ${COMPLETIONS_FILES}
# Mark not a file tasks
.PHONY: bootstrap clean package_brew package_mac package_deb package_rpm package_build package_clean copy_transpiled_files fix_permissions creating_symbolic_links dependencies check_version fast_test test generate_shell_completion install_shell_completion
# Just for fast reference, use this for debug a variable
# $(info $(value VARIABLE_NAME))
| {
"content_hash": "58a46858deb59486c1d41090bdb1b706",
"timestamp": "",
"source": "github",
"line_count": 301,
"max_line_length": 255,
"avg_line_length": 35.14617940199336,
"alnum_prop": 0.6626335192362227,
"repo_name": "saitodisse/azk",
"id": "0bca2930f3fb79373455157bdba9cf28cb7a1ab6",
"size": "10579",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Makefile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "JavaScript",
"bytes": "698868"
},
{
"name": "Makefile",
"bytes": "9656"
},
{
"name": "Shell",
"bytes": "94917"
}
],
"symlink_target": ""
} |
#include "fcint.h"
#include "fcftint.h"
/* Objects MT-safe for readonly access. */
FcPattern *
FcPatternCreate (void)
{
FcPattern *p;
p = (FcPattern *) malloc (sizeof (FcPattern));
if (!p)
return 0;
p->num = 0;
p->size = 0;
p->elts_offset = FcPtrToOffset (p, NULL);
FcRefInit (&p->ref, 1);
return p;
}
void
FcValueDestroy (FcValue v)
{
switch ((int) v.type) {
case FcTypeString:
FcFree (v.u.s);
break;
case FcTypeMatrix:
FcMatrixFree ((FcMatrix *) v.u.m);
break;
case FcTypeCharSet:
FcCharSetDestroy ((FcCharSet *) v.u.c);
break;
case FcTypeLangSet:
FcLangSetDestroy ((FcLangSet *) v.u.l);
break;
default:
break;
}
}
FcValue
FcValueCanonicalize (const FcValue *v)
{
FcValue new;
switch ((int) v->type)
{
case FcTypeString:
new.u.s = FcValueString(v);
new.type = FcTypeString;
break;
case FcTypeCharSet:
new.u.c = FcValueCharSet(v);
new.type = FcTypeCharSet;
break;
case FcTypeLangSet:
new.u.l = FcValueLangSet(v);
new.type = FcTypeLangSet;
break;
default:
new = *v;
break;
}
return new;
}
FcValue
FcValueSave (FcValue v)
{
switch ((int) v.type) {
case FcTypeString:
v.u.s = FcStrdup (v.u.s);
if (!v.u.s)
v.type = FcTypeVoid;
break;
case FcTypeMatrix:
v.u.m = FcMatrixCopy (v.u.m);
if (!v.u.m)
v.type = FcTypeVoid;
break;
case FcTypeCharSet:
v.u.c = FcCharSetCopy ((FcCharSet *) v.u.c);
if (!v.u.c)
v.type = FcTypeVoid;
break;
case FcTypeLangSet:
v.u.l = FcLangSetCopy (v.u.l);
if (!v.u.l)
v.type = FcTypeVoid;
break;
default:
break;
}
return v;
}
FcValueListPtr
FcValueListCreate (void)
{
return calloc (1, sizeof (FcValueList));
}
void
FcValueListDestroy (FcValueListPtr l)
{
FcValueListPtr next;
for (; l; l = next)
{
switch ((int) l->value.type) {
case FcTypeString:
FcFree (l->value.u.s);
break;
case FcTypeMatrix:
FcMatrixFree ((FcMatrix *)l->value.u.m);
break;
case FcTypeCharSet:
FcCharSetDestroy
((FcCharSet *) (l->value.u.c));
break;
case FcTypeLangSet:
FcLangSetDestroy
((FcLangSet *) (l->value.u.l));
break;
default:
break;
}
next = FcValueListNext(l);
free(l);
}
}
FcValueListPtr
FcValueListPrepend (FcValueListPtr vallist,
FcValue value,
FcValueBinding binding)
{
FcValueListPtr new;
if (value.type == FcTypeVoid)
return vallist;
new = FcValueListCreate ();
if (!new)
return vallist;
new->value = FcValueSave (value);
new->binding = binding;
new->next = vallist;
return new;
}
FcValueListPtr
FcValueListAppend (FcValueListPtr vallist,
FcValue value,
FcValueBinding binding)
{
FcValueListPtr new, last;
if (value.type == FcTypeVoid)
return vallist;
new = FcValueListCreate ();
if (!new)
return vallist;
new->value = FcValueSave (value);
new->binding = binding;
new->next = NULL;
if (vallist)
{
for (last = vallist; FcValueListNext (last); last = FcValueListNext (last));
last->next = new;
}
else
vallist = new;
return vallist;
}
FcValueListPtr
FcValueListDuplicate(FcValueListPtr orig)
{
FcValueListPtr new = NULL, l, t = NULL;
FcValue v;
for (l = orig; l != NULL; l = FcValueListNext (l))
{
if (!new)
{
t = new = FcValueListCreate();
}
else
{
t->next = FcValueListCreate();
t = FcValueListNext (t);
}
v = FcValueCanonicalize (&l->value);
t->value = FcValueSave (v);
t->binding = l->binding;
t->next = NULL;
}
return new;
}
FcBool
FcValueEqual (FcValue va, FcValue vb)
{
if (va.type != vb.type)
{
if (va.type == FcTypeInteger)
{
va.type = FcTypeDouble;
va.u.d = va.u.i;
}
if (vb.type == FcTypeInteger)
{
vb.type = FcTypeDouble;
vb.u.d = vb.u.i;
}
if (va.type != vb.type)
return FcFalse;
}
switch (va.type) {
case FcTypeUnknown:
return FcFalse; /* don't know how to compare this object */
case FcTypeVoid:
return FcTrue;
case FcTypeInteger:
return va.u.i == vb.u.i;
case FcTypeDouble:
return va.u.d == vb.u.d;
case FcTypeString:
return FcStrCmpIgnoreCase (va.u.s, vb.u.s) == 0;
case FcTypeBool:
return va.u.b == vb.u.b;
case FcTypeMatrix:
return FcMatrixEqual (va.u.m, vb.u.m);
case FcTypeCharSet:
return FcCharSetEqual (va.u.c, vb.u.c);
case FcTypeFTFace:
return va.u.f == vb.u.f;
case FcTypeLangSet:
return FcLangSetEqual (va.u.l, vb.u.l);
}
return FcFalse;
}
static FcChar32
FcDoubleHash (double d)
{
if (d < 0)
d = -d;
if (d > 0xffffffff)
d = 0xffffffff;
return (FcChar32) d;
}
FcChar32
FcStringHash (const FcChar8 *s)
{
FcChar8 c;
FcChar32 h = 0;
if (s)
while ((c = *s++))
h = ((h << 1) | (h >> 31)) ^ c;
return h;
}
static FcChar32
FcValueHash (const FcValue *v)
{
switch (v->type) {
case FcTypeUnknown:
case FcTypeVoid:
return 0;
case FcTypeInteger:
return (FcChar32) v->u.i;
case FcTypeDouble:
return FcDoubleHash (v->u.d);
case FcTypeString:
return FcStringHash (FcValueString(v));
case FcTypeBool:
return (FcChar32) v->u.b;
case FcTypeMatrix:
return (FcDoubleHash (v->u.m->xx) ^
FcDoubleHash (v->u.m->xy) ^
FcDoubleHash (v->u.m->yx) ^
FcDoubleHash (v->u.m->yy));
case FcTypeCharSet:
return (FcChar32) FcValueCharSet(v)->num;
case FcTypeFTFace:
return FcStringHash ((const FcChar8 *) ((FT_Face) v->u.f)->family_name) ^
FcStringHash ((const FcChar8 *) ((FT_Face) v->u.f)->style_name);
case FcTypeLangSet:
return FcLangSetHash (FcValueLangSet(v));
}
return 0;
}
static FcBool
FcValueListEqual (FcValueListPtr la, FcValueListPtr lb)
{
if (la == lb)
return FcTrue;
while (la && lb)
{
if (!FcValueEqual (la->value, lb->value))
return FcFalse;
la = FcValueListNext(la);
lb = FcValueListNext(lb);
}
if (la || lb)
return FcFalse;
return FcTrue;
}
static FcChar32
FcValueListHash (FcValueListPtr l)
{
FcChar32 hash = 0;
for (; l; l = FcValueListNext(l))
{
hash = ((hash << 1) | (hash >> 31)) ^ FcValueHash (&l->value);
}
return hash;
}
void
FcPatternDestroy (FcPattern *p)
{
int i;
FcPatternElt *elts;
if (!p)
return;
if (FcRefIsConst (&p->ref))
{
FcCacheObjectDereference (p);
return;
}
if (FcRefDec (&p->ref) != 1)
return;
elts = FcPatternElts (p);
for (i = 0; i < p->num; i++)
FcValueListDestroy (FcPatternEltValues(&elts[i]));
free (elts);
free (p);
}
static int
FcPatternObjectPosition (const FcPattern *p, FcObject object)
{
int low, high, mid, c;
FcPatternElt *elts = FcPatternElts(p);
low = 0;
high = p->num - 1;
c = 1;
mid = 0;
while (low <= high)
{
mid = (low + high) >> 1;
c = elts[mid].object - object;
if (c == 0)
return mid;
if (c < 0)
low = mid + 1;
else
high = mid - 1;
}
if (c < 0)
mid++;
return -(mid + 1);
}
FcPatternElt *
FcPatternObjectFindElt (const FcPattern *p, FcObject object)
{
int i = FcPatternObjectPosition (p, object);
if (i < 0)
return 0;
return &FcPatternElts(p)[i];
}
FcPatternElt *
FcPatternObjectInsertElt (FcPattern *p, FcObject object)
{
int i;
FcPatternElt *e;
i = FcPatternObjectPosition (p, object);
if (i < 0)
{
i = -i - 1;
/* reallocate array */
if (p->num + 1 >= p->size)
{
int s = p->size + 16;
if (p->size)
{
FcPatternElt *e0 = FcPatternElts(p);
e = (FcPatternElt *) realloc (e0, s * sizeof (FcPatternElt));
if (!e) /* maybe it was mmapped */
{
e = malloc(s * sizeof (FcPatternElt));
if (e)
memcpy(e, e0, p->num * sizeof (FcPatternElt));
}
}
else
e = (FcPatternElt *) malloc (s * sizeof (FcPatternElt));
if (!e)
return FcFalse;
p->elts_offset = FcPtrToOffset (p, e);
while (p->size < s)
{
e[p->size].object = 0;
e[p->size].values = NULL;
p->size++;
}
}
e = FcPatternElts(p);
/* move elts up */
memmove (e + i + 1,
e + i,
sizeof (FcPatternElt) *
(p->num - i));
/* bump count */
p->num++;
e[i].object = object;
e[i].values = NULL;
}
return FcPatternElts(p) + i;
}
FcBool
FcPatternEqual (const FcPattern *pa, const FcPattern *pb)
{
int i;
FcPatternElt *pae, *pbe;
if (pa == pb)
return FcTrue;
if (pa->num != pb->num)
return FcFalse;
pae = FcPatternElts(pa);
pbe = FcPatternElts(pb);
for (i = 0; i < pa->num; i++)
{
if (pae[i].object != pbe[i].object)
return FcFalse;
if (!FcValueListEqual (FcPatternEltValues(&pae[i]),
FcPatternEltValues(&pbe[i])))
return FcFalse;
}
return FcTrue;
}
FcChar32
FcPatternHash (const FcPattern *p)
{
int i;
FcChar32 h = 0;
FcPatternElt *pe = FcPatternElts(p);
for (i = 0; i < p->num; i++)
{
h = (((h << 1) | (h >> 31)) ^
pe[i].object ^
FcValueListHash (FcPatternEltValues(&pe[i])));
}
return h;
}
FcBool
FcPatternEqualSubset (const FcPattern *pai, const FcPattern *pbi, const FcObjectSet *os)
{
FcPatternElt *ea, *eb;
int i;
for (i = 0; i < os->nobject; i++)
{
FcObject object = FcObjectFromName (os->objects[i]);
ea = FcPatternObjectFindElt (pai, object);
eb = FcPatternObjectFindElt (pbi, object);
if (ea)
{
if (!eb)
return FcFalse;
if (!FcValueListEqual (FcPatternEltValues(ea), FcPatternEltValues(eb)))
return FcFalse;
}
else
{
if (eb)
return FcFalse;
}
}
return FcTrue;
}
FcBool
FcPatternObjectListAdd (FcPattern *p,
FcObject object,
FcValueListPtr list,
FcBool append)
{
FcPatternElt *e;
FcValueListPtr l, *prev;
if (FcRefIsConst (&p->ref))
goto bail0;
/*
* Make sure the stored type is valid for built-in objects
*/
for (l = list; l != NULL; l = FcValueListNext (l))
{
if (!FcObjectValidType (object, l->value.type))
{
fprintf (stderr,
"Fontconfig warning: FcPattern object %s does not accept value", FcObjectName (object));
FcValuePrintFile (stderr, l->value);
fprintf (stderr, "\n");
goto bail0;
}
}
e = FcPatternObjectInsertElt (p, object);
if (!e)
goto bail0;
if (append)
{
for (prev = &e->values; *prev; prev = &(*prev)->next)
;
*prev = list;
}
else
{
for (prev = &list; *prev; prev = &(*prev)->next)
;
*prev = e->values;
e->values = list;
}
return FcTrue;
bail0:
return FcFalse;
}
FcBool
FcPatternObjectAddWithBinding (FcPattern *p,
FcObject object,
FcValue value,
FcValueBinding binding,
FcBool append)
{
FcPatternElt *e;
FcValueListPtr new, *prev;
if (FcRefIsConst (&p->ref))
goto bail0;
new = FcValueListCreate ();
if (!new)
goto bail0;
value = FcValueSave (value);
if (value.type == FcTypeVoid)
goto bail1;
/*
* Make sure the stored type is valid for built-in objects
*/
if (!FcObjectValidType (object, value.type))
{
fprintf (stderr,
"Fontconfig warning: FcPattern object %s does not accept value",
FcObjectName (object));
FcValuePrintFile (stderr, value);
fprintf (stderr, "\n");
goto bail1;
}
new->value = value;
new->binding = binding;
new->next = NULL;
e = FcPatternObjectInsertElt (p, object);
if (!e)
goto bail2;
if (append)
{
for (prev = &e->values; *prev; prev = &(*prev)->next)
;
*prev = new;
}
else
{
new->next = e->values;
e->values = new;
}
return FcTrue;
bail2:
FcValueDestroy (value);
bail1:
free (new);
bail0:
return FcFalse;
}
FcBool
FcPatternObjectAdd (FcPattern *p, FcObject object, FcValue value, FcBool append)
{
return FcPatternObjectAddWithBinding (p, object,
value, FcValueBindingStrong, append);
}
FcBool
FcPatternAdd (FcPattern *p, const char *object, FcValue value, FcBool append)
{
return FcPatternObjectAddWithBinding (p, FcObjectFromName (object),
value, FcValueBindingStrong, append);
}
FcBool
FcPatternAddWeak (FcPattern *p, const char *object, FcValue value, FcBool append)
{
return FcPatternObjectAddWithBinding (p, FcObjectFromName (object),
value, FcValueBindingWeak, append);
}
FcBool
FcPatternObjectDel (FcPattern *p, FcObject object)
{
FcPatternElt *e;
e = FcPatternObjectFindElt (p, object);
if (!e)
return FcFalse;
/* destroy value */
FcValueListDestroy (e->values);
/* shuffle existing ones down */
memmove (e, e+1,
(FcPatternElts(p) + p->num - (e + 1)) *
sizeof (FcPatternElt));
p->num--;
e = FcPatternElts(p) + p->num;
e->object = 0;
e->values = NULL;
return FcTrue;
}
FcBool
FcPatternDel (FcPattern *p, const char *object)
{
return FcPatternObjectDel (p, FcObjectFromName (object));
}
FcBool
FcPatternRemove (FcPattern *p, const char *object, int id)
{
FcPatternElt *e;
FcValueListPtr *prev, l;
e = FcPatternObjectFindElt (p, FcObjectFromName (object));
if (!e)
return FcFalse;
for (prev = &e->values; (l = *prev); prev = &l->next)
{
if (!id)
{
*prev = l->next;
l->next = NULL;
FcValueListDestroy (l);
if (!e->values)
FcPatternDel (p, object);
return FcTrue;
}
id--;
}
return FcFalse;
}
FcBool
FcPatternObjectAddInteger (FcPattern *p, FcObject object, int i)
{
FcValue v;
v.type = FcTypeInteger;
v.u.i = i;
return FcPatternObjectAdd (p, object, v, FcTrue);
}
FcBool
FcPatternAddInteger (FcPattern *p, const char *object, int i)
{
return FcPatternObjectAddInteger (p, FcObjectFromName (object), i);
}
FcBool
FcPatternObjectAddDouble (FcPattern *p, FcObject object, double d)
{
FcValue v;
v.type = FcTypeDouble;
v.u.d = d;
return FcPatternObjectAdd (p, object, v, FcTrue);
}
FcBool
FcPatternAddDouble (FcPattern *p, const char *object, double d)
{
return FcPatternObjectAddDouble (p, FcObjectFromName (object), d);
}
FcBool
FcPatternObjectAddString (FcPattern *p, FcObject object, const FcChar8 *s)
{
FcValue v;
if (!s)
{
v.type = FcTypeVoid;
v.u.s = 0;
return FcPatternObjectAdd (p, object, v, FcTrue);
}
v.type = FcTypeString;
v.u.s = s;
return FcPatternObjectAdd (p, object, v, FcTrue);
}
FcBool
FcPatternAddString (FcPattern *p, const char *object, const FcChar8 *s)
{
return FcPatternObjectAddString (p, FcObjectFromName (object), s);
}
FcBool
FcPatternAddMatrix (FcPattern *p, const char *object, const FcMatrix *s)
{
FcValue v;
v.type = FcTypeMatrix;
v.u.m = s;
return FcPatternAdd (p, object, v, FcTrue);
}
FcBool
FcPatternObjectAddBool (FcPattern *p, FcObject object, FcBool b)
{
FcValue v;
v.type = FcTypeBool;
v.u.b = b;
return FcPatternObjectAdd (p, object, v, FcTrue);
}
FcBool
FcPatternAddBool (FcPattern *p, const char *object, FcBool b)
{
return FcPatternObjectAddBool (p, FcObjectFromName (object), b);
}
FcBool
FcPatternAddCharSet (FcPattern *p, const char *object, const FcCharSet *c)
{
FcValue v;
v.type = FcTypeCharSet;
v.u.c = (FcCharSet *)c;
return FcPatternAdd (p, object, v, FcTrue);
}
FcBool
FcPatternAddFTFace (FcPattern *p, const char *object, const FT_Face f)
{
FcValue v;
v.type = FcTypeFTFace;
v.u.f = (void *) f;
return FcPatternAdd (p, object, v, FcTrue);
}
FcBool
FcPatternAddLangSet (FcPattern *p, const char *object, const FcLangSet *ls)
{
FcValue v;
v.type = FcTypeLangSet;
v.u.l = (FcLangSet *)ls;
return FcPatternAdd (p, object, v, FcTrue);
}
FcResult
FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v)
{
FcPatternElt *e;
FcValueListPtr l;
if (!p)
return FcResultNoMatch;
e = FcPatternObjectFindElt (p, object);
if (!e)
return FcResultNoMatch;
for (l = FcPatternEltValues(e); l; l = FcValueListNext(l))
{
if (!id)
{
*v = FcValueCanonicalize(&l->value);
return FcResultMatch;
}
id--;
}
return FcResultNoId;
}
FcResult
FcPatternGet (const FcPattern *p, const char *object, int id, FcValue *v)
{
return FcPatternObjectGet (p, FcObjectFromName (object), id, v);
}
FcResult
FcPatternObjectGetInteger (const FcPattern *p, FcObject object, int id, int *i)
{
FcValue v;
FcResult r;
r = FcPatternObjectGet (p, object, id, &v);
if (r != FcResultMatch)
return r;
switch ((int) v.type) {
case FcTypeDouble:
*i = (int) v.u.d;
break;
case FcTypeInteger:
*i = v.u.i;
break;
default:
return FcResultTypeMismatch;
}
return FcResultMatch;
}
FcResult
FcPatternGetInteger (const FcPattern *p, const char *object, int id, int *i)
{
return FcPatternObjectGetInteger (p, FcObjectFromName (object), id, i);
}
FcResult
FcPatternObjectGetDouble (const FcPattern *p, FcObject object, int id, double *d)
{
FcValue v;
FcResult r;
r = FcPatternObjectGet (p, object, id, &v);
if (r != FcResultMatch)
return r;
switch ((int) v.type) {
case FcTypeDouble:
*d = v.u.d;
break;
case FcTypeInteger:
*d = (double) v.u.i;
break;
default:
return FcResultTypeMismatch;
}
return FcResultMatch;
}
FcResult
FcPatternGetDouble (const FcPattern *p, const char *object, int id, double *d)
{
return FcPatternObjectGetDouble (p, FcObjectFromName (object), id, d);
}
FcResult
FcPatternObjectGetString (const FcPattern *p, FcObject object, int id, FcChar8 ** s)
{
FcValue v;
FcResult r;
r = FcPatternObjectGet (p, object, id, &v);
if (r != FcResultMatch)
return r;
if (v.type != FcTypeString)
return FcResultTypeMismatch;
*s = (FcChar8 *) v.u.s;
return FcResultMatch;
}
FcResult
FcPatternGetString (const FcPattern *p, const char *object, int id, FcChar8 ** s)
{
return FcPatternObjectGetString (p, FcObjectFromName (object), id, s);
}
FcResult
FcPatternGetMatrix(const FcPattern *p, const char *object, int id, FcMatrix **m)
{
FcValue v;
FcResult r;
r = FcPatternGet (p, object, id, &v);
if (r != FcResultMatch)
return r;
if (v.type != FcTypeMatrix)
return FcResultTypeMismatch;
*m = (FcMatrix *)v.u.m;
return FcResultMatch;
}
FcResult
FcPatternGetBool(const FcPattern *p, const char *object, int id, FcBool *b)
{
FcValue v;
FcResult r;
r = FcPatternGet (p, object, id, &v);
if (r != FcResultMatch)
return r;
if (v.type != FcTypeBool)
return FcResultTypeMismatch;
*b = v.u.b;
return FcResultMatch;
}
FcResult
FcPatternGetCharSet(const FcPattern *p, const char *object, int id, FcCharSet **c)
{
FcValue v;
FcResult r;
r = FcPatternGet (p, object, id, &v);
if (r != FcResultMatch)
return r;
if (v.type != FcTypeCharSet)
return FcResultTypeMismatch;
*c = (FcCharSet *)v.u.c;
return FcResultMatch;
}
FcResult
FcPatternGetFTFace(const FcPattern *p, const char *object, int id, FT_Face *f)
{
FcValue v;
FcResult r;
r = FcPatternGet (p, object, id, &v);
if (r != FcResultMatch)
return r;
if (v.type != FcTypeFTFace)
return FcResultTypeMismatch;
*f = (FT_Face) v.u.f;
return FcResultMatch;
}
FcResult
FcPatternGetLangSet(const FcPattern *p, const char *object, int id, FcLangSet **ls)
{
FcValue v;
FcResult r;
r = FcPatternGet (p, object, id, &v);
if (r != FcResultMatch)
return r;
if (v.type != FcTypeLangSet)
return FcResultTypeMismatch;
*ls = (FcLangSet *)v.u.l;
return FcResultMatch;
}
FcPattern *
FcPatternDuplicate (const FcPattern *orig)
{
FcPattern *new;
FcPatternElt *e;
int i;
FcValueListPtr l;
new = FcPatternCreate ();
if (!new)
goto bail0;
e = FcPatternElts(orig);
for (i = 0; i < orig->num; i++)
{
for (l = FcPatternEltValues(e + i); l; l = FcValueListNext(l))
{
if (!FcPatternObjectAddWithBinding (new, e[i].object,
FcValueCanonicalize(&l->value),
l->binding,
FcTrue))
goto bail1;
}
}
return new;
bail1:
FcPatternDestroy (new);
bail0:
return 0;
}
void
FcPatternReference (FcPattern *p)
{
if (!FcRefIsConst (&p->ref))
FcRefInc (&p->ref);
else
FcCacheObjectReference (p);
}
FcPattern *
FcPatternVaBuild (FcPattern *p, va_list va)
{
FcPattern *ret;
FcPatternVapBuild (ret, p, va);
return ret;
}
FcPattern *
FcPatternBuild (FcPattern *p, ...)
{
va_list va;
va_start (va, p);
FcPatternVapBuild (p, p, va);
va_end (va);
return p;
}
/*
* Add all of the elements in 's' to 'p'
*/
FcBool
FcPatternAppend (FcPattern *p, FcPattern *s)
{
int i;
FcPatternElt *e;
FcValueListPtr v;
for (i = 0; i < s->num; i++)
{
e = FcPatternElts(s)+i;
for (v = FcPatternEltValues(e); v; v = FcValueListNext(v))
{
if (!FcPatternObjectAddWithBinding (p, e->object,
FcValueCanonicalize(&v->value),
v->binding, FcTrue))
return FcFalse;
}
}
return FcTrue;
}
FcPattern *
FcPatternFilter (FcPattern *p, const FcObjectSet *os)
{
int i;
FcPattern *ret;
FcPatternElt *e;
FcValueListPtr v;
if (!os)
return FcPatternDuplicate (p);
ret = FcPatternCreate ();
if (!ret)
return NULL;
for (i = 0; i < os->nobject; i++)
{
FcObject object = FcObjectFromName (os->objects[i]);
e = FcPatternObjectFindElt (p, object);
if (e)
{
for (v = FcPatternEltValues(e); v; v = FcValueListNext(v))
{
if (!FcPatternObjectAddWithBinding (ret, e->object,
FcValueCanonicalize(&v->value),
v->binding, FcTrue))
goto bail0;
}
}
}
return ret;
bail0:
FcPatternDestroy (ret);
return NULL;
}
FcBool
FcPatternSerializeAlloc (FcSerialize *serialize, const FcPattern *pat)
{
int i;
FcPatternElt *elts = FcPatternElts(pat);
if (!FcSerializeAlloc (serialize, pat, sizeof (FcPattern)))
return FcFalse;
if (!FcSerializeAlloc (serialize, elts, pat->num * sizeof (FcPatternElt)))
return FcFalse;
for (i = 0; i < pat->num; i++)
if (!FcValueListSerializeAlloc (serialize, FcPatternEltValues(elts+i)))
return FcFalse;
return FcTrue;
}
FcPattern *
FcPatternSerialize (FcSerialize *serialize, const FcPattern *pat)
{
FcPattern *pat_serialized;
FcPatternElt *elts = FcPatternElts (pat);
FcPatternElt *elts_serialized;
FcValueList *values_serialized;
int i;
pat_serialized = FcSerializePtr (serialize, pat);
if (!pat_serialized)
return NULL;
*pat_serialized = *pat;
pat_serialized->size = pat->num;
FcRefSetConst (&pat_serialized->ref);
elts_serialized = FcSerializePtr (serialize, elts);
if (!elts_serialized)
return NULL;
pat_serialized->elts_offset = FcPtrToOffset (pat_serialized,
elts_serialized);
for (i = 0; i < pat->num; i++)
{
values_serialized = FcValueListSerialize (serialize, FcPatternEltValues (elts+i));
if (!values_serialized)
return NULL;
elts_serialized[i].object = elts[i].object;
elts_serialized[i].values = FcPtrToEncodedOffset (&elts_serialized[i],
values_serialized,
FcValueList);
}
if (FcDebug() & FC_DBG_CACHEV) {
printf ("Raw pattern:\n");
FcPatternPrint (pat);
printf ("Serialized pattern:\n");
FcPatternPrint (pat_serialized);
printf ("\n");
}
return pat_serialized;
}
FcBool
FcValueListSerializeAlloc (FcSerialize *serialize, const FcValueList *vl)
{
while (vl)
{
if (!FcSerializeAlloc (serialize, vl, sizeof (FcValueList)))
return FcFalse;
switch ((int) vl->value.type) {
case FcTypeString:
if (!FcStrSerializeAlloc (serialize, vl->value.u.s))
return FcFalse;
break;
case FcTypeCharSet:
if (!FcCharSetSerializeAlloc (serialize, vl->value.u.c))
return FcFalse;
break;
case FcTypeLangSet:
if (!FcLangSetSerializeAlloc (serialize, vl->value.u.l))
return FcFalse;
break;
default:
break;
}
vl = vl->next;
}
return FcTrue;
}
FcValueList *
FcValueListSerialize (FcSerialize *serialize, const FcValueList *vl)
{
FcValueList *vl_serialized;
FcChar8 *s_serialized;
FcCharSet *c_serialized;
FcLangSet *l_serialized;
FcValueList *head_serialized = NULL;
FcValueList *prev_serialized = NULL;
while (vl)
{
vl_serialized = FcSerializePtr (serialize, vl);
if (!vl_serialized)
return NULL;
if (prev_serialized)
prev_serialized->next = FcPtrToEncodedOffset (prev_serialized,
vl_serialized,
FcValueList);
else
head_serialized = vl_serialized;
vl_serialized->next = NULL;
vl_serialized->value.type = vl->value.type;
switch ((int) vl->value.type) {
case FcTypeInteger:
vl_serialized->value.u.i = vl->value.u.i;
break;
case FcTypeDouble:
vl_serialized->value.u.d = vl->value.u.d;
break;
case FcTypeString:
s_serialized = FcStrSerialize (serialize, vl->value.u.s);
if (!s_serialized)
return NULL;
vl_serialized->value.u.s = FcPtrToEncodedOffset (&vl_serialized->value,
s_serialized,
FcChar8);
break;
case FcTypeBool:
vl_serialized->value.u.b = vl->value.u.b;
break;
case FcTypeMatrix:
/* can't happen */
break;
case FcTypeCharSet:
c_serialized = FcCharSetSerialize (serialize, vl->value.u.c);
if (!c_serialized)
return NULL;
vl_serialized->value.u.c = FcPtrToEncodedOffset (&vl_serialized->value,
c_serialized,
FcCharSet);
break;
case FcTypeFTFace:
/* can't happen */
break;
case FcTypeLangSet:
l_serialized = FcLangSetSerialize (serialize, vl->value.u.l);
if (!l_serialized)
return NULL;
vl_serialized->value.u.l = FcPtrToEncodedOffset (&vl_serialized->value,
l_serialized,
FcLangSet);
break;
default:
break;
}
prev_serialized = vl_serialized;
vl = vl->next;
}
return head_serialized;
}
#define __fcpat__
#include "fcaliastail.h"
#include "fcftaliastail.h"
#undef __fcpat__
| {
"content_hash": "bd1e99fe97286e7ca71baa694caa43cd",
"timestamp": "",
"source": "github",
"line_count": 1296,
"max_line_length": 95,
"avg_line_length": 20.099537037037038,
"alnum_prop": 0.6233252716035165,
"repo_name": "guorendong/iridium-browser-ubuntu",
"id": "0614ac2c239ba69247cc65eb2f54b8ad9e70eaca",
"size": "27205",
"binary": false,
"copies": "4",
"ref": "refs/heads/ubuntu/precise",
"path": "third_party/fontconfig/src/src/fcpat.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "AppleScript",
"bytes": "8402"
},
{
"name": "Assembly",
"bytes": "256197"
},
{
"name": "Batchfile",
"bytes": "34966"
},
{
"name": "C",
"bytes": "15445429"
},
{
"name": "C++",
"bytes": "276628399"
},
{
"name": "CMake",
"bytes": "27829"
},
{
"name": "CSS",
"bytes": "867238"
},
{
"name": "Emacs Lisp",
"bytes": "3348"
},
{
"name": "Go",
"bytes": "13628"
},
{
"name": "Groff",
"bytes": "7777"
},
{
"name": "HTML",
"bytes": "20250399"
},
{
"name": "Java",
"bytes": "9950308"
},
{
"name": "JavaScript",
"bytes": "13873772"
},
{
"name": "LLVM",
"bytes": "1169"
},
{
"name": "Logos",
"bytes": "6893"
},
{
"name": "Lua",
"bytes": "16189"
},
{
"name": "Makefile",
"bytes": "179129"
},
{
"name": "Objective-C",
"bytes": "1871766"
},
{
"name": "Objective-C++",
"bytes": "9674498"
},
{
"name": "PHP",
"bytes": "42038"
},
{
"name": "PLpgSQL",
"bytes": "163248"
},
{
"name": "Perl",
"bytes": "63937"
},
{
"name": "Protocol Buffer",
"bytes": "474121"
},
{
"name": "Python",
"bytes": "11646662"
},
{
"name": "Ragel in Ruby Host",
"bytes": "104923"
},
{
"name": "Scheme",
"bytes": "10604"
},
{
"name": "Shell",
"bytes": "1151673"
},
{
"name": "Standard ML",
"bytes": "5034"
},
{
"name": "VimL",
"bytes": "4075"
},
{
"name": "nesC",
"bytes": "18347"
}
],
"symlink_target": ""
} |
package com.bazaarvoice.emodb.web.ddl;
import com.google.common.base.Throwables;
import com.google.common.net.HostAndPort;
import org.apache.cassandra.thrift.Cassandra;
import org.apache.cassandra.thrift.Compression;
import org.apache.cassandra.thrift.ConsistencyLevel;
import org.apache.cassandra.thrift.KsDef;
import org.apache.commons.lang.StringUtils;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TSocket;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.io.Closeable;
import java.nio.ByteBuffer;
final class CassandraThriftFacade implements Closeable {
private static final Logger _log = LoggerFactory.getLogger(CassandraThriftFacade.class);
/** Note: <code>seeds</code> may be a single host or comma-delimited list. */
public static CassandraThriftFacade forSeedsAndPort(String seeds, int defaultPort) {
final String seed = seeds.contains(",") ? seeds.substring(0, seeds.indexOf(',')) : seeds;
HostAndPort host = HostAndPort.fromString(seed).withDefaultPort(defaultPort);
return new CassandraThriftFacade(new TFramedTransport(new TSocket(host.getHostText(), host.getPort())));
}
private static final String CQL_VERSION = "3.0.0";
private final TFramedTransport _transport;
private final Cassandra.Client _client;
public CassandraThriftFacade(TFramedTransport transport) {
_transport = transport;
_client = new Cassandra.Client(new TBinaryProtocol(_transport));
try {
_transport.open();
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
@Override
public void close() {
try {
_transport.close();
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
// Note this returns the Thrift protocol version (eg. "19.36.2"), not the Cassandra version (eg. "1.2.18").
public String describeVersion() {
try {
return _client.describe_version();
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
@Nullable
public KsDef describeKeyspace(String keyspace) {
try {
return _client.describe_keyspace(keyspace);
} catch (Exception e) {
return null; // Does not exist
}
}
public void systemAddKeyspace(KsDef keyspaceDefinition) {
try {
_client.system_add_keyspace(keyspaceDefinition);
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
public void systemUpdateKeyspace(KsDef keyspaceDefinition) {
try {
_client.system_update_keyspace(keyspaceDefinition);
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
/** @deprecated Remove once Cassandra 1.1 support is no longer necessary. */
public void executeCql3Script_1_1(String script) {
try {
_client.set_cql_version(CQL_VERSION);
for (String cqlStatement : toCqlStatements(script)) {
if (StringUtils.isNotBlank(cqlStatement)) {
cqlStatement += ";";
_log.info("executing cql statement: " + cqlStatement);
_client.execute_cql_query(ByteBuffer.wrap(cqlStatement.getBytes("UTF-8")), Compression.NONE);
}
}
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
public void executeCql3Script(String script) {
try {
for (String cqlStatement : toCqlStatements(script)) {
if (StringUtils.isNotBlank(cqlStatement)) {
cqlStatement += ";";
_log.info("executing cql3 statement: " + cqlStatement);
_client.execute_cql3_query(ByteBuffer.wrap(cqlStatement.getBytes("UTF-8")), Compression.NONE, ConsistencyLevel.LOCAL_QUORUM);
}
}
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
private static String[] toCqlStatements(String script) {
return StringUtils.stripAll(StringUtils.split(script, ";"));
}
} | {
"content_hash": "3f5024837dca8243979d832467bdf209",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 145,
"avg_line_length": 35.54545454545455,
"alnum_prop": 0.6331085794001395,
"repo_name": "r48patel/emodb",
"id": "8a1788352d172dd7bba87a3238f5fe07478006ed",
"size": "4301",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "web/src/main/java/com/bazaarvoice/emodb/web/ddl/CassandraThriftFacade.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "6174535"
},
{
"name": "Shell",
"bytes": "10022"
}
],
"symlink_target": ""
} |
char *cStr2Str11(const char *str);
#endif
| {
"content_hash": "3de3062e02c386a05a2a8c2f1107f529",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 34,
"avg_line_length": 14.333333333333334,
"alnum_prop": 0.7209302325581395,
"repo_name": "imjerrybao/CMUtils",
"id": "f1b2bcfd095bf26efbe49e86f28a7eb57743c52a",
"size": "220",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CMUtils/Vendor/Hex62To11/Hex62To11.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "98644"
},
{
"name": "Ruby",
"bytes": "1845"
}
],
"symlink_target": ""
} |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>datanucleus-test-jdo-typesafe</artifactId>
<name>org.datanucleus.test.jdo.typesafe</name>
<description><![CDATA[
DataNucleus Tests for JDO Typesafe Queries
]]></description>
<parent>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-test-maven-parent</artifactId>
<version>6.0</version>
<relativePath>../../maven.parent</relativePath>
</parent>
<properties>
<jdo.query.version>6.0.0-release</jdo.query.version>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<dependencies>
<!-- This is required so m2e-apt can calculate the dependencies for the .factorypath correctly -->
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-jdo-query</artifactId>
<version>${jdo.query.version}</version>
</dependency>
</dependencies>
<!-- configuration>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
</configuration-->
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>javax.jdo</artifactId>
<version>[${javax.jdo.min.version}, ${javax.jdo.max.version})</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jdo</artifactId>
<version>[${api.jdo.min.version}, ${api.jdo.max.version})</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-jdo-query</artifactId>
<version>${jdo.query.version}</version>
</dependency>
<!-- Javax.validation 2.0 -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.apache.bval</groupId>
<artifactId>bval-jsr</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.bval</groupId>
<artifactId>bval-core</artifactId>
<version>1.1.1</version>
</dependency>
<dependency> <!-- Needed when using Java 10+ since commons-lang has an NPE otherwise -->
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
</dependency>
</dependencies>
</project>
| {
"content_hash": "b3de1c44cc80f9a6fafd37d81f03d441",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 118,
"avg_line_length": 39.9,
"alnum_prop": 0.5529448621553885,
"repo_name": "datanucleus/tests",
"id": "b9a0d6331c71cc79748b5e78282b0d9990b3f6e5",
"size": "3192",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jdo/typesafe/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "28945"
},
{
"name": "HTML",
"bytes": "34413"
},
{
"name": "Java",
"bytes": "11934658"
},
{
"name": "Perl",
"bytes": "9273"
},
{
"name": "Python",
"bytes": "3087"
},
{
"name": "Shell",
"bytes": "20836"
},
{
"name": "XSLT",
"bytes": "211062"
}
],
"symlink_target": ""
} |
Dynamic TV Guide for Android Sample
This project is a simple demo of a TV Guide. The channels are created dynamically
when you scroll down also the schedules are created dynamically when you scroll horizontally.
This way you avoid overloading the Device with several static views that you don't need.
For this project you need Horizontal Listview Library from MeetMe (https://github.com/MeetMe/Android-HorizontalListView)
with a few changes to make the horizontal scroll sync possible.
Enjoy :)
Screen Shoots


| {
"content_hash": "587e4347dbf05575c0b26e9452cdb845",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 135,
"avg_line_length": 43.833333333333336,
"alnum_prop": 0.7997465145754119,
"repo_name": "jobernas/Tv-Guide-Android",
"id": "d5ecbd1ac0c3102aa5b6e3862cd77393fb93c834",
"size": "808",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "80503"
}
],
"symlink_target": ""
} |
using ILspect.Syntax.Expressions;
using Mono.Cecil.Cil;
namespace ILspect.Syntax.Statements
{
public class ExpressionStatement : Statement
{
public Expression Expression { get; }
public ExpressionStatement(Expression expression)
: this(expression, instruction: null) { }
public ExpressionStatement(Expression expression, Instruction instruction) : base(instruction)
{
Expression = expression;
}
public override string ToString()
{
return Expression.ToString();
}
}
} | {
"content_hash": "4755f0e6b7f595cac2813d1ead31e46d",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 102,
"avg_line_length": 25.347826086956523,
"alnum_prop": 0.6415094339622641,
"repo_name": "anurse/ILspect",
"id": "dbb687f6df93b6116303a299b6c2911c812354e3",
"size": "585",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/ILspect.Core/Syntax/Statements/ExpressionStatement.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "146820"
},
{
"name": "PowerShell",
"bytes": "105"
},
{
"name": "Shell",
"bytes": "178"
}
],
"symlink_target": ""
} |
test repository
| {
"content_hash": "03a708305bb5d989c6376c0df0a8cef2",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 15,
"avg_line_length": 16,
"alnum_prop": 0.875,
"repo_name": "Len-PGH/Test",
"id": "d92b67852491184cc740464bb4ffcb09a5585652",
"size": "23",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using System;
using System.Collections;
using System.Configuration;
using System.IO;
using System.Text.RegularExpressions;
using Org.BouncyCastle.Asn1.X509;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.X509;
using Talifun.AcceptanceTestProxy.Certificates;
using Talifun.AcceptanceTestProxy.Profiles;
using Talifun.AcceptanceTestProxy.WebServer;
namespace Talifun.AcceptanceTestProxy
{
public class Program
{
static void Main(string[] args)
{
log4net.Config.XmlConfigurator.Configure();
var proxyServerConfiguration = new ProxyServerConfiguration()
{
DumpHeaders = false,
DumpPostData = false,
DumpResponseData = false
};
if (args.Length > 0)
{
if (args.Length <= 3)
{
var argRegHelp = new Regex(@"^(/|-)\?$");
var argRexH = new Regex("^(/|-)h$");
var argRexP = new Regex("^(/|-)p$");
var argRexR = new Regex("^(/|-)r$");
foreach (var s in args)
{
if (argRexH.IsMatch(s.ToLower()))
{
proxyServerConfiguration.DumpHeaders = true;
}
else if (argRexP.IsMatch(s.ToLower()))
{
proxyServerConfiguration.DumpPostData = true;
}
else if (argRexR.IsMatch(s.ToLower()))
{
proxyServerConfiguration.DumpResponseData = true;
}
else
{
PrintUsageInfo();
return;
}
}
}
else if (args.Length > 4)
{
PrintUsageInfo();
return;
}
}
var proxyCache = new ProxyCache();
var profileCache = new ProfileCache();
var profileManager = new ProfileManager(profileCache);
var certificateGenerator = new CertificateGenerator();
var certificateCache = new CertificateCache();
var certificateManager = GetCertificateManager(proxyServerConfiguration, certificateGenerator, certificateCache);
var proxyServer = new ProxyServer(proxyServerConfiguration, profileManager, proxyCache, certificateGenerator, certificateManager);
if (proxyServer.Start())
{
Console.WriteLine("Server started on {0}:{1}...Press enter key to end", proxyServerConfiguration.ListeningIpInterface, proxyServerConfiguration.ListeningPort);
Console.ReadLine();
Console.WriteLine("Shutting down");
proxyServer.Stop();
Console.WriteLine("Server stopped...");
}
Console.WriteLine("Press enter to exit");
Console.ReadLine();
}
/// <summary>
/// Creates certificate authority certificate if required.
/// </summary>
/// <param name="proxyServerConfiguration"></param>
/// <param name="certificateGenerator"></param>
/// <param name="certificateCache"></param>
/// <returns></returns>
private static CertificateManager GetCertificateManager(ProxyServerConfiguration proxyServerConfiguration, CertificateGenerator certificateGenerator, CertificateCache certificateCache)
{
var caCertificateFileName = Path.Combine(proxyServerConfiguration.CertificatePath, proxyServerConfiguration.CaCertificateFileName);
if (!File.Exists(caCertificateFileName))
{
CreateCaCertificate(certificateGenerator, proxyServerConfiguration);
}
AsymmetricCipherKeyPair caKeyPair = null;
try
{
var caKeyPairText = File.ReadAllText(Path.Combine(proxyServerConfiguration.CertificatePath, proxyServerConfiguration.CaKeyPairFileName));
caKeyPair = certificateGenerator.ImportKeyPair(caKeyPairText);
}
catch (Exception ex)
{
throw new ConfigurationErrorsException(string.Format("Could not read the ca private key from file from {0}", proxyServerConfiguration.CaKeyPairFileName), ex);
}
X509Certificate caCertificate = null;
try
{
var caCertificateText = File.ReadAllText(Path.Combine(proxyServerConfiguration.CertificatePath, proxyServerConfiguration.CaCertificateFileName));
caCertificate = certificateGenerator.ImportCertificate(caCertificateText);
}
catch (Exception ex)
{
throw new ConfigurationErrorsException(string.Format("Could not read the ca certificate from file from {0}", proxyServerConfiguration.CaCertificateFileName), ex);
}
var certificateManager = new CertificateManager(certificateCache, caKeyPair, caCertificate);
return certificateManager;
}
private static void CreateCaCertificate(CertificateGenerator certificateGenerator, IProxyServerConfiguration proxyServerConfiguration)
{
var caKeyPair = certificateGenerator.GetKeyPair();
IDictionary caCertificateDetails = new Hashtable();
caCertificateDetails[X509Name.C] = "UK";
caCertificateDetails[X509Name.O] = "Acceptance Test Proxy Organization";
caCertificateDetails[X509Name.OU] = "Testing Department";
//caCertificateDetails[X509Name.DnQualifier]; //populatated automatically from CN
caCertificateDetails[X509Name.ST] = "London";
caCertificateDetails[X509Name.CN] = "AcceptanceTestProxy CA";
//caCertificateDetails[X509Name.SerialNumber] = CaCertificateName; //populatated automatically
//RFC 5208
IList caCertificateDetailsOrder = new ArrayList();
caCertificateDetailsOrder.Add(X509Name.C);
caCertificateDetailsOrder.Add(X509Name.O);
caCertificateDetailsOrder.Add(X509Name.OU);
//caCertificateDetailsOrder.Add(X509Name.DnQualifier);
caCertificateDetailsOrder.Add(X509Name.ST);
caCertificateDetailsOrder.Add(X509Name.CN);
//caCertificateDetailsOrder.Add(X509Name.SerialNumber);
var caCertificate = certificateGenerator.GenerateCaCertificate(caKeyPair, caCertificateDetails, caCertificateDetailsOrder);
var caKeyPairFileName = Path.Combine(proxyServerConfiguration.CertificatePath, proxyServerConfiguration.CaKeyPairFileName);
if (File.Exists(caKeyPairFileName))
{
File.Delete(caKeyPairFileName);
}
var privateKeyText = certificateGenerator.ExportKeyPair(caKeyPair);
File.WriteAllText(caKeyPairFileName, privateKeyText);
var caCertificateFileName = Path.Combine(proxyServerConfiguration.CertificatePath, proxyServerConfiguration.CaCertificateFileName);
if (File.Exists(caCertificateFileName))
{
File.Delete(caCertificateFileName);
}
var certificateText = certificateGenerator.ExportCertificate(caCertificate);
File.WriteAllText(caCertificateFileName, certificateText);
}
private static void PrintUsageInfo()
{
Console.WriteLine("AcceptanceTestProxy server usage: ");
Console.WriteLine("\t-? = this help");
Console.WriteLine("\t-h = dump headers to standard output");
Console.WriteLine("\t-p = dump post data to standard output");
Console.WriteLine("\t-r = dump response data to standard output (WARNING: redirect your output to a file)");
Console.WriteLine();
Console.WriteLine("\tNote: Data dumping kills performance");
Console.WriteLine();
Console.WriteLine("\tDisclaimer: This proxy server is for testing and development purposes only.");
Console.WriteLine("\t Installing this server on a network without the knowledge of others is not");
Console.WriteLine("\t condoned by the author. This proxy server presents a security risk for");
Console.WriteLine("\t users who do not understand SSL certificates and browser security.");
Console.WriteLine();
Console.WriteLine("\tAuthor: Taliesin Sisson <tali@talifun.com>");
Console.WriteLine();
}
}
}
| {
"content_hash": "2d429027105d6d4f8c98cf9ce158c5fb",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 192,
"avg_line_length": 47.18181818181818,
"alnum_prop": 0.6076164569874193,
"repo_name": "taliesins/talifun-acceptancetestproxy",
"id": "dc0402c9509e6addd56d2aadcbf717a999b05623",
"size": "8825",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Talifun.AcceptanceTestProxy/Program.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "276197"
},
{
"name": "PowerShell",
"bytes": "68905"
},
{
"name": "Shell",
"bytes": "664"
}
],
"symlink_target": ""
} |
using System;
using System.Linq;
using MongoDB.Driver.Linq;
using LCL.Repositories.MongoDB;
using LCL.Domain.Repositories;
using LCL.Tests.Domain.Model;
namespace LCL.Tests.Domain.Repositories.MongoDB
{
public class UserRoleRepository : MongoDBRepository<UserRole>, IUserRoleRepository
{
public UserRoleRepository(IRepositoryContext context)
: base(context) { }
public Role GetRoleForUser(User user)
{
var con = this.Context as MongoDBRepositoryContext;
var userRoleCollection = con.GetCollectionForType(typeof(UserRole));
var userRole = userRoleCollection.AsQueryable<UserRole>().Where(ur => ur.UserID == user.ID).FirstOrDefault();
if (userRole == null)
return null;
var roleCollection = con.GetCollectionForType(typeof(Role));
return roleCollection.AsQueryable<Role>().Where(r => r.ID == userRole.RoleID).FirstOrDefault();
}
}
}
| {
"content_hash": "3e20baec5fcd5feffc173033b6e32748",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 121,
"avg_line_length": 37.25925925925926,
"alnum_prop": 0.658051689860835,
"repo_name": "luomingui/LCLFramework",
"id": "e2e99b259f9ab6f509c15869f3ed8d53ca7a9616",
"size": "1008",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/Tests/LCL.Tests/ACore/Domain/Repositories/MongoDB/UserRoleRepository.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "303"
},
{
"name": "Batchfile",
"bytes": "2385"
},
{
"name": "C#",
"bytes": "1463270"
},
{
"name": "CSS",
"bytes": "3088"
},
{
"name": "HTML",
"bytes": "3945"
},
{
"name": "JavaScript",
"bytes": "14028"
},
{
"name": "PowerShell",
"bytes": "979"
},
{
"name": "XSLT",
"bytes": "58161"
}
],
"symlink_target": ""
} |
set -ex
./build.sh
docker push pedronasser/functions-lambda:nodejs4.3
| {
"content_hash": "657a92e8903d4c919cbfa7e985623840",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 50,
"avg_line_length": 17.75,
"alnum_prop": 0.7887323943661971,
"repo_name": "pedronasser/functions",
"id": "267582b098dc586c37d1771e2b5a9a64930d7d97",
"size": "71",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "fn/lambda/node/release.sh",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "359500"
},
{
"name": "Makefile",
"bytes": "2014"
},
{
"name": "PowerShell",
"bytes": "1021"
},
{
"name": "Ruby",
"bytes": "5539"
},
{
"name": "Shell",
"bytes": "4340"
}
],
"symlink_target": ""
} |
<?php
namespace mqlUIT\CandidatureBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class DiplometypeType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('type')
;
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'mqlUIT\CandidatureBundle\Entity\Diplometype'
));
}
public function getName()
{
return 'mqluit_candidaturebundle_diplometypetype';
}
}
| {
"content_hash": "4598348b12d76163d364cc839bdc849c",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 76,
"avg_line_length": 24.344827586206897,
"alnum_prop": 0.6954674220963173,
"repo_name": "tahametal/uitcandidature",
"id": "f9e5f8437f79dde62ce336ba94b74b75002c9044",
"size": "706",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/mqlUIT/CandidatureBundle/Form/DiplometypeType.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "103483"
},
{
"name": "JavaScript",
"bytes": "170265"
},
{
"name": "PHP",
"bytes": "217847"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/button_white_transparent_pressed" android:state_pressed="true" />
<item android:drawable="@drawable/button_white_transparent_focused" android:state_focused="true" />
<item android:drawable="@drawable/button_white_transparent_normal" />
</selector> | {
"content_hash": "5f7f1913b705f6171f0484d929326edc",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 103,
"avg_line_length": 67,
"alnum_prop": 0.7437810945273632,
"repo_name": "kolipass/tarantino-stub",
"id": "17912a974e99e0af86ec4f43dab3b64587b894dd",
"size": "402",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/drawable/button_white_transparent.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "463955"
}
],
"symlink_target": ""
} |
@IMPORT url("simulation-inputs.css");
@IMPORT url("simulation-outputs.css");
@IMPORT url("simulation-both.css");
@IMPORT url("simulation-model.css"); | {
"content_hash": "7d4b727000605b2105f3eb08447667d5",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 38,
"avg_line_length": 37.25,
"alnum_prop": 0.738255033557047,
"repo_name": "CCI-MIT/XCoLab",
"id": "fc99418b1fef86b1ae9b0153c7a1910a9bd43526",
"size": "149",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "view/src/main/resources/static/css/pages/modeling/simulation.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "22697"
},
{
"name": "HTML",
"bytes": "69904"
},
{
"name": "Java",
"bytes": "4089581"
},
{
"name": "JavaScript",
"bytes": "1172118"
},
{
"name": "SCSS",
"bytes": "201019"
},
{
"name": "Shell",
"bytes": "13707"
}
],
"symlink_target": ""
} |
static MP_INLINE
int mpxs_Apache2__RequestRec_push_handlers(pTHX_ request_rec *r,
const char *name,
SV *sv)
{
return modperl_handler_perl_add_handlers(aTHX_
r, NULL, r->server, r->pool,
name, sv,
MP_HANDLER_ACTION_PUSH);
}
static MP_INLINE
int mpxs_Apache2__RequestRec_set_handlers(pTHX_ request_rec *r,
const char *name,
SV *sv)
{
return modperl_handler_perl_add_handlers(aTHX_
r, NULL, r->server, r->pool,
name, sv,
MP_HANDLER_ACTION_SET);
}
static MP_INLINE
SV *mpxs_Apache2__RequestRec_get_handlers(pTHX_ request_rec *r,
const char *name)
{
MpAV **handp =
modperl_handler_get_handlers(r, NULL, r->server,
r->pool, name,
MP_HANDLER_ACTION_GET);
return modperl_handler_perl_get_handlers(aTHX_ handp, r->pool);
}
/*
* XXX: these three should be part of the apache api
* for protocol module helpers
*/
static MP_INLINE
SV *mpxs_Apache2__RequestRec_new(pTHX_ SV *classname,
conn_rec *c,
SV *base_pool_sv)
{
apr_pool_t *p, *base_pool;
request_rec *r;
server_rec *s = c->base_server;
SV *r_sv;
/* see: httpd-2.0/server/protocol.c:ap_read_request */
if (base_pool_sv) {
base_pool = mp_xs_sv2_APR__Pool(base_pool_sv);
}
else {
base_pool = c->pool;
}
apr_pool_create(&p, base_pool);
r = apr_pcalloc(p, sizeof(request_rec));
r->pool = p;
r->connection = c;
r->server = s;
r->request_time = apr_time_now();
r->user = NULL;
r->ap_auth_type = NULL;
r->allowed_methods = ap_make_method_list(p, 1);
r->headers_in = apr_table_make(p, 1);
r->subprocess_env = apr_table_make(r->pool, 1);
r->headers_out = apr_table_make(p, 1);
r->err_headers_out = apr_table_make(p, 1);
r->notes = apr_table_make(p, 1);
r->request_config = ap_create_request_config(p);
r->proto_output_filters = c->output_filters;
r->output_filters = r->proto_output_filters;
r->proto_input_filters = c->input_filters;
r->input_filters = r->proto_input_filters;
ap_run_create_request(r);
r->per_dir_config = s->lookup_defaults;
r->sent_bodyct = 0;
r->read_length = 0;
r->read_body = REQUEST_NO_BODY;
r->status = HTTP_OK;
r->the_request = "UNKNOWN";
r->hostname = s->server_hostname;
r->method = "GET";
r->method_number = M_GET;
r->uri = "/";
r->filename = (char *)ap_server_root_relative(p, r->uri);
r->assbackwards = 1;
r->protocol = "UNKNOWN";
r_sv = sv_setref_pv(newSV(0), "Apache2::RequestRec", (void*)r);
if (base_pool_sv) {
mpxs_add_pool_magic(r_sv, base_pool_sv);
}
return r_sv;
}
static MP_INLINE
request_rec *mpxs_Apache2__RequestUtil_request(pTHX_ SV *classname, SV *svr)
{
/* ignore classname */
return modperl_global_request(aTHX_ svr);
}
static MP_INLINE
int mpxs_Apache2__RequestRec_location_merge(request_rec *r,
char *location)
{
apr_pool_t *p = r->pool;
server_rec *s = r->server;
core_server_config *sconf = ap_get_module_config(s->module_config,
&core_module);
ap_conf_vector_t **sec = (ap_conf_vector_t **)sconf->sec_url->elts;
int num_sec = sconf->sec_url->nelts;
int i;
for (i=0; i<num_sec; i++) {
core_dir_config *entry =
(core_dir_config *)ap_get_module_config(sec[i],
&core_module);
if (strEQ(entry->d, location)) {
r->per_dir_config =
ap_merge_per_dir_configs(p, s->lookup_defaults, sec[i]);
return 1;
}
}
return 0;
}
static MP_INLINE
void mpxs_Apache2__RequestRec_set_basic_credentials(request_rec *r,
char *username,
char *password)
{
char encoded[1024];
int elen;
char *auth_value, *auth_cat;
auth_cat = apr_pstrcat(r->pool,
username, ":", password, NULL);
elen = apr_base64_encode(encoded, auth_cat, strlen(auth_cat));
encoded[elen] = '\0';
auth_value = apr_pstrcat(r->pool, "Basic ", encoded, NULL);
apr_table_setn(r->headers_in, "Authorization", auth_value);
}
static MP_INLINE
int mpxs_Apache2__RequestRec_no_cache(pTHX_ request_rec *r, SV *flag)
{
int retval = r->no_cache;
if (flag) {
r->no_cache = (int)SvIV(flag);
}
if (r->no_cache) {
apr_table_setn(r->headers_out, "Pragma", "no-cache");
apr_table_setn(r->headers_out, "Cache-control", "no-cache");
}
else if (flag) { /* only unset if $r->no_cache(0) */
apr_table_unset(r->headers_out, "Pragma");
apr_table_unset(r->headers_out, "Cache-control");
}
return retval;
}
static MP_INLINE
SV *mpxs_Apache2__RequestRec_pnotes(pTHX_ request_rec *r, SV *key, SV *val)
{
MP_dRCFG;
if (!rcfg) {
return &PL_sv_undef;
}
return modperl_pnotes(aTHX_ &rcfg->pnotes, key, val, r->pool);
}
static MP_INLINE
void mpxs_Apache2__RequestRec_pnotes_kill(pTHX_ request_rec *r)
{
MP_dRCFG;
if (!rcfg) {
return;
}
modperl_pnotes_kill(&rcfg->pnotes);
}
#define mpxs_Apache2__RequestRec_dir_config(r, key, sv_val) \
modperl_dir_config(aTHX_ r, r->server, key, sv_val)
#define mpxs_Apache2__RequestRec_slurp_filename(r, tainted) \
modperl_slurp_filename(aTHX_ r, tainted)
static MP_INLINE
char *mpxs_Apache2__RequestRec_location(request_rec *r)
{
MP_dDCFG;
return dcfg->location;
}
typedef struct {
PerlInterpreter *perl;
SV *sv;
} sv_str_header_t;
static int sv_str_header(void *arg, const char *k, const char *v)
{
sv_str_header_t *svh = (sv_str_header_t *)arg;
dTHXa(svh->perl);
Perl_sv_catpvf(aTHX_ svh->sv, "%s: %s\n", k, v);
return 1;
}
static MP_INLINE
SV *mpxs_Apache2__RequestRec_as_string(pTHX_ request_rec *r)
{
sv_str_header_t svh;
#ifdef USE_ITHREADS
svh.perl = aTHX;
#endif
svh.sv = newSVpv(r->the_request, 0);
sv_catpvn(svh.sv, "\n", 1);
apr_table_do((int (*) (void *, const char *, const char *))
sv_str_header, (void *) &svh, r->headers_in, NULL);
Perl_sv_catpvf(aTHX_ svh.sv, "\n%s %s\n", r->protocol, r->status_line);
apr_table_do((int (*) (void *, const char *, const char *))
sv_str_header, (void *) &svh, r->headers_out, NULL);
apr_table_do((int (*) (void *, const char *, const char *))
sv_str_header, (void *) &svh, r->err_headers_out, NULL);
sv_catpvn(svh.sv, "\n", 1);
return svh.sv;
}
static MP_INLINE
int mpxs_Apache2__RequestRec_is_perl_option_enabled(pTHX_ request_rec *r,
const char *name)
{
return modperl_config_is_perl_option_enabled(aTHX_ r, r->server, name);
}
static MP_INLINE
void mpxs_Apache2__RequestRec_add_config(pTHX_ request_rec *r, SV *lines,
int override, char *path,
int override_options)
{
const char *errmsg = modperl_config_insert_request(aTHX_ r, lines,
override, path,
override_options);
if (errmsg) {
Perl_croak(aTHX_ "$r->add_config() has failed: %s", errmsg);
}
}
/* in order to ensure that s->document_root doesn't get corrupted by
* modperl users setting its value, restore the original value at the
* end of each request */
struct mp_docroot_info {
const char **docroot;
const char *original;
};
static apr_status_t restore_docroot(void *data)
{
struct mp_docroot_info *di = (struct mp_docroot_info *)data;
*di->docroot = di->original;
return APR_SUCCESS;
}
static MP_INLINE
const char *mpxs_Apache2__RequestRec_document_root(pTHX_ request_rec *r,
SV *new_root)
{
const char *retval = ap_document_root(r);
if (new_root) {
struct mp_docroot_info *di;
core_server_config *conf;
MP_CROAK_IF_THREADS_STARTED("setting $r->document_root");
conf = ap_get_module_config(r->server->module_config,
&core_module);
di = apr_palloc(r->pool, sizeof *di);
di->docroot = &conf->ap_document_root;
di->original = conf->ap_document_root;
apr_pool_cleanup_register(r->pool, di, restore_docroot,
restore_docroot);
conf->ap_document_root = apr_pstrdup(r->pool, SvPV_nolen(new_root));
}
return retval;
}
static apr_status_t child_terminate(void *data) {
apr_pool_t *pool = (apr_pool_t *)data;
/* On the first pass, re-register so we end up last */
if (data) {
apr_pool_cleanup_register(pool, NULL, child_terminate,
apr_pool_cleanup_null);
}
else {
exit(0);
}
return APR_SUCCESS;
}
static MP_INLINE
void mpxs_Apache2__RequestRec_child_terminate(pTHX_ request_rec *r)
{
MP_CROAK_IF_THREADED_MPM("$r->child_terminate")
apr_pool_cleanup_register(r->pool, r->pool, child_terminate,
apr_pool_cleanup_null);
}
static MP_INLINE
apr_status_t mpxs_ap_register_auth_provider(pTHX_ I32 items, SV **MARK, SV **SP)
{
apr_pool_t *pool;
const char *provider_group;
const char *provider_name;
const char *provider_version;
SV *callback1;
SV *callback2 = NULL;
int type;
if (items != 7)
Perl_croak(aTHX_ "pool, provider_group, provider_name, "
"provider_version, callback1, callback2, type");
if (SvROK(*MARK) && sv_derived_from(*MARK, "APR::Pool")) {
IV tmp = SvIV((SV*)SvRV(*MARK));
if (tmp == 0) {
Perl_croak(aTHX_ "invalid pool object (already destroyed?)");
}
pool = INT2PTR(APR__Pool, tmp);
}
else {
Perl_croak(aTHX_ SvROK(*MARK) ?
"pool is not of type APR::Pool" :
"pool is not a blessed reference");
}
MARK++;
provider_group = (const char *)SvPV_nolen(*MARK);
MARK++;
provider_name = (const char *)SvPV_nolen(*MARK);
MARK++;
provider_version = (const char *)SvPV_nolen(*MARK);
MARK++;
callback1 = newSVsv(*MARK);
MARK++;
callback2 = NULL;
if (SvROK(*MARK)) {
callback2 = newSVsv(*MARK);
}
MARK++;
type = (int)SvIV(*MARK);
return modperl_register_auth_provider(pool, provider_group, provider_name,
provider_version, callback1,
callback2, type);
}
/*
* Local Variables:
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
| {
"content_hash": "de5c4699bf7f82229916fbf53842aaaf",
"timestamp": "",
"source": "github",
"line_count": 407,
"max_line_length": 80,
"avg_line_length": 28.39066339066339,
"alnum_prop": 0.5305928169623539,
"repo_name": "dreamhost/dpkg-ndn-perl-mod-perl",
"id": "4433c8833d5f4a1d7975861e4fe935b7386828e7",
"size": "12353",
"binary": false,
"copies": "2",
"ref": "refs/heads/httpd24",
"path": "xs/Apache2/RequestUtil/Apache2__RequestUtil.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "688577"
},
{
"name": "Groff",
"bytes": "273"
},
{
"name": "HTML",
"bytes": "51"
},
{
"name": "Max",
"bytes": "1581"
},
{
"name": "Perl",
"bytes": "2849754"
},
{
"name": "Perl6",
"bytes": "43726"
},
{
"name": "XS",
"bytes": "6901"
}
],
"symlink_target": ""
} |
class IDataCache;
//-----------------------------------------------------------------------------
//
// Shared Data Cache API
//
//-----------------------------------------------------------------------------
#define DATACACHE_INTERFACE_VERSION "VDataCache003"
//-----------------------------------------------------------------------------
// Support types and enums
//-----------------------------------------------------------------------------
//---------------------------------------------------------
// Unique (per section) identifier for a cache item defined by client
//---------------------------------------------------------
typedef uint32 DataCacheClientID_t;
//---------------------------------------------------------
// Cache-defined handle for a cache item
//---------------------------------------------------------
FORWARD_DECLARE_HANDLE( memhandle_t );
typedef memhandle_t DataCacheHandle_t;
#define DC_INVALID_HANDLE ((DataCacheHandle_t)0)
//---------------------------------------------------------
// Cache Limits
//---------------------------------------------------------
struct DataCacheLimits_t
{
DataCacheLimits_t( unsigned nMaxBytes = (unsigned)-1, unsigned nMaxItems = (unsigned)-1, unsigned nMinBytes = 0, unsigned nMinItems = 0 )
: nMaxBytes(nMaxBytes),
nMaxItems(nMaxItems),
nMinBytes(nMinBytes),
nMinItems(nMinItems)
{
}
// Maximum levels permitted
unsigned nMaxBytes;
unsigned nMaxItems;
// Minimum levels permitted
unsigned nMinBytes;
unsigned nMinItems;
};
//---------------------------------------------------------
// Cache status
//---------------------------------------------------------
struct DataCacheStatus_t
{
// Current state of the cache
unsigned nBytes;
unsigned nItems;
unsigned nBytesLocked;
unsigned nItemsLocked;
// Diagnostics
unsigned nFindRequests;
unsigned nFindHits;
};
//---------------------------------------------------------
// Cache options
//---------------------------------------------------------
enum DataCacheOptions_t
{
DC_TRACE_ACTIVITY = (1 << 0),
DC_FORCE_RELOCATE = (1 << 1),
DC_ALWAYS_MISS = (1 << 2),
DC_VALIDATE = (1 << 3),
};
//---------------------------------------------------------
// Cache report types
//---------------------------------------------------------
enum DataCacheReportType_t
{
DC_SUMMARY_REPORT,
DC_DETAIL_REPORT,
DC_DETAIL_REPORT_LRU,
};
//---------------------------------------------------------
// Notifications to section clients on cache events
//---------------------------------------------------------
enum DataCacheNotificationType_t
{
// Used internally to prohibit notifications
DC_NONE,
// Item is falling off the LRU and should be deleted, return false to block
DC_AGE_DISCARD,
// Item is being explicitly flushed and should be deleted, return false to block
DC_FLUSH_DISCARD,
// Item is being explicitly removed and should be deleted. Failure is not an option
DC_REMOVED,
// Cache is requesting item be relocated for debugging purposes
DC_RELOCATE,
// Item info should be output to console, return false to accept default handling
DC_PRINT_INF0,
};
//-------------------------------------
struct DataCacheNotification_t
{
DataCacheNotificationType_t type;
const char * pszSectionName;
DataCacheClientID_t clientId;
const void * pItemData;
unsigned nItemSize;
};
//---------------------------------------------------------
const int DC_MAX_CLIENT_NAME = 15;
const int DC_MAX_ITEM_NAME = 511;
//---------------------------------------------------------
// Result codes
//---------------------------------------------------------
enum DataCacheRemoveResult_t
{
DC_OK,
DC_NOT_FOUND,
DC_LOCKED,
};
//---------------------------------------------------------
// Add flags
//---------------------------------------------------------
enum DataCacheAddFlags_t
{
DCAF_LOCK = ( 1 << 0 ),
DCAF_DEFAULT = 0,
};
//-----------------------------------------------------------------------------
// IDataCacheSection
//
// Purpose: Implements a sub-section of the global cache. Subsections are
// areas of the cache with thier own memory constraints and common
// management.
//-----------------------------------------------------------------------------
abstract_class IDataCacheSection
{
public:
//--------------------------------------------------------
virtual IDataCache *GetSharedCache() = 0;
virtual const char *GetName() = 0;
//--------------------------------------------------------
// Purpose: Controls cache size & options
//--------------------------------------------------------
virtual void SetLimits( const DataCacheLimits_t &limits ) = 0;
virtual void SetOptions( unsigned options ) = 0;
//--------------------------------------------------------
// Purpose: Get the current state of the section
//--------------------------------------------------------
virtual void GetStatus( DataCacheStatus_t *pStatus, DataCacheLimits_t *pLimits = NULL ) = 0;
//--------------------------------------------------------
// Purpose: Add an item to the cache. Purges old items if over budget, returns false if item was already in cache.
//--------------------------------------------------------
virtual void EnsureCapacity( unsigned nBytes, unsigned nItems = 1 ) = 0;
//--------------------------------------------------------
// Purpose: Add an item to the cache. Purges old items if over budget, returns false if item was already in cache.
//--------------------------------------------------------
virtual bool Add( DataCacheClientID_t clientId, const void *pItemData, unsigned size, DataCacheHandle_t *pHandle ) = 0;
//--------------------------------------------------------
// Purpose: Finds an item in the cache, returns NULL if item is not in cache. Not a cheap operation if section not configured for fast find.
//--------------------------------------------------------
virtual DataCacheHandle_t Find( DataCacheClientID_t clientId ) = 0;
//--------------------------------------------------------
// Purpose: Get an item out of the cache and remove it. No callbacks are executed unless explicity specified.
//--------------------------------------------------------
virtual DataCacheRemoveResult_t Remove( DataCacheHandle_t handle, const void **ppItemData, unsigned *pItemSize = NULL, bool bNotify = false ) = 0;
DataCacheRemoveResult_t Remove( DataCacheHandle_t handle, bool bNotify = false ) { return Remove( handle, NULL, NULL, bNotify ); }
//--------------------------------------------------------
// Purpose: Returns if the data is currently in memory, but does *not* change its location in the LRU
//--------------------------------------------------------
virtual bool IsPresent( DataCacheHandle_t handle ) = 0;
//--------------------------------------------------------
// Purpose: Lock an item in the cache, returns NULL if item is not in the cache.
//--------------------------------------------------------
virtual void *Lock( DataCacheHandle_t handle ) = 0;
//--------------------------------------------------------
// Purpose: Unlock a previous lock.
//--------------------------------------------------------
virtual int Unlock( DataCacheHandle_t handle ) = 0;
//--------------------------------------------------------
// Purpose: Get an item without locking it, returns NULL if item is not in the cache. Use with care!
//--------------------------------------------------------
virtual void *Get( DataCacheHandle_t handle, bool bFrameLock = false ) = 0;
virtual void *GetNoTouch( DataCacheHandle_t handle, bool bFrameLock = false ) = 0;
//--------------------------------------------------------
// Purpose: "Frame locking" (not game frame). A crude way to manage locks over relatively
// short periods. Does not affect normal locks/unlocks
//--------------------------------------------------------
virtual int BeginFrameLocking() = 0;
virtual bool IsFrameLocking() = 0;
virtual void *FrameLock( DataCacheHandle_t handle ) = 0;
virtual int EndFrameLocking() = 0;
virtual int *GetFrameUnlockCounterPtr() = 0;
//--------------------------------------------------------
// Purpose: Lock management, not for the feint of heart
//--------------------------------------------------------
virtual int GetLockCount( DataCacheHandle_t handle ) = 0;
virtual int BreakLock( DataCacheHandle_t handle ) = 0;
//--------------------------------------------------------
// Purpose: Explicitly mark an item as "recently used"
//--------------------------------------------------------
virtual bool Touch( DataCacheHandle_t handle ) = 0;
//--------------------------------------------------------
// Purpose: Explicitly mark an item as "least recently used".
//--------------------------------------------------------
virtual bool Age( DataCacheHandle_t handle ) = 0;
//--------------------------------------------------------
// Purpose: Empty the cache. Returns bytes released, will remove locked items if force specified
//--------------------------------------------------------
virtual unsigned Flush( bool bUnlockedOnly = true, bool bNotify = true ) = 0;
//--------------------------------------------------------
// Purpose: Dump the oldest items to free the specified amount of memory. Returns amount actually freed
//--------------------------------------------------------
virtual unsigned Purge( unsigned nBytes ) = 0;
//--------------------------------------------------------
// Purpose: Output the state of the section
//--------------------------------------------------------
virtual void OutputReport( DataCacheReportType_t reportType = DC_SUMMARY_REPORT ) = 0;
//--------------------------------------------------------
// Purpose: Updates the size used by a specific item (locks the item, kicks
// other items out to make room as necessary, unlocks the item).
//--------------------------------------------------------
virtual void UpdateSize( DataCacheHandle_t handle, unsigned int nNewSize ) = 0;
//--------------------------------------------------------
// Purpose: Access to the mutex. More explicit control during get-then-lock sequences
// to ensure object stays valid during "then"
//--------------------------------------------------------
virtual void LockMutex() = 0;
virtual void UnlockMutex() = 0;
//--------------------------------------------------------
// Purpose: Add an item to the cache. Purges old items if over budget, returns false if item was already in cache.
//--------------------------------------------------------
virtual bool AddEx( DataCacheClientID_t clientId, const void *pItemData, unsigned size, unsigned flags, DataCacheHandle_t *pHandle ) = 0;
};
//-----------------------------------------------------------------------------
// IDataCacheClient
//
// Purpose: Connection between the cache and the owner of a cache section
//
//-----------------------------------------------------------------------------
abstract_class IDataCacheClient
{
public:
//--------------------------------------------------------
//
//--------------------------------------------------------
virtual bool HandleCacheNotification( const DataCacheNotification_t ¬ification ) = 0;
//--------------------------------------------------------
//
//--------------------------------------------------------
virtual bool GetItemName( DataCacheClientID_t clientId, const void *pItem, char *pDest, unsigned nMaxLen ) = 0;
};
//-------------------------------------
class CDefaultDataCacheClient : public IDataCacheClient
{
public:
virtual bool HandleCacheNotification( const DataCacheNotification_t ¬ification )
{
switch ( notification.type )
{
case DC_AGE_DISCARD:
case DC_FLUSH_DISCARD:
case DC_REMOVED:
Assert ( 0 );
return false;
default:
break;
}
return false;
}
virtual bool GetItemName( DataCacheClientID_t clientId, const void *pItem, char *pDest, unsigned nMaxLen )
{
return false;
}
};
//-----------------------------------------------------------------------------
// IDataCache
//
// Purpose: The global shared cache. Manages sections and overall budgets.
//
//-----------------------------------------------------------------------------
abstract_class IDataCache : public IAppSystem
{
public:
//--------------------------------------------------------
// Purpose: Controls cache size.
//--------------------------------------------------------
virtual void SetSize( int nMaxBytes ) = 0;
virtual void SetOptions( unsigned options ) = 0;
virtual void SetSectionLimits( const char *pszSectionName, const DataCacheLimits_t &limits ) = 0;
//--------------------------------------------------------
// Purpose: Get the current state of the cache
//--------------------------------------------------------
virtual void GetStatus( DataCacheStatus_t *pStatus, DataCacheLimits_t *pLimits = NULL ) = 0;
//--------------------------------------------------------
// Purpose: Add a section to the cache
//--------------------------------------------------------
virtual IDataCacheSection *AddSection( IDataCacheClient *pClient, const char *pszSectionName, const DataCacheLimits_t &limits = DataCacheLimits_t(), bool bSupportFastFind = false ) = 0;
//--------------------------------------------------------
// Purpose: Remove a section from the cache
//--------------------------------------------------------
virtual void RemoveSection( const char *pszClientName, bool bCallFlush = true ) = 0;
void RemoveSection( IDataCacheSection *pSection, bool bCallFlush = true ) { if ( pSection) RemoveSection( pSection->GetName() ); }
//--------------------------------------------------------
// Purpose: Find a section of the cache
//--------------------------------------------------------
virtual IDataCacheSection *FindSection( const char *pszClientName ) = 0;
//--------------------------------------------------------
// Purpose: Dump the oldest items to free the specified amount of memory. Returns amount actually freed
//--------------------------------------------------------
virtual unsigned Purge( unsigned nBytes ) = 0;
//--------------------------------------------------------
// Purpose: Empty the cache. Returns bytes released, will remove locked items if force specified
//--------------------------------------------------------
virtual unsigned Flush( bool bUnlockedOnly = true, bool bNotify = true ) = 0;
//--------------------------------------------------------
// Purpose: Output the state of the cache
//--------------------------------------------------------
virtual void OutputReport( DataCacheReportType_t reportType = DC_SUMMARY_REPORT, const char *pszSection = NULL ) = 0;
};
//-----------------------------------------------------------------------------
// Helper class to support usage pattern similar to CDataManager
//-----------------------------------------------------------------------------
template< class STORAGE_TYPE, class CREATE_PARAMS, class LOCK_TYPE = STORAGE_TYPE * >
class CManagedDataCacheClient : public CDefaultDataCacheClient
{
public:
typedef CManagedDataCacheClient<STORAGE_TYPE, CREATE_PARAMS, LOCK_TYPE> CCacheClientBaseClass;
CManagedDataCacheClient()
: m_pCache( NULL )
{
}
void Init( IDataCache *pSharedCache, const char *pszSectionName, const DataCacheLimits_t &limits = DataCacheLimits_t(), bool bSupportFastFind = false )
{
if ( !m_pCache )
{
m_pCache = pSharedCache->AddSection( this, pszSectionName, limits, bSupportFastFind );
}
}
void Shutdown()
{
if ( m_pCache )
{
m_pCache->GetSharedCache()->RemoveSection( m_pCache );
m_pCache = NULL;
}
}
LOCK_TYPE CacheGet( DataCacheHandle_t handle, bool bFrameLock = true )
{
return (LOCK_TYPE)(((STORAGE_TYPE *)m_pCache->Get( handle, bFrameLock ))->GetData());
}
LOCK_TYPE CacheGetNoTouch( DataCacheHandle_t handle )
{
return (LOCK_TYPE)(((STORAGE_TYPE *)m_pCache->GetNoTouch( handle ))->GetData());
}
LOCK_TYPE CacheLock( DataCacheHandle_t handle )
{
return (LOCK_TYPE)(((STORAGE_TYPE *)m_pCache->Lock( handle ))->GetData());
}
int CacheUnlock( DataCacheHandle_t handle )
{
return m_pCache->Unlock( handle );
}
void CacheTouch( DataCacheHandle_t handle )
{
m_pCache->Touch( handle );
}
void CacheRemove( DataCacheHandle_t handle, bool bNotify = true )
{
m_pCache->Remove( handle, bNotify );
}
void CacheFlush()
{
m_pCache->Flush();
}
DataCacheHandle_t CacheCreate( const CREATE_PARAMS &createParams, unsigned flags = DCAF_DEFAULT )
{
m_pCache->EnsureCapacity(STORAGE_TYPE::EstimatedSize(createParams));
STORAGE_TYPE *pStore = STORAGE_TYPE::CreateResource( createParams );
DataCacheHandle_t handle;
m_pCache->AddEx( (DataCacheClientID_t)pStore, pStore, pStore->Size(), flags, &handle);
return handle;
}
void CacheLockMutex()
{
m_pCache->LockMutex();
}
void CacheUnlockMutex()
{
m_pCache->UnlockMutex();
}
bool HandleCacheNotification( const DataCacheNotification_t ¬ification )
{
switch ( notification.type )
{
case DC_AGE_DISCARD:
case DC_FLUSH_DISCARD:
case DC_REMOVED:
STORAGE_TYPE *p = (STORAGE_TYPE *)notification.clientId;
p->DestroyResource();
return true;
}
return CDefaultDataCacheClient::HandleCacheNotification( notification );
}
protected:
~CManagedDataCacheClient()
{
Shutdown();
}
IDataCacheSection *GetCacheSection()
{
return m_pCache;
}
private:
IDataCacheSection *m_pCache;
};
//-----------------------------------------------------------------------------
#endif // IDataCache
| {
"content_hash": "ddd9c2d2541744c7f9c941abf58a8173",
"timestamp": "",
"source": "github",
"line_count": 524,
"max_line_length": 186,
"avg_line_length": 33.721374045801525,
"alnum_prop": 0.4856819468024901,
"repo_name": "scen/ionlib",
"id": "a5948963d1b002d0d335bd3de3814a0c608892ad",
"size": "18060",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/sdk/hl2_ob/public/datacache/idatacache.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "9790968"
},
{
"name": "C++",
"bytes": "149439667"
},
{
"name": "D",
"bytes": "81870968"
},
{
"name": "Objective-C",
"bytes": "376824"
},
{
"name": "Perl",
"bytes": "77795"
},
{
"name": "Python",
"bytes": "2596"
},
{
"name": "Shell",
"bytes": "2289"
},
{
"name": "Squirrel",
"bytes": "4289"
}
],
"symlink_target": ""
} |
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("RefundKeyed")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("RefundKeyed")>
<Assembly: AssemblyCopyright("Copyright © 2018")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("873646b3-e712-43d8-ab84-a3c1ef3f04a6")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
| {
"content_hash": "36dcb7dcaa13bc51843790915599ec93",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 82,
"avg_line_length": 32.114285714285714,
"alnum_prop": 0.7544483985765125,
"repo_name": "Cayan-LLC/developer-docs",
"id": "83caa7606f9cc7d57214feedf2f0e83bc5f01586",
"size": "1127",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/merchantware/Credit/vb/RefundKeyed/RefundKeyed/My Project/AssemblyInfo.vb",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
// Copyright 2007-2015 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
namespace MassTransit.QuartzIntegration.Configuration
{
using System.Collections.Generic;
using Builders;
using Configurators;
using Quartz;
public class InMemorySchedulerBusFactorySpecification :
IBusFactorySpecification
{
readonly IScheduler _scheduler;
public InMemorySchedulerBusFactorySpecification(IScheduler scheduler)
{
_scheduler = scheduler;
}
public IEnumerable<ValidationResult> Validate()
{
yield break;
}
public void Apply(IBusBuilder builder)
{
var observer = new InMemorySchedulerBusObserver(_scheduler);
builder.ConnectBusObserver(observer);
}
}
} | {
"content_hash": "84905d90c360d6996aa30bf32a8c8a13",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 82,
"avg_line_length": 32.93023255813954,
"alnum_prop": 0.6680790960451978,
"repo_name": "D3-LucaPiombino/MassTransit",
"id": "ac5b2a11ece5fc22c766abaa16c4df0aef7c3768",
"size": "1418",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "src/MassTransit.QuartzIntegration/Configuration/InMemorySchedulerBusFactorySpecification.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1897"
},
{
"name": "C#",
"bytes": "4284861"
},
{
"name": "F#",
"bytes": "14240"
},
{
"name": "PowerShell",
"bytes": "3099"
}
],
"symlink_target": ""
} |
'use strict';
angular.module('PortfolioViewer.version.interpolate-filter', [])
.filter('interpolate', ['version', function(version) {
return function(text) {
return String(text).replace(/\%VERSION\%/mg, version);
};
}]);
| {
"content_hash": "51cf061d66356a05718b64292931e7cd",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 64,
"avg_line_length": 25.666666666666668,
"alnum_prop": 0.6796536796536796,
"repo_name": "d-h-morrison/PortfolioViewer",
"id": "e8d32202499ca00d429317338b2fd6fc52a95b4f",
"size": "231",
"binary": false,
"copies": "1",
"ref": "refs/heads/PV.Main-06-08-15",
"path": "app/components/version/interpolate-filter.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "366"
},
{
"name": "HTML",
"bytes": "5217"
},
{
"name": "JavaScript",
"bytes": "5428"
}
],
"symlink_target": ""
} |
UAnimationGraph::UAnimationGraph(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
#undef LOCTEXT_NAMESPACE
| {
"content_hash": "17b3ae9b4a31fec5996b849a45cc8354",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 77,
"avg_line_length": 19.571428571428573,
"alnum_prop": 0.8248175182481752,
"repo_name": "PopCap/GameIdea",
"id": "5748a532a2327ecf9d18930e34f7ae0cfe2b277e",
"size": "379",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Engine/Source/Editor/AnimGraph/Private/AnimationGraph.cpp",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "ASP",
"bytes": "238055"
},
{
"name": "Assembly",
"bytes": "184134"
},
{
"name": "Batchfile",
"bytes": "116983"
},
{
"name": "C",
"bytes": "84264210"
},
{
"name": "C#",
"bytes": "9612596"
},
{
"name": "C++",
"bytes": "242290999"
},
{
"name": "CMake",
"bytes": "548754"
},
{
"name": "CSS",
"bytes": "134910"
},
{
"name": "GLSL",
"bytes": "96780"
},
{
"name": "HLSL",
"bytes": "124014"
},
{
"name": "HTML",
"bytes": "4097051"
},
{
"name": "Java",
"bytes": "757767"
},
{
"name": "JavaScript",
"bytes": "2742822"
},
{
"name": "Makefile",
"bytes": "1976144"
},
{
"name": "Objective-C",
"bytes": "75778979"
},
{
"name": "Objective-C++",
"bytes": "312592"
},
{
"name": "PAWN",
"bytes": "2029"
},
{
"name": "PHP",
"bytes": "10309"
},
{
"name": "PLSQL",
"bytes": "130426"
},
{
"name": "Pascal",
"bytes": "23662"
},
{
"name": "Perl",
"bytes": "218656"
},
{
"name": "Python",
"bytes": "21593012"
},
{
"name": "SAS",
"bytes": "1847"
},
{
"name": "Shell",
"bytes": "2889614"
},
{
"name": "Tcl",
"bytes": "1452"
}
],
"symlink_target": ""
} |
package com.bkav.training.week2new.session4_3;
public class MovableRectangle implements Movable{
private MovablePoint point1;
private MovablePoint point2;
public MovableRectangle(int x1, int y1, int x2, int y2, int xSpeed, int ySpeed) {
point1 = new MovablePoint(x1, y1, xSpeed, ySpeed);
point2 = new MovablePoint(x2, y2, xSpeed, ySpeed);
}
@Override
public void moveUp() {
point1.y -= point1.ySpeed;
point2.y -= point2.ySpeed;
}
@Override
public void moveDown() {
point1.y += point1.ySpeed;
point2.y += point2.ySpeed;
}
@Override
public void moveLeft() {
point1.x -= point1.xSpeed;
point2.x -= point2.xSpeed;
}
@Override
public void moveRight() {
point1.x += point1.xSpeed;
point2.x += point2.xSpeed;
}
@Override
public String toString() {
return "Hình chữ nhật điểm 1 :" + point1.toString() + " điểm 2 :" + point2.toString();
}
}
| {
"content_hash": "a4b95396f47590fe96aacf4ebcd8172c",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 88,
"avg_line_length": 24.47222222222222,
"alnum_prop": 0.6867196367763905,
"repo_name": "anhtrungbk55/JavaTraining",
"id": "d12c158b41b5e4891703bee7d16fcd0f2803aaba",
"size": "892",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Documents/workspace/JavaTraining/src/com/bkav/training/week2new/session4_3/MovableRectangle.java",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Java",
"bytes": "103925"
}
],
"symlink_target": ""
} |
var assert = require('assert')
, util = require('util')
;
for (var thing in assert) {
exports[thing] = assert[thing];
}
exports.TestTimer = function(timeout, expected_hits, done_callback) {
var self = this;
self.timeoutId = setTimeout(function() {
assert.ok(false, "Timeout: Only " + self.hits + " of " + expected_hits
+ " hits seen within " + (timeout/1000) + " seconds.");
}, timeout);
self.expected_hits = expected_hits;
self.hits = 0;
self.messages = [];
self.callback = done_callback;
process.on('exit', function() {
assert.strictEqual(self.expected_hits, self.hits);
});
}
exports.TestTimer.prototype.passed = function(msg) {
this.hits += 1;
this.messages.push(msg);
if (this.hits === this.expected_hits) {
clearTimeout(this.timeoutId);
this.callback();
}
}
| {
"content_hash": "b4397ac39ffff2a888cc00f3ea7876dd",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 74,
"avg_line_length": 24.939393939393938,
"alnum_prop": 0.6427703523693803,
"repo_name": "agnat/node_libdbus",
"id": "eb9a82376a028726b3f6da8d13ffb144acc2ab9a",
"size": "823",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/test_tools.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "78664"
},
{
"name": "JavaScript",
"bytes": "16572"
}
],
"symlink_target": ""
} |
import mimetypes
import os
import re
from pathlib import Path
from typing import Match
from typing import Optional
from typing import Tuple
from typing import Union
from zlib import adler32
from flask import abort
from flask import Blueprint
from flask import current_app
from flask import render_template
from flask import request
from flask import Response
from flask import send_file
from flask import url_for
from flask.typing import ResponseReturnValue
from werkzeug.exceptions import NotFound
from werkzeug.security import safe_join
from werkzeug.utils import append_slash_redirect
from lektor.admin.context import get_lektor_context
from lektor.admin.context import LektorApp
from lektor.admin.context import LektorContext
from lektor.assets import Asset
from lektor.assets import Directory
from lektor.builder import Artifact
from lektor.buildfailures import BuildFailure
from lektor.constants import PRIMARY_ALT
from lektor.db import Record
from lektor.sourceobj import SourceObject
bp = Blueprint("serve", __name__)
Filename = Union[str, os.PathLike]
def _rewrite_html_for_editing(
html: bytes, edit_url: str, artifact_name: Optional[str] = None
) -> bytes:
"""Adds an "edit pencil" button to the text of an HTML page.
The pencil will link to ``edit_url``.
"""
button = render_template("edit-button.html", edit_url=edit_url)
if "livereload" in current_app.blueprints:
button += render_template("livereload.html", artifact_name=artifact_name)
def extras(m: Match[bytes]) -> bytes:
return button.encode("utf-8") + m.group(0)
return re.sub(rb"(?i)</\s*head\s*>|\Z", extras, html, count=1)
def _send_html_for_editing(
artifact: Artifact, edit_url: str, mimetype: str = "text/html"
) -> Response:
"""Serve an HTML file, after mangling it to add an "edit pencil" button."""
try:
with open(artifact.dst_filename, "rb") as fp:
html = fp.read()
st = os.stat(fp.fileno())
except (FileNotFoundError, IsADirectoryError, PermissionError):
abort(404)
html = _rewrite_html_for_editing(html, edit_url, artifact.artifact_name)
check = adler32(f"{artifact.dst_filename}\0{edit_url}".encode("utf-8")) & 0xFFFFFFFF
resp = Response(html, mimetype=mimetype)
resp.set_etag(f"{st.st_mtime}-{st.st_size}-{check}")
return resp
def _deduce_mimetype(filename: Filename) -> str:
mimetype = mimetypes.guess_type(filename)[0]
if mimetype is None:
mimetype = "application/octet-stream"
return mimetype
def _checked_send_file(filename: Filename, mimetype: Optional[str] = None) -> Response:
"""Same as flask.send_file, except raises NotFound on file errors."""
# NB: flask.send_file interprets relative paths relative to
# current_app.root_path. We don't want that.
try:
resp = send_file(os.path.abspath(filename), mimetype=mimetype)
except (FileNotFoundError, IsADirectoryError, PermissionError):
abort(404)
return resp
class HiddenRecordException(NotFound):
"""Exception thrown when a request is made for a hidden page."""
def __init__(self, source: SourceObject) -> None:
super().__init__(description=f"Record is hidden: {source!r}")
self.source = source
class ArtifactServer:
"""Resolve url_path to a Lektor source object, build it, serve the result.
Redirects to slash-appended path if appropriate.
Raises NotFound if source object can not be resolved, or if it does not
produce an artifact.
"""
def __init__(self, lektor_context: LektorContext) -> None:
self.lektor_ctx = lektor_context
def resolve_url_path(self, url_path: str) -> SourceObject:
"""Resolve URL path to a source object.
Raise NotFound if resolution fails.
"""
source = self.lektor_ctx.pad.resolve_url_path(url_path, include_invisible=True)
if source is None:
abort(404)
return source
@staticmethod
def resolve_directory_index(directory: Directory) -> Asset:
"""Find an index.html (or equivalent) asset for a Directory asset
Raise NotFound if no index is found.
"""
for name in "index.html", "index.htm":
index = directory.get_child(name, from_url=True)
if index is not None:
break
else:
abort(404)
return index
def build_primary_artifact(
self, source: SourceObject
) -> Tuple[Artifact, Optional[BuildFailure]]:
"""Build source object, return primary artifact.
If the build was successfull, returns a tuple of (artifact, ``None``).
If the build failed, returns a tuple of (artifact, failure),
where failure is an instance of ``BuildFailure`` which
contains information regarding the failure.
Raises NotFound if no primary artifact is produced by the build process.
"""
lektor_ctx = self.lektor_ctx
with lektor_ctx.cli_reporter():
prog, _ = lektor_ctx.builder.build(source)
artifact = prog.primary_artifact
if artifact is None:
abort(404)
failure = lektor_ctx.failure_controller.lookup_failure(artifact.artifact_name)
return artifact, failure
@staticmethod
def handle_build_failure(
failure: BuildFailure, edit_url: Optional[str] = None
) -> Response:
"""Format build failure to an HTML response."""
html = render_template("build-failure.html", **failure.data).encode("utf-8")
if edit_url is not None:
html = _rewrite_html_for_editing(html, edit_url)
return Response(html, mimetype="text/html")
def get_edit_url(self, source: SourceObject) -> Optional[str]:
primary_alternative = self.lektor_ctx.config.primary_alternative
if not isinstance(source, Record):
# Asset or VirtualSourceObject — not editable
return None
record = source.record
alt = (
record.alt if record.alt not in (PRIMARY_ALT, primary_alternative) else None
)
return url_for("url.edit", path=record.path, alt=alt)
def serve_artifact(self, url_path: str) -> Response:
source = self.resolve_url_path(url_path)
# If the request path does not end with a slash but we
# requested a URL that actually wants a trailing slash, we
# append it. This is consistent with what apache and nginx do
# and it ensures our relative urls work.
if (
not url_path.endswith("/")
and source.url_path.endswith("/")
and source.url_path != "/"
):
return append_slash_redirect(request.environ)
if source.is_hidden:
raise HiddenRecordException(source)
if isinstance(source, Directory):
# Special case for asset directories: resolve to index.html
source = self.resolve_directory_index(source)
edit_url = self.get_edit_url(source)
artifact, failure = self.build_primary_artifact(source)
# If there was a build failure for the given artifact, we want
# to render this instead of sending the (most likely missing or
# corrupted) file.
if failure is not None:
return self.handle_build_failure(failure, edit_url)
mimetype = _deduce_mimetype(artifact.dst_filename)
if mimetype == "text/html" and edit_url is not None:
return _send_html_for_editing(artifact, edit_url, mimetype)
return _checked_send_file(artifact.dst_filename, mimetype=mimetype)
def serve_artifact(path: str) -> Response:
lektor_context = get_lektor_context()
return ArtifactServer(lektor_context).serve_artifact(path)
def serve_file(path: str) -> Response:
"""Serve file directly from Lektor's output directory."""
assert isinstance(current_app, LektorApp)
output_path = current_app.lektor_info.output_path
safe_path = safe_join("", *(path.strip("/").split("/")))
if safe_path is None:
abort(404)
filename = Path(output_path, safe_path) # converts safe_path to native path seps
if filename.is_dir():
if not path.endswith("/"):
return append_slash_redirect(request.environ)
for index in filename / "index.html", filename / "index.htm":
if index.is_file():
return _checked_send_file(index, mimetype="text/html")
abort(404)
return _checked_send_file(filename, mimetype=_deduce_mimetype(filename.name))
@bp.route("/", defaults={"path": ""})
@bp.route("/<path:path>")
def serve_artifact_or_file(path: str) -> Response:
try:
return serve_artifact(path)
except HiddenRecordException:
raise
except NotFound:
return serve_file(path)
@bp.errorhandler(404)
def serve_error_page(error: NotFound) -> ResponseReturnValue:
try:
return serve_artifact("404.html"), 404
except NotFound:
return error
| {
"content_hash": "998131aa09ebae1e140fa6e1b470c8b0",
"timestamp": "",
"source": "github",
"line_count": 259,
"max_line_length": 88,
"avg_line_length": 34.826254826254825,
"alnum_prop": 0.6624168514412417,
"repo_name": "lektor/lektor",
"id": "d5781a81ece107291fba31a2aae98f3d8b512a3d",
"size": "9022",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lektor/admin/modules/serve.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "2475"
},
{
"name": "HTML",
"bytes": "29220"
},
{
"name": "JavaScript",
"bytes": "1480"
},
{
"name": "Makefile",
"bytes": "1101"
},
{
"name": "Python",
"bytes": "721680"
},
{
"name": "SCSS",
"bytes": "10560"
},
{
"name": "TypeScript",
"bytes": "145010"
}
],
"symlink_target": ""
} |
extern "C" {
#include <ovsdb_wrapper.h>
};
#include <ovs_tor_agent/tor_agent_init.h>
#include <ovsdb_client.h>
#include <ovsdb_route_peer.h>
#include <ovsdb_client_connection_state.h>
#include <ha_stale_dev_vn.h>
#include <ha_stale_vn.h>
#include <ha_stale_l2_route.h>
#include <oper/physical_device_vn.h>
#include <oper/vn.h>
#include <oper/vrf.h>
#include <oper/nexthop.h>
#include <oper/tunnel_nh.h>
#include <oper/agent_path.h>
#include <oper/bridge_route.h>
#include <ovsdb_sandesh.h>
#include <ovsdb_types.h>
using namespace OVSDB;
HaStaleDevVnEntry::HaStaleDevVnEntry(OvsdbDBObject *table,
const boost::uuids::uuid &vn_uuid) : OvsdbDBEntry(table),
vn_uuid_(vn_uuid), l2_table_(NULL), old_l2_table_(NULL),
oper_bridge_table_(NULL), dev_ip_(), vn_name_(""), vxlan_id_(0) {
}
HaStaleDevVnEntry::~HaStaleDevVnEntry() {
assert(l2_table_ == NULL);
assert(old_l2_table_ == NULL);
}
bool HaStaleDevVnEntry::Add() {
// if table is scheduled for delete, return from here
// and wait for delete callback
if (table_->delete_scheduled()) {
return true;
}
bool ret = true;
// On device ip, vxlan id or Agent Route Table pointer change delete
// previous route table and add new with updated vxlan id
if (l2_table_ != NULL &&
l2_table_->GetDBTable() != oper_bridge_table_) {
ret = Delete();
}
// create route table and register
if (l2_table_ == NULL) {
l2_table_ = new HaStaleL2RouteTable(this, oper_bridge_table_);
}
// trigger update params for L2 Table to pick new vxlan id / tor ip
l2_table_->UpdateParams(this);
return ret;
}
bool HaStaleDevVnEntry::Change() {
return Add();
}
bool HaStaleDevVnEntry::Delete() {
// delete route table.
if (l2_table_ != NULL) {
l2_table_->DeleteTable();
assert(old_l2_table_ == NULL);
old_l2_table_ = l2_table_;
l2_table_ = NULL;
return false;
}
return true;
}
bool HaStaleDevVnEntry::Sync(DBEntry *db_entry) {
bool change = false;
// check if route table is available.
const PhysicalDeviceVn *dev_vn =
static_cast<const PhysicalDeviceVn *>(db_entry);
const VrfEntry *vrf = dev_vn->vn()->GetVrf();
if (vrf == NULL) {
// trigger change and wait for VRF
oper_bridge_table_ = NULL;
change = true;
} else if (oper_bridge_table_ != vrf->GetBridgeRouteTable()) {
oper_bridge_table_ = vrf->GetBridgeRouteTable();
change = true;
}
if (dev_ip_ != dev_vn->tor_ip()) {
dev_ip_ = dev_vn->tor_ip();
change = true;
}
if (vn_name_ != dev_vn->vn()->GetName()) {
vn_name_ = dev_vn->vn()->GetName();
change = true;
}
if (vxlan_id_ != (uint32_t)dev_vn->vxlan_id()) {
vxlan_id_ = dev_vn->vxlan_id();
change = true;
}
return change;
}
bool HaStaleDevVnEntry::IsLess(const KSyncEntry &entry) const {
const HaStaleDevVnEntry &dev_vn_entry =
static_cast<const HaStaleDevVnEntry &>(entry);
return vn_uuid_ < dev_vn_entry.vn_uuid_;
}
KSyncEntry* HaStaleDevVnEntry::UnresolvedReference() {
HaStaleDevVnTable *table =
static_cast<HaStaleDevVnTable *>(table_);
HaStaleVnEntry key(table->vn_table_, vn_uuid_);
HaStaleVnEntry *entry = static_cast<HaStaleVnEntry*>
(table->vn_table_->GetReference(&key));
// Wait for vn-vrf link
if (!entry->IsResolved()) {
return entry;
}
if (oper_bridge_table_ == NULL) {
// update route table when vn-vrf link is available
oper_bridge_table_ = entry->bridge_table();
}
if (vn_name_.empty()) {
// update vn name from vn if available
vn_name_ = entry->vn_name();
}
return NULL;
}
void HaStaleDevVnEntry::TriggerAck(HaStaleL2RouteTable *table) {
OvsdbDBObject *object = static_cast<OvsdbDBObject*>(GetObject());
assert(old_l2_table_ == table);
if (l2_table_ != NULL) {
old_l2_table_ = NULL;
object->NotifyEvent(this, KSyncEntry::ADD_ACK);
} else {
old_l2_table_ = NULL;
object->NotifyEvent(this, KSyncEntry::DEL_ACK);
}
}
Agent *HaStaleDevVnEntry::agent() const {
const HaStaleDevVnTable *reflector_table =
static_cast<const HaStaleDevVnTable *>(table_);
return reflector_table->agent();
}
OvsPeer *HaStaleDevVnEntry::route_peer() const {
const HaStaleDevVnTable *reflector_table =
static_cast<const HaStaleDevVnTable *>(table_);
return reflector_table->route_peer();
}
const std::string &HaStaleDevVnEntry::dev_name() const {
const HaStaleDevVnTable *reflector_table =
static_cast<const HaStaleDevVnTable *>(table_);
return reflector_table->dev_name();
}
ConnectionStateEntry *HaStaleDevVnEntry::state() const {
const HaStaleDevVnTable *reflector_table =
static_cast<const HaStaleDevVnTable *>(table_);
return reflector_table->state();
}
IpAddress HaStaleDevVnEntry::dev_ip() const {
return dev_ip_;
}
const std::string &HaStaleDevVnEntry::vn_name() const {
return vn_name_;
}
uint32_t HaStaleDevVnEntry::vxlan_id() const {
return vxlan_id_;
}
HaStaleDevVnTable::HaStaleDevVnTable(Agent *agent,
OvsPeerManager *manager, ConnectionStateEntry *state,
std::string &dev_name) :
OvsdbDBObject(NULL, false), agent_(agent), manager_(manager),
dev_name_(dev_name), state_(state),
vn_table_(new HaStaleVnTable(agent, this)), time_stamp_(1),
stale_clear_timer_(TimerManager::CreateTimer(
*(agent->event_manager())->io_service(),
"OVSDB Route Replicator cleanup timer",
agent->task_scheduler()->GetTaskId("Agent::KSync"), 0)) {
vn_reeval_queue_ = new WorkQueue<boost::uuids::uuid>(
agent->task_scheduler()->GetTaskId("Agent::KSync"), 0,
boost::bind(&HaStaleDevVnTable::VnReEval, this, _1));
vn_reeval_queue_->set_name("OVSDB VN re-evaluation queue");
Ip4Address zero_ip;
route_peer_.reset(manager->Allocate(zero_ip));
route_peer_->set_ha_stale_export(true);
OvsdbRegisterDBTable((DBTable *)agent->physical_device_vn_table());
}
HaStaleDevVnTable::~HaStaleDevVnTable() {
// validate vn_table and vn_reeval_queue are deleted
// before the destuctor is called
assert(vn_table_ == NULL && vn_reeval_queue_ == NULL);
// Cancel timer if running
stale_clear_timer_->Cancel();
TimerManager::DeleteTimer(stale_clear_timer_);
manager_->Free(route_peer_.release());
}
KSyncEntry *HaStaleDevVnTable::Alloc(const KSyncEntry *key, uint32_t index) {
const HaStaleDevVnEntry *k_entry =
static_cast<const HaStaleDevVnEntry *>(key);
HaStaleDevVnEntry *entry = new HaStaleDevVnEntry(this, k_entry->vn_uuid_);
return entry;
}
KSyncEntry *HaStaleDevVnTable::DBToKSyncEntry(const DBEntry* db_entry) {
const PhysicalDeviceVn *entry =
static_cast<const PhysicalDeviceVn *>(db_entry);
HaStaleDevVnEntry *key =
new HaStaleDevVnEntry(this, entry->vn()->GetUuid());
return static_cast<KSyncEntry *>(key);
}
KSyncDBObject::DBFilterResp HaStaleDevVnTable::OvsdbDBEntryFilter(
const DBEntry *entry, const OvsdbDBEntry *ovsdb_entry) {
const PhysicalDeviceVn *dev_vn =
static_cast<const PhysicalDeviceVn *>(entry);
// Delete the entry which has invalid VxLAN id associated.
if (dev_vn->vxlan_id() == 0) {
return DBFilterDelete;
}
// Accept only devices with name matched to dev_name_
if (dev_vn->device_display_name() != dev_name_) {
return DBFilterDelete;
}
if (vn_table_ == NULL) {
// delete table delete notify the entry
return DBFilterDelete;
}
return DBFilterAccept;
}
Agent *HaStaleDevVnTable::agent() const {
return agent_;
}
void HaStaleDevVnTable::DeleteTableDone() {
if (vn_table_ != NULL) {
vn_table_->DeleteTable();
vn_table_ = NULL;
}
if (vn_reeval_queue_ != NULL) {
vn_reeval_queue_->Shutdown();
delete vn_reeval_queue_;
vn_reeval_queue_ = NULL;
}
}
void HaStaleDevVnTable::EmptyTable() {
OvsdbDBObject::EmptyTable();
// unregister the object if emptytable is called with
// object being scheduled for delete
if (delete_scheduled()) {
KSyncObjectManager::Unregister(this);
}
}
void HaStaleDevVnTable::VnReEvalEnqueue(const boost::uuids::uuid &vn_uuid) {
// vn_reeval_queue_ will be NULL if delete of the table
// is already triggered
if (vn_reeval_queue_ != NULL) {
vn_reeval_queue_->Enqueue(vn_uuid);
}
}
bool HaStaleDevVnTable::VnReEval(const boost::uuids::uuid &vn_uuid) {
HaStaleDevVnEntry key(this, vn_uuid);
HaStaleDevVnEntry *entry =
static_cast<HaStaleDevVnEntry*>(Find(&key));
if (entry && !entry->IsDeleted()) {
Change(entry);
}
return true;
}
OvsPeer *HaStaleDevVnTable::route_peer() const {
return route_peer_.get();
}
const std::string &HaStaleDevVnTable::dev_name() const {
return dev_name_;
}
ConnectionStateEntry *HaStaleDevVnTable::state() const {
return state_.get();
}
void HaStaleDevVnTable::StaleClearAddEntry(uint64_t time_stamp,
HaStaleL2RouteEntry *entry,
StaleClearL2EntryCb cb) {
if (stale_l2_entry_map_.empty()) {
// start the timer while adding the first entry
stale_clear_timer_->Start(kStaleTimerJobInterval,
boost::bind(&HaStaleDevVnTable::StaleClearTimerCb, this));
}
StaleL2Entry l2_entry(time_stamp, entry);
stale_l2_entry_map_[l2_entry] = cb;
}
void HaStaleDevVnTable::StaleClearDelEntry(uint64_t time_stamp,
HaStaleL2RouteEntry *entry) {
StaleL2Entry l2_entry(time_stamp, entry);
stale_l2_entry_map_.erase(l2_entry);
if (stale_l2_entry_map_.empty()) {
// stop the timer on last entry removal
stale_clear_timer_->Cancel();
}
}
bool HaStaleDevVnTable::StaleClearTimerCb() {
uint32_t count = 0;
time_stamp_++;
uint32_t timer =
agent_->ovsdb_client()->ha_stale_route_interval()/kStaleTimerJobInterval;
while (!stale_l2_entry_map_.empty() && count < kNumEntriesPerIteration) {
CbMap::iterator it = stale_l2_entry_map_.begin();
if (time_stamp_ - it->first.time_stamp < timer) {
// first entry is yet to age
break;
}
StaleClearL2EntryCb cb = it->second;
cb();
count++;
}
if (stale_l2_entry_map_.empty()) {
// do not restart the timer if all entries are removed
return false;
}
return true;
}
/////////////////////////////////////////////////////////////////////////////
// Sandesh routines
/////////////////////////////////////////////////////////////////////////////
HaStaleDevVnSandeshTask::HaStaleDevVnSandeshTask(
std::string resp_ctx, AgentSandeshArguments &args) :
OvsdbSandeshTask(resp_ctx, args), dev_name_(""), vn_uuid_("") {
if (false == args.Get("dev_name", &dev_name_)) {
dev_name_ = "";
}
if (false == args.Get("vn_uuid", &vn_uuid_)) {
vn_uuid_ = "";
}
}
HaStaleDevVnSandeshTask::HaStaleDevVnSandeshTask(std::string resp_ctx,
const std::string &dev_name,
const std::string &vn_uuid) :
OvsdbSandeshTask(resp_ctx, "0.0.0.0", 0), dev_name_(dev_name), vn_uuid_(vn_uuid) {
}
HaStaleDevVnSandeshTask::~HaStaleDevVnSandeshTask() {
}
void HaStaleDevVnSandeshTask::EncodeArgs(AgentSandeshArguments &args) {
if (!dev_name_.empty()) {
args.Add("dev_name", dev_name_);
}
if (!vn_uuid_.empty()) {
args.Add("vn_uuid", vn_uuid_);
}
}
OvsdbSandeshTask::FilterResp
HaStaleDevVnSandeshTask::Filter(KSyncEntry *kentry) {
if (!vn_uuid_.empty()) {
HaStaleDevVnEntry *entry = static_cast<HaStaleDevVnEntry *>(kentry);
if (UuidToString(entry->vn_uuid()).find(vn_uuid_) != std::string::npos) {
return FilterAllow;
}
return FilterDeny;
}
return FilterAllow;
}
void HaStaleDevVnSandeshTask::UpdateResp(KSyncEntry *kentry,
SandeshResponse *resp) {
HaStaleDevVnEntry *entry = static_cast<HaStaleDevVnEntry *>(kentry);
OvsdbHaStaleDevVnExport dentry;
dentry.set_state(entry->StateString());
dentry.set_dev_name(entry->dev_name());
dentry.set_dev_ip(entry->dev_ip().to_string());
dentry.set_vn_uuid(UuidToString(entry->vn_uuid()));
dentry.set_vn_name(entry->vn_name());
dentry.set_vxlan_id(entry->vxlan_id());
HaStaleL2RouteSandeshTask task("", entry->dev_name(),
UuidToString(entry->vn_uuid()), "");
dentry.set_l2_route_table(task.EncodeFirstPage());
OvsdbHaStaleDevVnExportResp *d_resp =
static_cast<OvsdbHaStaleDevVnExportResp *>(resp);
std::vector<OvsdbHaStaleDevVnExport> &dev_vn =
const_cast<std::vector<OvsdbHaStaleDevVnExport>&>(
d_resp->get_dev_vn());
dev_vn.push_back(dentry);
}
SandeshResponse *HaStaleDevVnSandeshTask::Alloc() {
return static_cast<SandeshResponse *>(new OvsdbHaStaleDevVnExportResp());
}
KSyncObject *HaStaleDevVnSandeshTask::GetObject(OvsdbClientSession *session) {
ConnectionStateTable *con_table =
Agent::GetInstance()->ovsdb_client()->connection_table();
ConnectionStateEntry *con_entry = con_table->Find(dev_name_);
if (con_entry == NULL) {
return NULL;
}
return static_cast<KSyncObject *>(con_entry->ha_stale_dev_vn_table());
}
void OvsdbHaStaleDevVnExportReq::HandleRequest() const {
HaStaleDevVnSandeshTask *task =
new HaStaleDevVnSandeshTask(context(), get_dev_name(),
get_vn_uuid());
TaskScheduler *scheduler = TaskScheduler::GetInstance();
scheduler->Enqueue(task);
}
| {
"content_hash": "2124d4acaf5d140daaacd6af797b50c8",
"timestamp": "",
"source": "github",
"line_count": 442,
"max_line_length": 86,
"avg_line_length": 31.74660633484163,
"alnum_prop": 0.6234321550741163,
"repo_name": "sajuptpm/contrail-controller",
"id": "693b226f9360965aedc7136b2338ba171fcf4de3",
"size": "14104",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/vnsw/agent/ovs_tor_agent/ovsdb_client/ha_stale_dev_vn.cc",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "51767"
},
{
"name": "C++",
"bytes": "19050770"
},
{
"name": "CSS",
"bytes": "531"
},
{
"name": "Groff",
"bytes": "36777"
},
{
"name": "HTML",
"bytes": "519766"
},
{
"name": "Java",
"bytes": "171966"
},
{
"name": "LLVM",
"bytes": "2937"
},
{
"name": "Lua",
"bytes": "5819"
},
{
"name": "Makefile",
"bytes": "12449"
},
{
"name": "Protocol Buffer",
"bytes": "6129"
},
{
"name": "Python",
"bytes": "4813021"
},
{
"name": "Shell",
"bytes": "81402"
},
{
"name": "Thrift",
"bytes": "40763"
},
{
"name": "Yacc",
"bytes": "7737"
}
],
"symlink_target": ""
} |
/* eslint-disable max-len */
/**
* WARNING: Do not include this file in client build.
*/
const DO_NOT_USE_THIS_FILE_IN_CLIENT = `
Configuration file contains sensitive information and
MUST NOT be included in the client build.
`;
if (process.env.BROWSER) {
alert(DO_NOT_USE_THIS_FILE_IN_CLIENT); // eslint-disable-line no-alert
throw new Error(DO_NOT_USE_THIS_FILE_IN_CLIENT);
}
export const port = process.env.PORT || 3000;
export const host = process.env.WEBSITE_HOSTNAME || `localhost:${port}`;
export const databaseUrl = process.env.DATABASE_URL || 'sqlite:database.sqlite';
export const analytics = {
// https://analytics.google.com/
google: { trackingId: process.env.GOOGLE_TRACKING_ID || 'UA-XXXXX-X' },
};
export const auth = {
jwt: { secret: process.env.JWT_SECRET || 'React Starter Kit' },
// https://developers.facebook.com/
facebook: {
id: process.env.FACEBOOK_APP_ID || '186244551745631',
secret: process.env.FACEBOOK_APP_SECRET || 'a970ae3240ab4b9b8aae0f9f0661c6fc',
},
// https://cloud.google.com/console/project
google: {
id: process.env.GOOGLE_CLIENT_ID || '251410730550-ahcg0ou5mgfhl8hlui1urru7jn5s12km.apps.googleusercontent.com',
secret: process.env.GOOGLE_CLIENT_SECRET || 'Y8yR9yZAhm9jQ8FKAL8QIEcd',
},
// https://apps.twitter.com/
twitter: {
key: process.env.TWITTER_CONSUMER_KEY || 'Ie20AZvLJI2lQD5Dsgxgjauns',
secret: process.env.TWITTER_CONSUMER_SECRET || 'KTZ6cxoKnEakQCeSpZlaUCJWGAlTEBJj0y2EMkUBujA7zWSvaQ',
},
};
| {
"content_hash": "bfb68c9ca8677b67c3da1f3ece7bacf1",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 119,
"avg_line_length": 30.03846153846154,
"alnum_prop": 0.6895006402048656,
"repo_name": "Nexapp/react-starter-kit",
"id": "4de1f2aa3912f2e05b17535a812b63273652ca1e",
"size": "1823",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/config.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "14712"
},
{
"name": "JavaScript",
"bytes": "58699"
}
],
"symlink_target": ""
} |
package org.springframework.data.jpa.domain.sample;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.jpa.repository.sample.AuditableUserRepository;
import org.springframework.util.Assert;
/**
* Stub implementation for {@link AuditorAware}. Returns {@literal null} for the current auditor.
*
* @author Oliver Gierke
*/
public class AuditorAwareStub implements AuditorAware<AuditableUser> {
@SuppressWarnings("unused")
private final AuditableUserRepository repository;
private AuditableUser auditor;
public AuditorAwareStub(AuditableUserRepository repository) {
Assert.notNull(repository);
this.repository = repository;
}
public void setAuditor(AuditableUser auditor) {
this.auditor = auditor;
}
/*
* (non-Javadoc)
*
* @see org.springframework.data.domain.AuditorAware#getCurrentAuditor()
*/
public AuditableUser getCurrentAuditor() {
return auditor;
}
}
| {
"content_hash": "9361dfab1ecba4c1c2b50529bfb8f1da",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 97,
"avg_line_length": 23.871794871794872,
"alnum_prop": 0.7755102040816326,
"repo_name": "sdw2330976/Research-spring-data-jpa",
"id": "34c39eabe2f2d842d1c7df013d59d1fe02738d24",
"size": "1551",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spring-data-jpa-1.7.1.RELEASE/src/test/java/org/springframework/data/jpa/domain/sample/AuditorAwareStub.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "866967"
}
],
"symlink_target": ""
} |
<?php
namespace Jiyis\CoreTemplates;
use Illuminate\Support\ServiceProvider;
class CoreTemplatesServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
$this->loadViewsFrom(__DIR__.'/../views', 'core-templates');
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
}
}
| {
"content_hash": "88206b7f8403fa56623108f6679db751",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 68,
"avg_line_length": 17.25925925925926,
"alnum_prop": 0.5987124463519313,
"repo_name": "jiyis/template",
"id": "604128caf8ff28deacc18c56cdde5551408990fc",
"size": "466",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/CoreTemplatesServiceProvider.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "780"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2002-2022 CS GROUP
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="Orekit">
<bannerLeft>
<name>CS GROUP</name>
<src>/images/logo_cs_group.png</src>
<href>https://www.csgroup.eu/en/</href>
</bannerLeft>
<bannerRight>
<name>Orekit</name>
<src>/images/orekit-logo.png</src>
<href>/index.html</href>
</bannerRight>
<body>
<menu name="Orekit">
<item name="Overview" href="/index.html" />
<item name="Getting the sources" href="/sources.html" />
<item name="Building" href="/building.html" />
<item name="FAQ" href="/faq.html" />
<item name="License" href="/licenses.html" />
<item name="Downloads" href="/downloads.html" />
<item name="Changes" href="/changes-report.html" />
<item name="Contact" href="/contact.html" />
</menu>
<menu name="Data">
<item name="Contexts" href="/data/contexts.html" />
<item name="Default configuration" href="/data/default-configuration.html" />
<item name="Application data" href="/data/application-data.html" />
<item name="Filtering" href="/data/filtering.html" />
<item name="Custom filters" href="/data/custom-filters.html" />
<item name="Supported data types" href="/data/supported-data-types.html" />
</menu>
<menu name="Architecture">
<item name="Attitudes" href="/architecture/attitudes.html" />
<item name="Bodies" href="/architecture/bodies.html" />
<item name="CCSDS" href="/architecture/ccsds.html" />
<item name="Errors" href="/architecture/errors.html" />
<item name="Estimation" href="/architecture/estimation.html" />
<item name="Forces" href="/architecture/forces.html" />
<item name="Frames" href="/architecture/frames.html" />
<item name="GNSS" href="/architecture/gnss.html" />
<item name="Orbits" href="/architecture/orbits.html" />
<item name="Maneuvers" href="/architecture/maneuvers.html" />
<item name="Propagation" href="/architecture/propagation.html" />
<item name="Time" href="/architecture/time.html" />
<item name="Tessellation" href="/architecture/tessellation.html" />
<item name="Tle" href="/architecture/tle.html" />
<item name="Utils" href="/architecture/utils.html" />
</menu>
<menu name="Development">
<item name="Contributing" href="/contributing.html" />
<item name="Guidelines" href="/guidelines.html" />
<item name="Javadoc" href="/apidocs/index.html" />
<item name="Release guide" href="/release-guide.html" />
</menu>
<menu ref="reports"/>
</body>
</project>
| {
"content_hash": "361cf4e701e0b204393048685dbc7817",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 84,
"avg_line_length": 51.352112676056336,
"alnum_prop": 0.5682940208447613,
"repo_name": "CS-SI/Orekit",
"id": "0ba16f52050b2109f778f4d567e7b3d6331503c3",
"size": "3646",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/site/site.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Fortran",
"bytes": "7408"
},
{
"name": "HTML",
"bytes": "19673"
},
{
"name": "Java",
"bytes": "25367949"
},
{
"name": "Roff",
"bytes": "31072"
},
{
"name": "XSLT",
"bytes": "734"
}
],
"symlink_target": ""
} |
class ILStubMarshalHome
{
public:
typedef enum
{
HomeType_Unspecified = 0,
HomeType_ILLocal = 1,
HomeType_ILArgument = 2,
HomeType_ILByrefLocal = 3,
HomeType_ILByrefArgument = 4
} MarshalHomeType;
private:
MarshalHomeType m_homeType;
DWORD m_dwHomeIndex;
public:
void InitHome(MarshalHomeType homeType, DWORD dwHomeIndex)
{
LIMITED_METHOD_CONTRACT;
m_homeType = homeType;
m_dwHomeIndex = dwHomeIndex;
}
void EmitLoadHome(ILCodeStream* pslILEmit)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;
switch (m_homeType)
{
case HomeType_ILLocal: pslILEmit->EmitLDLOC(m_dwHomeIndex); break;
case HomeType_ILArgument: pslILEmit->EmitLDARG(m_dwHomeIndex); break;
default:
UNREACHABLE_MSG("unexpected homeType passed to EmitLoadHome");
break;
}
}
void EmitLoadHomeAddr(ILCodeStream* pslILEmit)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;
switch (m_homeType)
{
case HomeType_ILLocal: pslILEmit->EmitLDLOCA(m_dwHomeIndex); break;
case HomeType_ILArgument: pslILEmit->EmitLDARGA(m_dwHomeIndex); break;
case HomeType_ILByrefLocal: pslILEmit->EmitLDLOC(m_dwHomeIndex); break;
case HomeType_ILByrefArgument: pslILEmit->EmitLDARG(m_dwHomeIndex); break;
default:
UNREACHABLE_MSG("unexpected homeType passed to EmitLoadHomeAddr");
break;
}
}
void EmitStoreHome(ILCodeStream* pslILEmit)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;
switch (m_homeType)
{
case HomeType_ILLocal: pslILEmit->EmitSTLOC(m_dwHomeIndex); break;
case HomeType_ILArgument: pslILEmit->EmitSTARG(m_dwHomeIndex); break;
default:
UNREACHABLE_MSG("unexpected homeType passed to EmitStoreHome");
break;
}
}
void EmitStoreHomeAddr(ILCodeStream* pslILEmit)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;
switch (m_homeType)
{
case HomeType_ILByrefLocal: pslILEmit->EmitSTLOC(m_dwHomeIndex); break;
case HomeType_ILByrefArgument: pslILEmit->EmitSTARG(m_dwHomeIndex); break;
default:
UNREACHABLE_MSG("unexpected homeType passed to EmitStoreHomeAddr");
break;
}
}
void EmitCopyFromByrefArg(ILCodeStream* pslILEmit, LocalDesc* pManagedType, DWORD argidx)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;
CONSISTENCY_CHECK(pManagedType->cbType == 1);
if (pManagedType->IsValueClass())
{
EmitLoadHomeAddr(pslILEmit); // dest
pslILEmit->EmitLDARG(argidx); // src
pslILEmit->EmitCPOBJ(pslILEmit->GetToken(pManagedType->InternalToken));
}
else
{
pslILEmit->EmitLDARG(argidx);
pslILEmit->EmitLDIND_T(pManagedType);
EmitStoreHome(pslILEmit);
}
}
void EmitCopyToByrefArg(ILCodeStream* pslILEmit, LocalDesc* pManagedType, DWORD argidx)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;
if (pManagedType->IsValueClass())
{
pslILEmit->EmitLDARG(argidx); // dest
EmitLoadHomeAddr(pslILEmit); // src
pslILEmit->EmitCPOBJ(pslILEmit->GetToken(pManagedType->InternalToken));
}
else
{
pslILEmit->EmitLDARG(argidx);
EmitLoadHome(pslILEmit);
pslILEmit->EmitSTIND_T(pManagedType);
}
}
void EmitCopyToByrefArgWithNullCheck(ILCodeStream* pslILEmit, LocalDesc* pManagedType, DWORD argidx)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;
ILCodeLabel* pNullRefLabel = pslILEmit->NewCodeLabel();
// prevent null-ref exception by an explicit check
pslILEmit->EmitLDARG(argidx);
pslILEmit->EmitBRFALSE(pNullRefLabel);
EmitCopyToByrefArg(pslILEmit, pManagedType, argidx);
pslILEmit->EmitLabel(pNullRefLabel);
}
};
class ILMarshaler
{
protected:
#ifdef _DEBUG
const static UINT s_cbStackAllocThreshold = 128;
#else
const static UINT s_cbStackAllocThreshold = 2048;
#endif // _DEBUG
OverrideProcArgs* m_pargs;
NDirectStubLinker* m_pslNDirect;
ILCodeStream* m_pcsMarshal;
ILCodeStream* m_pcsUnmarshal;
UINT m_argidx;
DWORD m_dwMarshalFlags;
ILStubMarshalHome m_nativeHome;
ILStubMarshalHome m_managedHome;
DWORD m_dwMngdMarshalerLocalNum;
public:
ILMarshaler() :
m_pslNDirect(NULL)
{
}
virtual ~ILMarshaler()
{
LIMITED_METHOD_CONTRACT;
}
void SetNDirectStubLinker(NDirectStubLinker* pslNDirect)
{
LIMITED_METHOD_CONTRACT;
CONSISTENCY_CHECK(NULL == m_pslNDirect);
m_pslNDirect = pslNDirect;
}
void Init(ILCodeStream* pcsMarshal,
ILCodeStream* pcsUnmarshal,
UINT argidx,
DWORD dwMarshalFlags,
OverrideProcArgs* pargs)
{
LIMITED_METHOD_CONTRACT;
CONSISTENCY_CHECK_MSG(m_pslNDirect != NULL, "please call SetNDirectStubLinker() before EmitMarshalArgument or EmitMarshalReturnValue");
m_pcsMarshal = pcsMarshal;
m_pcsUnmarshal = pcsUnmarshal;
m_pargs = pargs;
m_dwMarshalFlags = dwMarshalFlags;
m_argidx = argidx;
m_dwMngdMarshalerLocalNum = -1;
}
protected:
static inline bool IsCLRToNative(DWORD dwMarshalFlags)
{
LIMITED_METHOD_CONTRACT;
return (0 != (dwMarshalFlags & MARSHAL_FLAG_CLR_TO_NATIVE));
}
static inline bool IsIn(DWORD dwMarshalFlags)
{
LIMITED_METHOD_CONTRACT;
return (0 != (dwMarshalFlags & MARSHAL_FLAG_IN));
}
static inline bool IsOut(DWORD dwMarshalFlags)
{
LIMITED_METHOD_CONTRACT;
return (0 != (dwMarshalFlags & MARSHAL_FLAG_OUT));
}
static inline bool IsByref(DWORD dwMarshalFlags)
{
LIMITED_METHOD_CONTRACT;
return (0 != (dwMarshalFlags & MARSHAL_FLAG_BYREF));
}
static inline bool IsHresultSwap(DWORD dwMarshalFlags)
{
LIMITED_METHOD_CONTRACT;
return (0 != (dwMarshalFlags & MARSHAL_FLAG_HRESULT_SWAP));
}
static inline bool IsRetval(DWORD dwMarshalFlags)
{
LIMITED_METHOD_CONTRACT;
return (0 != (dwMarshalFlags & MARSHAL_FLAG_RETVAL));
}
static inline bool IsHiddenLengthParam(DWORD dwMarshalFlags)
{
LIMITED_METHOD_CONTRACT;
return (0 != (dwMarshalFlags & MARSHAL_FLAG_HIDDENLENPARAM));
}
void EmitLoadManagedValue(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
m_managedHome.EmitLoadHome(pslILEmit);
}
void EmitLoadNativeValue(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
m_nativeHome.EmitLoadHome(pslILEmit);
}
void EmitLoadManagedHomeAddr(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
m_managedHome.EmitLoadHomeAddr(pslILEmit);
}
void EmitLoadNativeHomeAddr(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
m_nativeHome.EmitLoadHomeAddr(pslILEmit);
}
void EmitStoreManagedValue(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
m_managedHome.EmitStoreHome(pslILEmit);
}
void EmitStoreManagedHomeAddr(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
m_managedHome.EmitStoreHomeAddr(pslILEmit);
}
void EmitStoreNativeValue(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
m_nativeHome.EmitStoreHome(pslILEmit);
}
void EmitStoreNativeHomeAddr(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
m_nativeHome.EmitStoreHomeAddr(pslILEmit);
}
public:
virtual bool SupportsArgumentMarshal(DWORD dwMarshalFlags, UINT* pErrorResID)
{
LIMITED_METHOD_CONTRACT;
return true;
}
virtual bool SupportsReturnMarshal(DWORD dwMarshalFlags, UINT* pErrorResID)
{
LIMITED_METHOD_CONTRACT;
return true;
}
// True if marshaling creates data that could need cleanup.
bool NeedsMarshalCleanupIndex()
{
WRAPPER_NO_CONTRACT;
return (NeedsClearNative() || NeedsClearCLR());
}
// True if unmarshaling creates data that could need exception cleanup ("rollback").
bool NeedsUnmarshalCleanupIndex()
{
WRAPPER_NO_CONTRACT;
return (NeedsClearNative() && !IsCLRToNative(m_dwMarshalFlags));
}
void EmitMarshalArgument(
ILCodeStream* pcsMarshal,
ILCodeStream* pcsUnmarshal,
UINT argidx,
DWORD dwMarshalFlags,
OverrideProcArgs* pargs)
{
STANDARD_VM_CONTRACT;
Init(pcsMarshal, pcsUnmarshal, argidx, dwMarshalFlags, pargs);
// We could create the marshaler in the marshal stream right before it's needed (i.e. within the try block),
// or in the setup stream (outside of the try block). For managed-to-unmanaged marshaling it does not actually
// make much difference except that using setup stream saves us from cleaning up already-marshaled arguments
// in case of an exception. For unmanaged-to-managed, we may need to perform cleanup of the incoming arguments
// before we were able to marshal them. Therefore this must not happen within the try block so we don't try
// to use marshalers that have not been initialized. Potentially leaking unmanaged resources is by-design and
// there's not much we can do about it (we cannot do cleanup if we cannot create the marshaler).
EmitCreateMngdMarshaler(m_pslNDirect->GetSetupCodeStream());
if (IsCLRToNative(dwMarshalFlags))
{
if (IsByref(dwMarshalFlags))
{
EmitMarshalArgumentCLRToNativeByref();
}
else
{
EmitMarshalArgumentCLRToNative();
}
}
else
{
if (IsByref(dwMarshalFlags))
{
EmitMarshalArgumentNativeToCLRByref();
}
else
{
EmitMarshalArgumentNativeToCLR();
}
}
}
#ifdef FEATURE_COMINTEROP
void EmitMarshalHiddenLengthArgument(ILCodeStream *pcsMarshal,
ILCodeStream *pcsUnmarshal,
MarshalInfo *pArrayInfo,
UINT arrayIndex,
DWORD dwMarshalFlags,
UINT hiddenArgIndex,
OverrideProcArgs *pargs,
__out DWORD *pdwHiddenLengthManagedHomeLocal,
__out DWORD *pdwHiddenLengthNativeHomeLocal)
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(IsHiddenLengthParam(dwMarshalFlags));
}
CONTRACTL_END;
Init(pcsMarshal, pcsUnmarshal, hiddenArgIndex, dwMarshalFlags, pargs);
EmitCreateMngdMarshaler(m_pslNDirect->GetSetupCodeStream());
// Create a local to be the home of the length parameter
DWORD dwManagedLocalHome = m_pcsMarshal->NewLocal(GetManagedType());
m_managedHome.InitHome(ILStubMarshalHome::HomeType_ILLocal, dwManagedLocalHome);
*pdwHiddenLengthManagedHomeLocal = dwManagedLocalHome;
// managed length = 0
m_pcsMarshal->EmitLDC(0);
m_pcsMarshal->EmitCONV_T(pArrayInfo->GetHiddenLengthParamElementType());
m_pcsMarshal->EmitSTLOC(dwManagedLocalHome);
// And a local to be the home of the marshaled length
LocalDesc nativeArgType(GetNativeType());
DWORD dwNativeHomeLocal = m_pcsMarshal->NewLocal(nativeArgType);
if (IsByref(dwMarshalFlags))
{
nativeArgType.MakeByRef();
}
m_nativeHome.InitHome(ILStubMarshalHome::HomeType_ILLocal, dwNativeHomeLocal);
*pdwHiddenLengthNativeHomeLocal = dwNativeHomeLocal;
// Update the native signature to contain the new native parameter
m_pcsMarshal->SetStubTargetArgType(&nativeArgType, false);
if (IsCLRToNative(dwMarshalFlags))
{
// Load the length of the array into the local
if (IsIn(dwMarshalFlags))
{
ILCodeLabel *pSkipGetLengthLabel = m_pcsMarshal->NewCodeLabel();
m_pcsMarshal->EmitLDARG(arrayIndex);
m_pcsMarshal->EmitBRFALSE(pSkipGetLengthLabel);
m_pcsMarshal->EmitLDARG(arrayIndex);
if (IsByref(dwMarshalFlags))
{
// if (*array == null) goto pSkipGetLengthLabel
m_pcsMarshal->EmitLDIND_REF();
m_pcsMarshal->EmitBRFALSE(pSkipGetLengthLabel);
// array = *array
m_pcsMarshal->EmitLDARG(arrayIndex);
m_pcsMarshal->EmitLDIND_REF();
}
m_pcsMarshal->EmitLDLEN();
m_pcsMarshal->EmitCONV_T(pArrayInfo->GetHiddenLengthParamElementType());
m_pcsMarshal->EmitSTLOC(dwManagedLocalHome);
m_pcsMarshal->EmitLabel(pSkipGetLengthLabel);
}
if (IsByref(dwMarshalFlags))
{
EmitMarshalArgumentContentsCLRToNativeByref(true);
}
else
{
EmitMarshalArgumentContentsCLRToNative();
}
}
else
{
// Load the length of the array into the local
if (IsIn(dwMarshalFlags))
{
m_pcsMarshal->EmitLDARG(hiddenArgIndex);
if (IsByref(dwMarshalFlags))
{
LocalDesc nativeParamType(GetNativeType());
m_pcsMarshal->EmitLDIND_T(&nativeParamType);
}
m_pcsMarshal->EmitSTLOC(dwNativeHomeLocal);
}
if (IsByref(dwMarshalFlags))
{
EmitMarshalArgumentContentsNativeToCLRByref(true);
}
else
{
EmitMarshalArgumentContentsNativeToCLR();
}
// We can't copy the final length back to the parameter just yet, since we don't know what
// local the array lives in. Instead, we rely on the hidden length array marshaler to copy
// the value into the out parameter for us.
}
}
#endif // FEATURE_COMINTEROP
virtual void EmitSetupArgument(ILCodeStream* pslILEmit)
{
STANDARD_VM_CONTRACT;
if (IsCLRToNative(m_dwMarshalFlags))
{
if (IsNativePassedByRef())
{
EmitLoadNativeHomeAddr(pslILEmit);
}
else
{
EmitLoadNativeValue(pslILEmit);
}
}
else
{
if (IsManagedPassedByRef())
{
EmitLoadManagedHomeAddr(pslILEmit);
}
else
{
EmitLoadManagedValue(pslILEmit);
}
}
}
virtual void EmitMarshalReturnValue(
ILCodeStream* pcsMarshal,
ILCodeStream* pcsUnmarshal,
ILCodeStream* pcsDispatch,
UINT argidx,
UINT16 wNativeSize,
DWORD dwMarshalFlags,
OverrideProcArgs* pargs)
{
STANDARD_VM_CONTRACT;
Init(pcsMarshal, pcsUnmarshal, argidx, dwMarshalFlags, pargs);
LocalDesc nativeType = GetNativeType();
LocalDesc managedType = GetManagedType();
bool byrefNativeReturn = false;
CorElementType typ = ELEMENT_TYPE_VOID;
UINT32 nativeSize = 0;
// we need to convert value type return types to primitives as
// JIT does not inline P/Invoke calls that return structures
if (nativeType.IsValueClass())
{
if (wNativeSize == VARIABLESIZE)
{
// the unmanaged type size is variable
nativeSize = m_pargs->m_pMT->GetNativeSize();
}
else
{
// the unmanaged type size is fixed
nativeSize = wNativeSize;
}
#if !defined(_TARGET_ARM_) && !(defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING))
switch (nativeSize)
{
case 1: typ = ELEMENT_TYPE_U1; break;
case 2: typ = ELEMENT_TYPE_U2; break;
case 4: typ = ELEMENT_TYPE_U4; break;
case 8: typ = ELEMENT_TYPE_U8; break;
default: byrefNativeReturn = true; break;
}
#endif
}
if (IsHresultSwap(dwMarshalFlags) || (byrefNativeReturn && IsCLRToNative(dwMarshalFlags)))
{
LocalDesc extraParamType = nativeType;
extraParamType.MakeByRef();
m_pcsMarshal->SetStubTargetArgType(&extraParamType, false);
if (IsHresultSwap(dwMarshalFlags))
{
// HRESULT swapping: the original return value is transformed into an extra
// byref parameter and the target is expected to return an HRESULT
m_pcsMarshal->SetStubTargetReturnType(ELEMENT_TYPE_I4); // native method returns an HRESULT
}
else
{
// byref structure return: the original return value is transformed into an
// extra byref parameter and the target is not expected to return anything
//
// note: we do this only for forward calls because [unmanaged calling conv.
// uses byref return] implies [managed calling conv. uses byref return]
m_pcsMarshal->SetStubTargetReturnType(ELEMENT_TYPE_VOID);
}
}
else
{
if (typ != ELEMENT_TYPE_VOID)
{
// small structure return: the original return value is transformed into
// ELEMENT_TYPE_U1, ELEMENT_TYPE_U2, ELEMENT_TYPE_U4, or ELEMENT_TYPE_U8
m_pcsMarshal->SetStubTargetReturnType(typ);
}
else
{
m_pcsMarshal->SetStubTargetReturnType(&nativeType);
}
}
m_managedHome.InitHome(ILStubMarshalHome::HomeType_ILLocal, m_pcsMarshal->NewLocal(managedType));
m_nativeHome.InitHome(ILStubMarshalHome::HomeType_ILLocal, m_pcsMarshal->NewLocal(nativeType));
EmitCreateMngdMarshaler(m_pcsMarshal);
if (IsCLRToNative(dwMarshalFlags))
{
if (IsHresultSwap(dwMarshalFlags) || byrefNativeReturn)
{
EmitReInitNative(m_pcsMarshal);
EmitLoadNativeHomeAddr(pcsDispatch); // load up the byref native type as an extra arg
}
else
{
if (typ != ELEMENT_TYPE_VOID)
{
// small structure forward: the returned integer is memcpy'd into native home
// of the structure
DWORD dwTempLocalNum = m_pcsUnmarshal->NewLocal(typ);
m_pcsUnmarshal->EmitSTLOC(dwTempLocalNum);
// cpblk
m_nativeHome.EmitLoadHomeAddr(m_pcsUnmarshal);
m_pcsUnmarshal->EmitLDLOCA(dwTempLocalNum);
m_pcsUnmarshal->EmitLDC(nativeSize);
m_pcsUnmarshal->EmitCPBLK();
}
else
{
EmitStoreNativeValue(m_pcsUnmarshal);
}
}
if (NeedsMarshalCleanupIndex())
{
m_pslNDirect->EmitSetArgMarshalIndex(m_pcsUnmarshal, NDirectStubLinker::CLEANUP_INDEX_ARG0_MARSHAL + m_argidx);
}
EmitConvertSpaceAndContentsNativeToCLR(m_pcsUnmarshal);
EmitCleanupCLRToNative();
EmitLoadManagedValue(m_pcsUnmarshal);
}
else
{
EmitStoreManagedValue(m_pcsUnmarshal);
if (NeedsMarshalCleanupIndex())
{
m_pslNDirect->EmitSetArgMarshalIndex(m_pcsUnmarshal, NDirectStubLinker::CLEANUP_INDEX_ARG0_MARSHAL + m_argidx);
}
if (IsHresultSwap(dwMarshalFlags))
{
// we have to skip unmarshaling return value into the HRESULT-swapped argument
// if the argument came as NULL (otherwise we would leak unmanaged resources as
// we have no way of passing them back to the caller)
ILCodeLabel *pSkipConversionLabel = m_pcsUnmarshal->NewCodeLabel();
m_pcsUnmarshal->EmitLDARG(argidx);
m_pcsUnmarshal->EmitBRFALSE(pSkipConversionLabel);
EmitConvertSpaceAndContentsCLRToNative(m_pcsUnmarshal);
m_pcsUnmarshal->EmitLabel(pSkipConversionLabel);
}
else
{
EmitConvertSpaceAndContentsCLRToNative(m_pcsUnmarshal);
}
if (NeedsUnmarshalCleanupIndex())
{
// if an exception is thrown after this point, we will clean up the unmarshaled retval
m_pslNDirect->EmitSetArgMarshalIndex(m_pcsUnmarshal, NDirectStubLinker::CLEANUP_INDEX_RETVAL_UNMARSHAL);
}
EmitCleanupNativeToCLR();
if (IsHresultSwap(dwMarshalFlags))
{
// we tolerate NULL here mainly for backward compatibility reasons
m_nativeHome.EmitCopyToByrefArgWithNullCheck(m_pcsUnmarshal, &nativeType, argidx);
m_pcsUnmarshal->EmitLDC(S_OK);
}
else
{
if (typ != ELEMENT_TYPE_VOID)
{
// small structure return (reverse): native home of the structure is memcpy'd
// into the integer to be returned from the stub
DWORD dwTempLocalNum = m_pcsUnmarshal->NewLocal(typ);
// cpblk
m_pcsUnmarshal->EmitLDLOCA(dwTempLocalNum);
m_nativeHome.EmitLoadHomeAddr(m_pcsUnmarshal);
m_pcsUnmarshal->EmitLDC(nativeSize);
m_pcsUnmarshal->EmitCPBLK();
m_pcsUnmarshal->EmitLDLOC(dwTempLocalNum);
}
else
{
EmitLoadNativeValue(m_pcsUnmarshal);
}
}
// make sure we free (and zero) the return value if an exception is thrown
EmitExceptionCleanupNativeToCLR();
}
}
protected:
virtual void EmitCreateMngdMarshaler(ILCodeStream* pslILEmit)
{
LIMITED_METHOD_CONTRACT;
}
virtual void EmitLoadMngdMarshaler(ILCodeStream* pslILEmit)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;
CONSISTENCY_CHECK((DWORD)-1 != m_dwMngdMarshalerLocalNum);
pslILEmit->EmitLDLOC(m_dwMngdMarshalerLocalNum);
}
void EmitSetupSigAndDefaultHomesCLRToNative()
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(IsCLRToNative(m_dwMarshalFlags) && !IsByref(m_dwMarshalFlags));
}
CONTRACTL_END;
LocalDesc nativeArgType = GetNativeType();
DWORD dwNativeHomeLocalNum = m_pcsMarshal->NewLocal(nativeArgType);
m_pcsMarshal->SetStubTargetArgType(&nativeArgType);
m_managedHome.InitHome(ILStubMarshalHome::HomeType_ILArgument, m_argidx);
m_nativeHome.InitHome(ILStubMarshalHome::HomeType_ILLocal, dwNativeHomeLocalNum);
}
void EmitCleanupCLRToNativeTemp()
{
STANDARD_VM_CONTRACT;
if (NeedsClearNative())
{
CONSISTENCY_CHECK(NeedsMarshalCleanupIndex());
ILCodeStream* pcsCleanup = m_pslNDirect->GetCleanupCodeStream();
ILCodeLabel* pSkipClearNativeLabel = pcsCleanup->NewCodeLabel();
m_pslNDirect->EmitCheckForArgCleanup(pcsCleanup,
NDirectStubLinker::CLEANUP_INDEX_ARG0_MARSHAL + m_argidx,
NDirectStubLinker::BranchIfNotMarshaled,
pSkipClearNativeLabel);
EmitClearNativeTemp(pcsCleanup);
pcsCleanup->EmitLabel(pSkipClearNativeLabel);
}
}
void EmitCleanupCLRToNative()
{
STANDARD_VM_CONTRACT;
if (NeedsClearNative())
{
CONSISTENCY_CHECK(NeedsMarshalCleanupIndex());
ILCodeStream* pcsCleanup = m_pslNDirect->GetCleanupCodeStream();
ILCodeLabel* pSkipClearNativeLabel = pcsCleanup->NewCodeLabel();
m_pslNDirect->EmitCheckForArgCleanup(pcsCleanup,
NDirectStubLinker::CLEANUP_INDEX_ARG0_MARSHAL + m_argidx,
NDirectStubLinker::BranchIfNotMarshaled,
pSkipClearNativeLabel);
EmitClearNative(pcsCleanup);
pcsCleanup->EmitLabel(pSkipClearNativeLabel);
}
}
virtual void EmitMarshalArgumentCLRToNative()
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(IsCLRToNative(m_dwMarshalFlags) && !IsByref(m_dwMarshalFlags));
}
CONTRACTL_END;
EmitSetupSigAndDefaultHomesCLRToNative();
EmitMarshalArgumentContentsCLRToNative();
}
void EmitMarshalArgumentContentsCLRToNative()
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(IsCLRToNative(m_dwMarshalFlags) && !IsByref(m_dwMarshalFlags));
}
CONTRACTL_END;
//
// marshal
//
if (IsIn(m_dwMarshalFlags))
{
EmitConvertSpaceAndContentsCLRToNativeTemp(m_pcsMarshal);
}
else
{
EmitConvertSpaceCLRToNativeTemp(m_pcsMarshal);
}
//
// unmarshal
//
if (IsOut(m_dwMarshalFlags))
{
if (IsIn(m_dwMarshalFlags))
{
EmitClearCLRContents(m_pcsUnmarshal);
}
EmitConvertContentsNativeToCLR(m_pcsUnmarshal);
}
EmitCleanupCLRToNativeTemp();
}
void EmitSetupSigAndDefaultHomesCLRToNativeByref(bool fBlittable = false)
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(IsCLRToNative(m_dwMarshalFlags) && IsByref(m_dwMarshalFlags));
}
CONTRACTL_END;
LocalDesc nativeType = GetNativeType();
LocalDesc managedType = GetManagedType();
LocalDesc nativeArgType = nativeType;
nativeArgType.MakeByRef();
m_pcsMarshal->SetStubTargetArgType(&nativeArgType);
if (fBlittable)
{
// we will not work with the actual data but only with a pointer to that data
// (the managed and native type had better be the same if it's blittable)
_ASSERTE(nativeType.ElementType[0] == managedType.ElementType[0]);
// native home will keep the containing object pinned
nativeType.MakeByRef();
nativeType.MakePinned();
m_managedHome.InitHome(ILStubMarshalHome::HomeType_ILByrefArgument, m_argidx);
m_nativeHome.InitHome(ILStubMarshalHome::HomeType_ILByrefLocal, m_pcsMarshal->NewLocal(nativeType));
}
else
{
m_managedHome.InitHome(ILStubMarshalHome::HomeType_ILLocal, m_pcsMarshal->NewLocal(managedType));
m_nativeHome.InitHome(ILStubMarshalHome::HomeType_ILLocal, m_pcsMarshal->NewLocal(nativeType));
}
}
virtual void EmitMarshalArgumentCLRToNativeByref()
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(IsCLRToNative(m_dwMarshalFlags) && IsByref(m_dwMarshalFlags));
}
CONTRACTL_END;
EmitSetupSigAndDefaultHomesCLRToNativeByref();
EmitMarshalArgumentContentsCLRToNativeByref(false);
}
void EmitMarshalArgumentContentsCLRToNativeByref(bool managedHomeAlreadyInitialized)
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(IsCLRToNative(m_dwMarshalFlags) && IsByref(m_dwMarshalFlags));
}
CONTRACTL_END;
LocalDesc managedType = GetManagedType();
//
// marshal
//
if (IsIn(m_dwMarshalFlags) && ! IsOut(m_dwMarshalFlags))
{
if (!managedHomeAlreadyInitialized)
{
m_managedHome.EmitCopyFromByrefArg(m_pcsMarshal, &managedType, m_argidx);
}
EmitConvertSpaceAndContentsCLRToNativeTemp(m_pcsMarshal);
}
else if (IsIn(m_dwMarshalFlags) && IsOut(m_dwMarshalFlags))
{
if (!managedHomeAlreadyInitialized)
{
m_managedHome.EmitCopyFromByrefArg(m_pcsMarshal, &managedType, m_argidx);
}
EmitConvertSpaceAndContentsCLRToNative(m_pcsMarshal);
}
else
{
EmitReInitNative(m_pcsMarshal);
}
//
// unmarshal
//
if (IsOut(m_dwMarshalFlags))
{
EmitClearCLR(m_pcsUnmarshal);
EmitConvertSpaceAndContentsNativeToCLR(m_pcsUnmarshal);
if (!managedHomeAlreadyInitialized)
{
m_managedHome.EmitCopyToByrefArg(m_pcsUnmarshal, &managedType, m_argidx);
}
EmitCleanupCLRToNative();
}
else
{
EmitCleanupCLRToNativeTemp();
}
//
// @TODO: ensure ReInitNative is called on [in,out] byref args when an exception occurs
//
}
void EmitSetupSigAndDefaultHomesNativeToCLR()
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(!IsCLRToNative(m_dwMarshalFlags) && !IsByref(m_dwMarshalFlags));
}
CONTRACTL_END;
LocalDesc nativeArgType = GetNativeType();
m_pcsMarshal->SetStubTargetArgType(&nativeArgType);
m_managedHome.InitHome(ILStubMarshalHome::HomeType_ILLocal, m_pcsMarshal->NewLocal(GetManagedType()));
m_nativeHome.InitHome(ILStubMarshalHome::HomeType_ILArgument, m_argidx);
}
void EmitCleanupNativeToCLR()
{
STANDARD_VM_CONTRACT;
if (NeedsClearCLR())
{
CONSISTENCY_CHECK(NeedsMarshalCleanupIndex());
ILCodeStream* pcsCleanup = m_pslNDirect->GetCleanupCodeStream();
ILCodeLabel* pSkipClearCLRLabel = pcsCleanup->NewCodeLabel();
m_pslNDirect->EmitCheckForArgCleanup(pcsCleanup,
NDirectStubLinker::CLEANUP_INDEX_ARG0_MARSHAL + m_argidx,
NDirectStubLinker::BranchIfNotMarshaled,
pSkipClearCLRLabel);
EmitClearCLR(pcsCleanup);
pcsCleanup->EmitLabel(pSkipClearCLRLabel);
}
}
// Emits cleanup code that runs only if an exception is thrown during execution of an IL stub (its try
// block to be precise). The goal is to roll back allocations of native resources that may have already
// happened to prevent leaks, and also clear output arguments to prevent passing out invalid data - most
// importantly dangling pointers. The canonical example is an exception thrown during unmarshaling of
// an argument at which point other arguments have already been unmarshaled.
void EmitExceptionCleanupNativeToCLR()
{
STANDARD_VM_CONTRACT;
_ASSERTE(IsRetval(m_dwMarshalFlags) || IsOut(m_dwMarshalFlags));
LocalDesc nativeType = GetNativeType();
ILCodeStream *pcsCleanup = m_pslNDirect->GetExceptionCleanupCodeStream();
if (NeedsClearNative())
{
m_pslNDirect->SetExceptionCleanupNeeded();
ILCodeLabel *pSkipCleanupLabel = pcsCleanup->NewCodeLabel();
// if this is byref in/out and we have not marshaled this argument
// yet, we need to populate the native home with the incoming value
if (IsIn(m_dwMarshalFlags) && IsByref(m_dwMarshalFlags))
{
ILCodeLabel *pSkipCopyLabel = pcsCleanup->NewCodeLabel();
CONSISTENCY_CHECK(NeedsMarshalCleanupIndex());
m_pslNDirect->EmitCheckForArgCleanup(pcsCleanup,
NDirectStubLinker::CLEANUP_INDEX_ARG0_MARSHAL + m_argidx,
NDirectStubLinker::BranchIfMarshaled,
pSkipCopyLabel);
pcsCleanup->EmitLDARG(m_argidx);
pcsCleanup->EmitBRFALSE(pSkipCleanupLabel); // if the argument is NULL, skip cleanup completely
m_nativeHome.EmitCopyFromByrefArg(pcsCleanup, &nativeType, m_argidx);
pcsCleanup->EmitLabel(pSkipCopyLabel);
}
// if this is retval or out-only, the native home does not get initialized until we unmarshal it
if (IsRetval(m_dwMarshalFlags) || !IsIn(m_dwMarshalFlags))
{
CONSISTENCY_CHECK(NeedsUnmarshalCleanupIndex());
UINT uArgIdx = (IsRetval(m_dwMarshalFlags) ?
NDirectStubLinker::CLEANUP_INDEX_RETVAL_UNMARSHAL :
NDirectStubLinker::CLEANUP_INDEX_ARG0_UNMARSHAL + m_argidx);
m_pslNDirect->EmitCheckForArgCleanup(pcsCleanup,
uArgIdx,
NDirectStubLinker::BranchIfNotMarshaled,
pSkipCleanupLabel);
}
// we know that native home needs to be cleaned up at this point
if (IsRetval(m_dwMarshalFlags) || (IsOut(m_dwMarshalFlags) && IsByref(m_dwMarshalFlags)))
{
// we own the buffer - clear everything
EmitClearNative(pcsCleanup);
}
else
{
// this is a caller supplied buffer - clear only its contents
EmitClearNativeContents(pcsCleanup);
}
pcsCleanup->EmitLabel(pSkipCleanupLabel);
}
// if there is an output buffer, zero it out so the caller does not get pointer to already freed data
if (!IsHiddenLengthParam(m_dwMarshalFlags))
{
if (IsRetval(m_dwMarshalFlags) || (IsOut(m_dwMarshalFlags) && IsByref(m_dwMarshalFlags)))
{
m_pslNDirect->SetExceptionCleanupNeeded();
EmitReInitNative(pcsCleanup);
if (IsHresultSwap(m_dwMarshalFlags) || IsOut(m_dwMarshalFlags))
{
m_nativeHome.EmitCopyToByrefArgWithNullCheck(pcsCleanup, &nativeType, m_argidx);
}
}
}
}
virtual void EmitMarshalArgumentNativeToCLR()
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(!IsCLRToNative(m_dwMarshalFlags) && !IsByref(m_dwMarshalFlags));
}
CONTRACTL_END;
EmitSetupSigAndDefaultHomesNativeToCLR();
EmitMarshalArgumentContentsNativeToCLR();
}
void EmitMarshalArgumentContentsNativeToCLR()
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(!IsCLRToNative(m_dwMarshalFlags) && !IsByref(m_dwMarshalFlags));
}
CONTRACTL_END;
//
// marshal
//
if (IsIn(m_dwMarshalFlags))
{
EmitConvertSpaceAndContentsNativeToCLR(m_pcsMarshal);
}
else
{
EmitConvertSpaceNativeToCLR(m_pcsMarshal);
}
//
// unmarshal
//
if (IsOut(m_dwMarshalFlags))
{
if (IsIn(m_dwMarshalFlags))
{
EmitClearNativeContents(m_pcsUnmarshal);
}
EmitConvertContentsCLRToNative(m_pcsUnmarshal);
// make sure we free the argument if an exception is thrown
EmitExceptionCleanupNativeToCLR();
}
EmitCleanupNativeToCLR();
}
void EmitSetupSigAndDefaultHomesNativeToCLRByref(bool fBlittable = false)
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(!IsCLRToNative(m_dwMarshalFlags) && IsByref(m_dwMarshalFlags));
}
CONTRACTL_END;
LocalDesc nativeType = GetNativeType();
LocalDesc managedType = GetManagedType();
LocalDesc nativeArgType = nativeType;
nativeArgType.MakeByRef();
m_pcsMarshal->SetStubTargetArgType(&nativeArgType);
if (fBlittable)
{
// we will not work with the actual data but only with a pointer to that data
// (the managed and native type had better be the same if it's blittable)
_ASSERTE(nativeType.ElementType[0] == managedType.ElementType[0]);
managedType.MakeByRef();
m_managedHome.InitHome(ILStubMarshalHome::HomeType_ILByrefLocal, m_pcsMarshal->NewLocal(managedType));
m_nativeHome.InitHome(ILStubMarshalHome::HomeType_ILByrefArgument, m_argidx);
}
else
{
m_managedHome.InitHome(ILStubMarshalHome::HomeType_ILLocal, m_pcsMarshal->NewLocal(managedType));
m_nativeHome.InitHome(ILStubMarshalHome::HomeType_ILLocal, m_pcsMarshal->NewLocal(nativeType));
}
}
virtual void EmitMarshalArgumentNativeToCLRByref()
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(!IsCLRToNative(m_dwMarshalFlags) && IsByref(m_dwMarshalFlags));
}
CONTRACTL_END;
EmitSetupSigAndDefaultHomesNativeToCLRByref();
EmitMarshalArgumentContentsNativeToCLRByref(false);
}
void EmitMarshalArgumentContentsNativeToCLRByref(bool nativeHomeAlreadyInitialized)
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(!IsCLRToNative(m_dwMarshalFlags) && IsByref(m_dwMarshalFlags));
}
CONTRACTL_END;
LocalDesc nativeType = GetNativeType();
//
// marshal
//
if (IsIn(m_dwMarshalFlags))
{
if (!nativeHomeAlreadyInitialized)
{
m_nativeHome.EmitCopyFromByrefArg(m_pcsMarshal, &nativeType, m_argidx);
}
EmitConvertSpaceAndContentsNativeToCLR(m_pcsMarshal);
}
else
{
// dereference the argument so we throw before calling the managed target - this is the fastest way
// to check for NULL (we can still throw later if the pointer is invalid yet non-NULL but we cannot
// detect this realiably - the memory may get unmapped etc., NULL check is the best we can do here)
m_pcsMarshal->EmitLDARG(m_argidx);
m_pcsMarshal->EmitLDIND_I1();
m_pcsMarshal->EmitPOP();
}
//
// unmarshal
//
if (IsOut(m_dwMarshalFlags))
{
if (IsIn(m_dwMarshalFlags))
{
EmitClearNative(m_pcsUnmarshal);
EmitReInitNative(m_pcsUnmarshal);
}
EmitConvertSpaceAndContentsCLRToNative(m_pcsUnmarshal);
if (!nativeHomeAlreadyInitialized)
{
m_nativeHome.EmitCopyToByrefArg(m_pcsUnmarshal, &nativeType, m_argidx);
}
// make sure we free and zero the by-ref argument if an exception is thrown
EmitExceptionCleanupNativeToCLR();
}
EmitCleanupNativeToCLR();
}
virtual LocalDesc GetNativeType() = 0;
virtual LocalDesc GetManagedType() = 0;
//
// Native-to-CLR
//
virtual void EmitConvertSpaceNativeToCLR(ILCodeStream* pslILEmit)
{
LIMITED_METHOD_CONTRACT;
}
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit)
{
LIMITED_METHOD_CONTRACT;
}
virtual void EmitConvertSpaceAndContentsNativeToCLR(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
EmitConvertSpaceNativeToCLR(pslILEmit);
EmitConvertContentsNativeToCLR(pslILEmit);
}
//
// CLR-to-Native
//
virtual void EmitConvertSpaceCLRToNative(ILCodeStream* pslILEmit)
{
LIMITED_METHOD_CONTRACT;
}
virtual void EmitConvertSpaceCLRToNativeTemp(ILCodeStream* pslILEmit)
{
LIMITED_METHOD_CONTRACT;
EmitConvertSpaceCLRToNative(pslILEmit);
}
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit)
{
LIMITED_METHOD_CONTRACT;
}
virtual void EmitConvertSpaceAndContentsCLRToNative(ILCodeStream* pslILEmit)
{
STANDARD_VM_CONTRACT;
EmitConvertSpaceCLRToNative(pslILEmit);
EmitConvertContentsCLRToNative(pslILEmit);
}
virtual void EmitConvertSpaceAndContentsCLRToNativeTemp(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
EmitConvertSpaceAndContentsCLRToNative(pslILEmit);
}
//
// Misc
//
virtual void EmitClearCLRContents(ILCodeStream* pslILEmit)
{
LIMITED_METHOD_CONTRACT;
}
virtual bool NeedsClearNative()
{
LIMITED_METHOD_CONTRACT;
return false;
}
virtual void EmitClearNative(ILCodeStream* pslILEmit)
{
LIMITED_METHOD_CONTRACT;
}
virtual void EmitClearNativeTemp(ILCodeStream* pslILEmit)
{
LIMITED_METHOD_CONTRACT;
EmitClearNative(pslILEmit);
}
virtual void EmitClearNativeContents(ILCodeStream* pslILEmit)
{
LIMITED_METHOD_CONTRACT;
}
virtual bool NeedsClearCLR()
{
LIMITED_METHOD_CONTRACT;
return false;
}
virtual void EmitClearCLR(ILCodeStream* pslILEmit)
{
LIMITED_METHOD_CONTRACT;
}
virtual void EmitReInitNative(ILCodeStream* pslILEmit)
{
STANDARD_VM_CONTRACT;
// Friendly Reminder:
// You should implement your own EmitReInitNative if your native type is a struct,
// as the following instructions apparently won't work on value types and will trigger
// an ASSERT in JIT
_ASSERTE(!GetNativeType().IsValueClass());
pslILEmit->EmitLDC(0);
pslILEmit->EmitCONV_T(static_cast<CorElementType>(GetNativeType().ElementType[0]));
EmitStoreNativeValue(pslILEmit);
}
virtual bool IsManagedPassedByRef()
{
LIMITED_METHOD_CONTRACT;
return IsByref(m_dwMarshalFlags);
}
virtual bool IsNativePassedByRef()
{
LIMITED_METHOD_CONTRACT;
return IsByref(m_dwMarshalFlags);
}
void EmitInterfaceClearNative(ILCodeStream* pslILEmit);
public:
static MarshalerOverrideStatus ArgumentOverride(NDirectStubLinker* psl,
BOOL byref,
BOOL fin,
BOOL fout,
BOOL fManagedToNative,
OverrideProcArgs* pargs,
UINT* pResID,
UINT argidx,
UINT nativeStackOffset)
{
LIMITED_METHOD_CONTRACT;
return HANDLEASNORMAL;
}
static MarshalerOverrideStatus ReturnOverride(NDirectStubLinker* psl,
BOOL fManagedToNative,
BOOL fHresultSwap,
OverrideProcArgs* pargs,
UINT* pResID)
{
LIMITED_METHOD_CONTRACT;
return HANDLEASNORMAL;
}
};
class ILCopyMarshalerBase : public ILMarshaler
{
virtual LocalDesc GetManagedType()
{
WRAPPER_NO_CONTRACT;
return GetNativeType();
}
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit)
{
STANDARD_VM_CONTRACT;
EmitLoadManagedValue(pslILEmit);
EmitStoreNativeValue(pslILEmit);
}
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit)
{
STANDARD_VM_CONTRACT;
EmitLoadNativeValue(pslILEmit);
EmitStoreManagedValue(pslILEmit);
}
//
// It's very unforunate that x86 used ML_COPYPINNEDGCREF for byref args.
// The result is that developers can get away with being lazy about their
// in/out semantics and often times in/out byref params are marked out-
// only, but because of ML_COPYPINNEDGCREF, they get in/out behavior.
//
// There are even lazier developers who use byref params to pass arrays.
// Pinning ensures that the native side 'sees' the entire array even when
// only reference to one element was passed.
//
// This method was changed to pin instead of copy in Dev10 in order
// to match the original ML behavior.
//
virtual void EmitMarshalArgumentCLRToNativeByref()
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(IsCLRToNative(m_dwMarshalFlags) && IsByref(m_dwMarshalFlags));
}
CONTRACTL_END;
EmitSetupSigAndDefaultHomesCLRToNativeByref(true);
//
// marshal
//
EmitLoadManagedHomeAddr(m_pcsMarshal);
EmitStoreNativeHomeAddr(m_pcsMarshal);
//
// no unmarshaling is necessary since we directly passed the pinned byref to native,
// the argument is therefore automatically in/out
//
}
//
// Similarly to the other direction, ML used ML_COPYPINNEDGCREF on x86 to
// directly pass the unmanaged pointer as a byref argument to managed code.
// This also makes an observable difference (allows passing NULL, changes
// made to the original value during the call are visible in managed).
//
// This method was changed to pass pointer instead of copy in Dev10 in order
// to match the original ML behavior. Note that in this direction we don't
// need to pin the pointer - if it is pointing to GC heap, it must have been
// pinned on the way to unmanaged.
//
virtual void EmitMarshalArgumentNativeToCLRByref()
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(!IsCLRToNative(m_dwMarshalFlags) && IsByref(m_dwMarshalFlags));
}
CONTRACTL_END;
EmitSetupSigAndDefaultHomesNativeToCLRByref(true);
//
// marshal
//
EmitLoadNativeHomeAddr(m_pcsMarshal);
EmitStoreManagedHomeAddr(m_pcsMarshal);
//
// no unmarshaling is necessary since we directly passed the pointer to managed
// as a byref, the argument is therefore automatically in/out
//
}
};
template <CorElementType ELEMENT_TYPE, class PROMOTED_ELEMENT>
class ILCopyMarshalerSimple : public ILCopyMarshalerBase
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(PROMOTED_ELEMENT),
c_CLRSize = sizeof(PROMOTED_ELEMENT),
};
bool IsSmallValueTypeSpecialCase()
{
//
// Special case for small value types that get
// mapped to MARSHAL_TYPE_GENERIC_8 -- use the
// valuetype type so the JIT is happy.
//
return (ELEMENT_TYPE ==
#ifdef _WIN64
ELEMENT_TYPE_I8
#else // _WIN64
ELEMENT_TYPE_I4
#endif // _WIN64
) && (NULL != m_pargs->m_pMT);
}
bool NeedToPromoteTo8Bytes()
{
WRAPPER_NO_CONTRACT;
#if defined(_TARGET_AMD64_)
// If the argument is passed by value,
if (!IsByref(m_dwMarshalFlags) && !IsRetval(m_dwMarshalFlags))
{
// and it is an I4 or an U4,
if ( (ELEMENT_TYPE == ELEMENT_TYPE_I4) ||
(ELEMENT_TYPE == ELEMENT_TYPE_U4) )
{
// and we are doing a managed-to-unmanaged call,
if (IsCLRToNative(m_dwMarshalFlags))
{
// then we have to promote the native argument type to an I8 or an U8.
return true;
}
}
}
#endif // _TARGET_AMD64_
return false;
}
CorElementType GetConversionType(CorElementType type)
{
LIMITED_METHOD_CONTRACT;
// I4 <-> I8; U4 <-> U8
if (type == ELEMENT_TYPE_I4)
{
return ELEMENT_TYPE_I8;
}
else if (type == ELEMENT_TYPE_U4)
{
return ELEMENT_TYPE_U8;
}
else
{
return ELEMENT_TYPE_END;
}
}
void EmitTypePromotion(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
CorElementType promotedType = GetConversionType(ELEMENT_TYPE);
if (promotedType == ELEMENT_TYPE_I8)
{
pslILEmit->EmitCONV_I8();
}
else if (promotedType == ELEMENT_TYPE_U8)
{
pslILEmit->EmitCONV_U8();
}
}
virtual LocalDesc GetNativeType()
{
WRAPPER_NO_CONTRACT;
if (NeedToPromoteTo8Bytes())
{
return LocalDesc(GetConversionType(ELEMENT_TYPE));
}
else
{
return GetManagedType();
}
}
virtual LocalDesc GetManagedType()
{
WRAPPER_NO_CONTRACT;
if (IsSmallValueTypeSpecialCase())
{
return LocalDesc(m_pargs->m_pMT);
}
else
{
return LocalDesc(ELEMENT_TYPE);
}
}
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit)
{
STANDARD_VM_CONTRACT;
EmitLoadManagedValue(pslILEmit);
if (NeedToPromoteTo8Bytes())
{
EmitTypePromotion(pslILEmit);
}
EmitStoreNativeValue(pslILEmit);
}
virtual void EmitReInitNative(ILCodeStream* pslILEmit)
{
STANDARD_VM_CONTRACT;
if (IsSmallValueTypeSpecialCase())
{
EmitLoadNativeHomeAddr(pslILEmit);
pslILEmit->EmitINITOBJ(pslILEmit->GetToken(m_pargs->m_pMT));
}
else
{
// ldc.i4.0, conv.i8/u8/r4/r8 is shorter than ldc.i8/r4/r8 0
pslILEmit->EmitLDC(0);
pslILEmit->EmitCONV_T(ELEMENT_TYPE);
EmitStoreNativeValue(pslILEmit);
}
}
};
typedef ILCopyMarshalerSimple<ELEMENT_TYPE_I1, INT_PTR> ILCopyMarshaler1;
typedef ILCopyMarshalerSimple<ELEMENT_TYPE_U1, UINT_PTR> ILCopyMarshalerU1;
typedef ILCopyMarshalerSimple<ELEMENT_TYPE_I2, INT_PTR> ILCopyMarshaler2;
typedef ILCopyMarshalerSimple<ELEMENT_TYPE_U2, UINT_PTR> ILCopyMarshalerU2;
typedef ILCopyMarshalerSimple<ELEMENT_TYPE_I4, INT_PTR> ILCopyMarshaler4;
typedef ILCopyMarshalerSimple<ELEMENT_TYPE_U4, UINT_PTR> ILCopyMarshalerU4;
typedef ILCopyMarshalerSimple<ELEMENT_TYPE_I8, INT64> ILCopyMarshaler8;
typedef ILCopyMarshalerSimple<ELEMENT_TYPE_R4, float> ILFloatMarshaler;
typedef ILCopyMarshalerSimple<ELEMENT_TYPE_R8, double> ILDoubleMarshaler;
template <BinderClassID CLASS__ID, class PROMOTED_ELEMENT>
class ILCopyMarshalerKnownStruct : public ILCopyMarshalerBase
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(PROMOTED_ELEMENT),
c_CLRSize = sizeof(PROMOTED_ELEMENT),
};
virtual void EmitReInitNative(ILCodeStream* pslILEmit)
{
STANDARD_VM_CONTRACT;
EmitLoadNativeHomeAddr(pslILEmit);
pslILEmit->EmitINITOBJ(pslILEmit->GetToken(MscorlibBinder::GetClass(CLASS__ID)));
}
virtual LocalDesc GetNativeType()
{
STANDARD_VM_CONTRACT;
return LocalDesc(MscorlibBinder::GetClass(CLASS__ID));
}
};
typedef ILCopyMarshalerKnownStruct<CLASS__DECIMAL, DECIMAL> ILDecimalMarshaler;
typedef ILCopyMarshalerKnownStruct<CLASS__GUID, GUID> ILGuidMarshaler;
class ILBlittableValueClassMarshaler : public ILCopyMarshalerBase
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = VARIABLESIZE,
c_CLRSize = VARIABLESIZE,
};
virtual void EmitReInitNative(ILCodeStream* pslILEmit)
{
STANDARD_VM_CONTRACT;
EmitLoadNativeHomeAddr(pslILEmit);
pslILEmit->EmitINITOBJ(pslILEmit->GetToken(m_pargs->m_pMT));
}
virtual LocalDesc GetNativeType()
{
LIMITED_METHOD_CONTRACT;
return LocalDesc(m_pargs->m_pMT);
}
};
class ILDelegateMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(void *),
c_CLRSize = sizeof(OBJECTREF),
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
};
class ILReflectionObjectMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(void *),
c_CLRSize = sizeof(OBJECTREF),
};
protected:
virtual LocalDesc GetManagedType();
virtual LocalDesc GetNativeType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual BinderFieldID GetStructureFieldID() {LIMITED_METHOD_CONTRACT; return (BinderFieldID)0;}
virtual BinderFieldID GetObjectFieldID() = 0;
virtual BinderClassID GetManagedTypeBinderID() = 0;
};
class ILIRuntimeMethodInfoMarshaler : public ILReflectionObjectMarshaler
{
protected:
virtual BinderFieldID GetObjectFieldID() { LIMITED_METHOD_CONTRACT; return FIELD__STUBMETHODINFO__HANDLE; }
virtual BinderClassID GetManagedTypeBinderID() { LIMITED_METHOD_CONTRACT; return CLASS__STUBMETHODINFO; }
};
class ILRuntimeModuleMarshaler : public ILReflectionObjectMarshaler
{
protected:
virtual BinderFieldID GetObjectFieldID() { LIMITED_METHOD_CONTRACT; return FIELD__MODULE__DATA; }
virtual BinderClassID GetManagedTypeBinderID() { LIMITED_METHOD_CONTRACT; return CLASS__MODULE; }
};
class ILRuntimeAssemblyMarshaler : public ILReflectionObjectMarshaler
{
protected:
virtual BinderFieldID GetObjectFieldID() { LIMITED_METHOD_CONTRACT; return FIELD__ASSEMBLY__HANDLE; }
virtual BinderClassID GetManagedTypeBinderID() { LIMITED_METHOD_CONTRACT; return CLASS__ASSEMBLY; }
};
class ILRuntimeTypeHandleMarshaler : public ILReflectionObjectMarshaler
{
protected:
virtual BinderFieldID GetStructureFieldID() { LIMITED_METHOD_CONTRACT; return FIELD__RT_TYPE_HANDLE__M_TYPE; }
virtual BinderFieldID GetObjectFieldID() { LIMITED_METHOD_CONTRACT; return FIELD__CLASS__TYPEHANDLE; }
virtual BinderClassID GetManagedTypeBinderID() { LIMITED_METHOD_CONTRACT; return CLASS__RT_TYPE_HANDLE; }
};
class ILRuntimeMethodHandleMarshaler : public ILReflectionObjectMarshaler
{
protected:
virtual BinderFieldID GetStructureFieldID() { LIMITED_METHOD_CONTRACT; return FIELD__METHOD_HANDLE__METHOD; }
virtual BinderFieldID GetObjectFieldID() { LIMITED_METHOD_CONTRACT; return FIELD__STUBMETHODINFO__HANDLE; }
virtual BinderClassID GetManagedTypeBinderID() { LIMITED_METHOD_CONTRACT; return CLASS__METHOD_HANDLE; }
};
class ILRuntimeFieldHandleMarshaler : public ILReflectionObjectMarshaler
{
protected:
virtual BinderFieldID GetStructureFieldID() { LIMITED_METHOD_CONTRACT; return FIELD__FIELD_HANDLE__M_FIELD; }
virtual BinderFieldID GetObjectFieldID() { LIMITED_METHOD_CONTRACT; return FIELD__RT_FIELD_INFO__HANDLE; }
virtual BinderClassID GetManagedTypeBinderID() { LIMITED_METHOD_CONTRACT; return CLASS__FIELD_HANDLE; }
};
class ILBoolMarshaler : public ILMarshaler
{
public:
virtual CorElementType GetNativeBoolElementType() = 0;
virtual int GetNativeTrueValue() = 0;
virtual int GetNativeFalseValue() = 0;
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
};
class ILWinBoolMarshaler : public ILBoolMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(BOOL),
c_CLRSize = sizeof(INT8),
};
protected:
virtual CorElementType GetNativeBoolElementType()
{
LIMITED_METHOD_CONTRACT;
return ELEMENT_TYPE_I4;
}
virtual int GetNativeTrueValue()
{
LIMITED_METHOD_CONTRACT;
return 1;
}
virtual int GetNativeFalseValue()
{
LIMITED_METHOD_CONTRACT;
return 0;
}
};
class ILCBoolMarshaler : public ILBoolMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(BYTE),
c_CLRSize = sizeof(INT8),
};
protected:
virtual CorElementType GetNativeBoolElementType()
{
LIMITED_METHOD_CONTRACT;
return ELEMENT_TYPE_I1;
}
virtual int GetNativeTrueValue()
{
LIMITED_METHOD_CONTRACT;
return 1;
}
virtual int GetNativeFalseValue()
{
LIMITED_METHOD_CONTRACT;
return 0;
}
};
#ifdef FEATURE_COMINTEROP
class ILVtBoolMarshaler : public ILBoolMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(VARIANT_BOOL),
c_CLRSize = sizeof(INT8),
};
protected:
virtual CorElementType GetNativeBoolElementType()
{
LIMITED_METHOD_CONTRACT;
return ELEMENT_TYPE_I2;
}
virtual int GetNativeTrueValue()
{
LIMITED_METHOD_CONTRACT;
return VARIANT_TRUE;
}
virtual int GetNativeFalseValue()
{
LIMITED_METHOD_CONTRACT;
return VARIANT_FALSE;
}
};
#endif // FEATURE_COMINTEROP
class ILWSTRMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(void *),
c_CLRSize = sizeof(OBJECTREF),
};
#ifdef _DEBUG
bool m_fCoMemoryAllocated;
ILWSTRMarshaler()
{
LIMITED_METHOD_CONTRACT;
m_fCoMemoryAllocated = false;
}
#endif // _DEBUG
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertSpaceCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertSpaceAndContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertSpaceAndContentsCLRToNativeTemp(ILCodeStream* pslILEmit);
virtual void EmitConvertSpaceNativeToCLR(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual void EmitConvertSpaceAndContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual bool NeedsClearNative();
virtual void EmitClearNative(ILCodeStream* pslILEmit);
virtual void EmitClearNativeTemp(ILCodeStream* pslILEmit);
static bool CanUsePinnedManagedString(DWORD dwMarshalFlags);
static void EmitCheckManagedStringLength(ILCodeStream* pslILEmit);
static void EmitCheckNativeStringLength(ILCodeStream* pslILEmit);
};
// A marshaler that makes run-time decision based on argument size whether native space will
// be allocated using localloc or on the heap. The ctor argument is a heap free function.
class ILOptimizedAllocMarshaler : public ILMarshaler
{
public:
ILOptimizedAllocMarshaler(BinderMethodID clearNat) :
m_idClearNative(clearNat),
m_dwLocalBuffer((DWORD)-1)
{
LIMITED_METHOD_CONTRACT;
}
virtual LocalDesc GetNativeType();
virtual bool NeedsClearNative();
virtual void EmitClearNative(ILCodeStream* pslILEmit);
protected:
const BinderMethodID m_idClearNative;
DWORD m_dwLocalBuffer; // localloc'ed temp buffer variable or -1 if not used
};
class ILUTF8BufferMarshaler : public ILOptimizedAllocMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
c_nativeSize = sizeof(void *),
c_CLRSize = sizeof(OBJECTREF),
};
enum
{
// If required buffer length > MAX_LOCAL_BUFFER_LENGTH, don't optimize by allocating memory on stack
MAX_LOCAL_BUFFER_LENGTH = MAX_PATH_FNAME + 1
};
ILUTF8BufferMarshaler() :
ILOptimizedAllocMarshaler(METHOD__WIN32NATIVE__COTASKMEMFREE)
{
LIMITED_METHOD_CONTRACT;
}
virtual LocalDesc GetManagedType();
virtual void EmitConvertSpaceCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertSpaceNativeToCLR(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
};
class ILWSTRBufferMarshaler : public ILOptimizedAllocMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
c_nativeSize = sizeof(void *),
c_CLRSize = sizeof(OBJECTREF),
};
enum
{
// If required buffer length > MAX_LOCAL_BUFFER_LENGTH, don't optimize by allocating memory on stack
MAX_LOCAL_BUFFER_LENGTH = (MAX_PATH_FNAME + 1) * 2
};
ILWSTRBufferMarshaler() :
ILOptimizedAllocMarshaler(METHOD__WIN32NATIVE__COTASKMEMFREE)
{
LIMITED_METHOD_CONTRACT;
}
virtual LocalDesc GetManagedType();
virtual void EmitConvertSpaceCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertSpaceNativeToCLR(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
};
class ILCSTRBufferMarshaler : public ILOptimizedAllocMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
c_nativeSize = sizeof(void *),
c_CLRSize = sizeof(OBJECTREF),
};
enum
{
// If required buffer length > MAX_LOCAL_BUFFER_LENGTH, don't optimize by allocating memory on stack
MAX_LOCAL_BUFFER_LENGTH = MAX_PATH_FNAME + 1
};
ILCSTRBufferMarshaler() :
ILOptimizedAllocMarshaler(METHOD__WIN32NATIVE__COTASKMEMFREE)
{
LIMITED_METHOD_CONTRACT;
}
virtual LocalDesc GetManagedType();
virtual void EmitConvertSpaceCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertSpaceNativeToCLR(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
};
class ILHandleRefMarshaler : public ILMarshaler
{
// Managed layout for SRI.HandleRef class
struct HANDLEREF
{
OBJECTREF m_wrapper;
LPVOID m_handle;
};
public:
enum
{
c_fInOnly = FALSE,
c_nativeSize = sizeof(LPVOID),
c_CLRSize = sizeof(HANDLEREF),
};
LocalDesc GetManagedType()
{
LIMITED_METHOD_CONTRACT;
return LocalDesc();
}
LocalDesc GetNativeType()
{
LIMITED_METHOD_CONTRACT;
return LocalDesc();
}
static MarshalerOverrideStatus ArgumentOverride(NDirectStubLinker* psl,
BOOL byref,
BOOL fin,
BOOL fout,
BOOL fManagedToNative,
OverrideProcArgs* pargs,
UINT* pResID,
UINT argidx,
UINT nativeStackOffset);
static MarshalerOverrideStatus ReturnOverride(NDirectStubLinker* psl,
BOOL fManagedToNative,
BOOL fHresultSwap,
OverrideProcArgs* pargs,
UINT* pResID);
};
class ILSafeHandleMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
c_nativeSize = sizeof(LPVOID),
c_CLRSize = sizeof(SAFEHANDLE),
};
virtual LocalDesc GetManagedType();
virtual LocalDesc GetNativeType();
virtual bool NeedsClearNative();
virtual void EmitClearNative(ILCodeStream* pslILEmit);
virtual void EmitMarshalArgumentCLRToNative();
static MarshalerOverrideStatus ArgumentOverride(NDirectStubLinker* psl,
BOOL byref,
BOOL fin,
BOOL fout,
BOOL fManagedToNative,
OverrideProcArgs* pargs,
UINT* pResID,
UINT argidx,
UINT nativeStackOffset);
static MarshalerOverrideStatus ReturnOverride(NDirectStubLinker *psl,
BOOL fManagedToNative,
BOOL fHresultSwap,
OverrideProcArgs *pargs,
UINT *pResID);
};
class ILCriticalHandleMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
c_nativeSize = sizeof(LPVOID),
c_CLRSize = sizeof(CRITICALHANDLE),
};
public:
LocalDesc GetManagedType()
{
LIMITED_METHOD_CONTRACT;
return LocalDesc();
}
LocalDesc GetNativeType()
{
LIMITED_METHOD_CONTRACT;
return LocalDesc();
}
static MarshalerOverrideStatus ArgumentOverride(NDirectStubLinker* psl,
BOOL byref,
BOOL fin,
BOOL fout,
BOOL fManagedToNative,
OverrideProcArgs* pargs,
UINT* pResID,
UINT argidx,
UINT nativeStackOffset);
static MarshalerOverrideStatus ReturnOverride(NDirectStubLinker *psl,
BOOL fManagedToNative,
BOOL fHresultSwap,
OverrideProcArgs *pargs,
UINT *pResID);
};
class ILValueClassMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = VARIABLESIZE,
c_CLRSize = VARIABLESIZE,
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitReInitNative(ILCodeStream* pslILEmit);
virtual bool NeedsClearNative();
virtual void EmitClearNative(ILCodeStream * pslILEmit);
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
};
#ifdef FEATURE_COMINTEROP
class ILObjectMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_CLRSize = sizeof(OBJECTREF),
c_nativeSize = sizeof(VARIANT),
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual bool NeedsClearNative();
virtual void EmitClearNative(ILCodeStream* pslILEmit);
virtual void EmitReInitNative(ILCodeStream* pslILEmit);
};
#endif // FEATURE_COMINTEROP
class ILDateMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(DATE),
c_CLRSize = sizeof(INT64),
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual void EmitReInitNative(ILCodeStream* pslILEmit);
};
class ILCurrencyMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(CURRENCY),
c_CLRSize = sizeof(DECIMAL),
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitReInitNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
};
#ifdef FEATURE_COMINTEROP
class ILInterfaceMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(void *),
c_CLRSize = sizeof(OBJECTREF),
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual bool NeedsClearNative();
virtual void EmitClearNative(ILCodeStream* pslILEmit);
};
#endif // FEATURE_COMINTEROP
class ILAnsiCharMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(UINT8),
c_CLRSize = sizeof(UINT16),
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
};
template <BinderClassID CLASS__ID, class ELEMENT>
class ILValueClassPtrMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(ELEMENT *),
c_CLRSize = sizeof(ELEMENT),
};
protected:
virtual LocalDesc GetNativeType()
{
LIMITED_METHOD_CONTRACT;
//
// pointer to value class
//
return LocalDesc(ELEMENT_TYPE_I);
}
virtual LocalDesc GetManagedType()
{
STANDARD_VM_CONTRACT;
//
// value class
//
return LocalDesc(MscorlibBinder::GetClass(CLASS__ID));
}
virtual bool NeedsClearNative()
{
LIMITED_METHOD_CONTRACT;
return (IsByref(m_dwMarshalFlags) && IsOut(m_dwMarshalFlags));
}
virtual void EmitClearNative(ILCodeStream* pslILEmit)
{
STANDARD_VM_CONTRACT;
EmitLoadNativeValue(pslILEmit);
// static void CoTaskMemFree(IntPtr ptr)
pslILEmit->EmitCALL(METHOD__WIN32NATIVE__COTASKMEMFREE, 1, 0);
}
virtual void EmitConvertSpaceCLRToNative(ILCodeStream* pslILEmit)
{
STANDARD_VM_CONTRACT;
if (NeedsClearNative())
{
pslILEmit->EmitLDC(sizeof(ELEMENT));
pslILEmit->EmitCONV_U();
// static IntPtr CoTaskMemAlloc(UIntPtr cb)
pslILEmit->EmitCALL(METHOD__WIN32NATIVE__COTASKMEMALLOC, 1, 1);
EmitStoreNativeValue(pslILEmit);
}
}
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit)
{
STANDARD_VM_CONTRACT;
if (NeedsClearNative())
{
EmitLoadNativeValue(pslILEmit); // dest
EmitLoadManagedHomeAddr(pslILEmit); // src
pslILEmit->EmitCPOBJ(pslILEmit->GetToken(MscorlibBinder::GetClass(CLASS__ID)));
}
else
{
EmitLoadManagedHomeAddr(pslILEmit);
EmitStoreNativeValue(pslILEmit);
}
}
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit)
{
STANDARD_VM_CONTRACT;
int tokType = pslILEmit->GetToken(MscorlibBinder::GetClass(CLASS__ID));
ILCodeLabel *pNullLabel = pslILEmit->NewCodeLabel();
ILCodeLabel *pJoinLabel = pslILEmit->NewCodeLabel();
EmitLoadNativeValue(pslILEmit);
pslILEmit->EmitBRFALSE(pNullLabel);
// the incoming pointer is non-null -> dereference it and copy the struct
EmitLoadManagedHomeAddr(pslILEmit); // dest
EmitLoadNativeValue(pslILEmit); // src
pslILEmit->EmitCPOBJ(tokType);
pslILEmit->EmitBR(pJoinLabel);
// the incoming pointer is null -> just initobj (i.e. zero) the struct
pslILEmit->EmitLabel(pNullLabel);
EmitLoadManagedHomeAddr(pslILEmit);
pslILEmit->EmitINITOBJ(tokType);
pslILEmit->EmitLabel(pJoinLabel);
}
};
typedef ILValueClassPtrMarshaler<CLASS__GUID, GUID> ILGuidPtrMarshaler;
typedef ILValueClassPtrMarshaler<CLASS__DECIMAL, DECIMAL> ILDecimalPtrMarshaler;
#ifdef FEATURE_COMINTEROP
class ILOleColorMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(OLE_COLOR),
c_CLRSize = sizeof(SYSTEMCOLOR),
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
};
class ILVBByValStrWMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
c_nativeSize = sizeof(BSTR),
c_CLRSize = sizeof(OBJECTREF*),
};
enum
{
// If required buffer length > MAX_LOCAL_BUFFER_LENGTH, don't optimize by allocating memory on stack
MAX_LOCAL_BUFFER_LENGTH = (MAX_PATH_FNAME + 1) * 2 + sizeof(DWORD)
};
ILVBByValStrWMarshaler() :
m_dwCCHLocal(-1)
,m_dwLocalBuffer(-1)
{
LIMITED_METHOD_CONTRACT;
}
virtual bool SupportsArgumentMarshal(DWORD dwMarshalFlags, UINT* pErrorResID);
virtual bool SupportsReturnMarshal(DWORD dwMarshalFlags, UINT* pErrorResID);
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual bool NeedsClearNative();
virtual void EmitClearNative(ILCodeStream* pslILEmit);
virtual bool IsNativePassedByRef();
DWORD m_dwCCHLocal;
DWORD m_dwLocalBuffer;
};
class ILVBByValStrMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
c_nativeSize = sizeof(LPSTR),
c_CLRSize = sizeof(OBJECTREF *),
};
ILVBByValStrMarshaler() :
m_dwCCHLocal(-1)
{
LIMITED_METHOD_CONTRACT;
}
virtual bool SupportsArgumentMarshal(DWORD dwMarshalFlags, UINT* pErrorResID);
virtual bool SupportsReturnMarshal(DWORD dwMarshalFlags, UINT* pErrorResID);
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual bool NeedsClearNative();
virtual void EmitClearNative(ILCodeStream* pslILEmit);
virtual bool IsNativePassedByRef();
DWORD m_dwCCHLocal;
};
class ILHSTRINGMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
c_nativeSize = sizeof(HSTRING),
c_CLRSize = sizeof(OBJECTREF),
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
void EmitConvertCLRToHSTRINGReference(ILCodeStream* pslILEmit);
void EmitConvertCLRToHSTRING(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual bool NeedsClearNative();
virtual void EmitClearNative(ILCodeStream* pslILEmit);
};
#endif // FEATURE_COMINTEROP
class ILCUTF8Marshaler : public ILOptimizedAllocMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(void *),
c_CLRSize = sizeof(OBJECTREF),
};
enum
{
// If required buffer length > MAX_LOCAL_BUFFER_LENGTH, don't optimize by allocating memory on stack
MAX_LOCAL_BUFFER_LENGTH = MAX_PATH_FNAME + 1
};
ILCUTF8Marshaler() :
ILOptimizedAllocMarshaler(METHOD__CSTRMARSHALER__CLEAR_NATIVE)
{
LIMITED_METHOD_CONTRACT;
}
protected:
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
};
class ILCSTRMarshaler : public ILOptimizedAllocMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(void *),
c_CLRSize = sizeof(OBJECTREF),
};
enum
{
// If required buffer length > MAX_LOCAL_BUFFER_LENGTH, don't optimize by allocating memory on stack
MAX_LOCAL_BUFFER_LENGTH = MAX_PATH_FNAME + 1
};
ILCSTRMarshaler() :
ILOptimizedAllocMarshaler(METHOD__CSTRMARSHALER__CLEAR_NATIVE)
{
LIMITED_METHOD_CONTRACT;
}
protected:
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
};
#ifdef FEATURE_COMINTEROP
class ILBSTRMarshaler : public ILOptimizedAllocMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(void *),
c_CLRSize = sizeof(OBJECTREF),
};
enum
{
// If required buffer length > MAX_LOCAL_BUFFER_LENGTH, don't optimize by allocating memory on stack
MAX_LOCAL_BUFFER_LENGTH = (MAX_PATH_FNAME + 1) * 2 + 4
};
ILBSTRMarshaler() :
ILOptimizedAllocMarshaler(METHOD__BSTRMARSHALER__CLEAR_NATIVE)
{
LIMITED_METHOD_CONTRACT;
}
protected:
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
};
class ILAnsiBSTRMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(void *),
c_CLRSize = sizeof(OBJECTREF),
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual bool NeedsClearNative();
virtual void EmitClearNative(ILCodeStream* pslILEmit);
};
#endif // FEATURE_COMINTEROP
class ILLayoutClassPtrMarshalerBase : public ILMarshaler
{
public:
enum
{
c_nativeSize = sizeof(void *),
c_CLRSize = sizeof(OBJECTREF),
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertSpaceCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertSpaceCLRToNativeTemp(ILCodeStream* pslILEmit);
virtual void EmitConvertSpaceAndContentsCLRToNativeTemp(ILCodeStream* pslILEmit);
virtual void EmitConvertSpaceNativeToCLR(ILCodeStream* pslILEmit);
virtual bool NeedsClearNative();
virtual void EmitClearNative(ILCodeStream* pslILEmit);
virtual void EmitClearNativeTemp(ILCodeStream* pslILEmit);
};
class ILLayoutClassPtrMarshaler : public ILLayoutClassPtrMarshalerBase
{
public:
enum
{
c_fInOnly = FALSE,
};
protected:
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual void EmitClearNativeContents(ILCodeStream * pslILEmit);
};
class ILBlittablePtrMarshaler : public ILLayoutClassPtrMarshalerBase
{
public:
enum
{
c_fInOnly = FALSE,
};
protected:
virtual void EmitMarshalArgumentCLRToNative();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
};
#ifndef FEATURE_CORECLR
class ILBlittableValueClassWithCopyCtorMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = VARIABLESIZE,
c_CLRSize = sizeof(OBJECTREF),
};
LocalDesc GetManagedType()
{
LIMITED_METHOD_CONTRACT;
return LocalDesc();
}
LocalDesc GetNativeType()
{
LIMITED_METHOD_CONTRACT;
return LocalDesc();
}
static MarshalerOverrideStatus ArgumentOverride(NDirectStubLinker* psl,
BOOL byref,
BOOL fin,
BOOL fout,
BOOL fManagedToNative,
OverrideProcArgs* pargs,
UINT* pResID,
UINT argidx,
UINT nativeStackOffset);
};
#endif // !FEATURE_CORECLR
class ILArgIteratorMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(va_list),
c_CLRSize = sizeof(VARARGS),
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual bool SupportsArgumentMarshal(DWORD dwMarshalFlags, UINT* pErrorResID);
virtual void EmitMarshalArgumentCLRToNative();
virtual void EmitMarshalArgumentNativeToCLR();
};
class ILArrayWithOffsetMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
c_nativeSize = sizeof(LPVOID),
c_CLRSize = sizeof(ArrayWithOffsetData),
};
ILArrayWithOffsetMarshaler() :
m_dwCountLocalNum(-1),
m_dwOffsetLocalNum(-1),
m_dwPinnedLocalNum(-1)
{
LIMITED_METHOD_CONTRACT;
}
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual bool SupportsArgumentMarshal(DWORD dwMarshalFlags, UINT* pErrorResID);
virtual void EmitConvertSpaceAndContentsCLRToNativeTemp(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual void EmitClearNativeTemp(ILCodeStream* pslILEmit);
DWORD m_dwCountLocalNum;
DWORD m_dwOffsetLocalNum;
DWORD m_dwPinnedLocalNum;
};
class ILAsAnyMarshalerBase : public ILMarshaler
{
public:
enum
{
c_nativeSize = sizeof(void *),
c_CLRSize = sizeof(OBJECTREF),
};
ILAsAnyMarshalerBase() :
m_dwMarshalerLocalNum(-1)
{
LIMITED_METHOD_CONTRACT;
}
protected:
static const BYTE ML_IN = 0x10;
static const BYTE ML_OUT = 0x20;
virtual bool IsAnsi() = 0;
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual bool SupportsArgumentMarshal(DWORD dwMarshalFlags, UINT* pErrorResID);
virtual bool SupportsReturnMarshal(DWORD dwMarshalFlags, UINT* pErrorResID);
virtual void EmitMarshalArgumentCLRToNative();
virtual bool NeedsClearNative();
virtual void EmitClearNativeTemp(ILCodeStream* pslILEmit);
DWORD m_dwMarshalerLocalNum;
};
class ILAsAnyWMarshaler : public ILAsAnyMarshalerBase
{
public:
enum
{
c_fInOnly = FALSE,
};
protected:
virtual bool IsAnsi()
{
return false;
}
};
class ILAsAnyAMarshaler : public ILAsAnyMarshalerBase
{
public:
enum
{
c_fInOnly = FALSE,
};
protected:
virtual bool IsAnsi()
{
return true;
}
};
class ILMngdMarshaler : public ILMarshaler
{
public:
enum
{
c_nativeSize = sizeof(void *),
c_CLRSize = sizeof(OBJECTREF),
};
ILMngdMarshaler(BinderMethodID space2Man,
BinderMethodID contents2Man,
BinderMethodID space2Nat,
BinderMethodID contents2Nat,
BinderMethodID clearNat,
BinderMethodID clearNatContents,
BinderMethodID clearMan) :
m_idConvertSpaceToManaged(space2Man),
m_idConvertContentsToManaged(contents2Man),
m_idConvertSpaceToNative(space2Nat),
m_idConvertContentsToNative(contents2Nat),
m_idClearNative(clearNat),
m_idClearNativeContents(clearNatContents),
m_idClearManaged(clearMan)
{
LIMITED_METHOD_CONTRACT;
}
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitCreateMngdMarshaler(ILCodeStream* pslILEmit) = 0;
virtual void EmitCallMngdMarshalerMethod(ILCodeStream* pslILEmit, MethodDesc *pMD);
virtual void EmitConvertSpaceNativeToCLR(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
EmitCallMngdMarshalerMethod(pslILEmit, GetConvertSpaceToManagedMethod());
}
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
EmitCallMngdMarshalerMethod(pslILEmit, GetConvertContentsToManagedMethod());
}
virtual void EmitConvertSpaceCLRToNative(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
EmitCallMngdMarshalerMethod(pslILEmit, GetConvertSpaceToNativeMethod());
}
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
EmitCallMngdMarshalerMethod(pslILEmit, GetConvertContentsToNativeMethod());
}
virtual bool NeedsClearNative()
{
LIMITED_METHOD_CONTRACT;
if (NULL != GetClearNativeMethod())
{
return true;
}
return false;
}
virtual void EmitClearNative(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
EmitCallMngdMarshalerMethod(pslILEmit, GetClearNativeMethod());
}
virtual void EmitClearNativeContents(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
EmitCallMngdMarshalerMethod(pslILEmit, GetClearNativeContentsMethod());
}
virtual bool NeedsClearCLR()
{
LIMITED_METHOD_CONTRACT;
if (NULL != GetClearManagedMethod())
{
return true;
}
return false;
}
virtual void EmitClearCLR(ILCodeStream* pslILEmit)
{
WRAPPER_NO_CONTRACT;
EmitCallMngdMarshalerMethod(pslILEmit, GetClearManagedMethod());
}
virtual MethodDesc *GetConvertSpaceToManagedMethod() { WRAPPER_NO_CONTRACT; return (m_idConvertSpaceToManaged == METHOD__NIL ? NULL : MscorlibBinder::GetMethod(m_idConvertSpaceToManaged)); }
virtual MethodDesc *GetConvertContentsToManagedMethod() { WRAPPER_NO_CONTRACT; return (m_idConvertContentsToManaged == METHOD__NIL ? NULL : MscorlibBinder::GetMethod(m_idConvertContentsToManaged)); }
virtual MethodDesc *GetConvertSpaceToNativeMethod() { WRAPPER_NO_CONTRACT; return (m_idConvertSpaceToNative == METHOD__NIL ? NULL : MscorlibBinder::GetMethod(m_idConvertSpaceToNative)); }
virtual MethodDesc *GetConvertContentsToNativeMethod() { WRAPPER_NO_CONTRACT; return (m_idConvertContentsToNative == METHOD__NIL ? NULL : MscorlibBinder::GetMethod(m_idConvertContentsToNative)); }
virtual MethodDesc *GetClearNativeMethod() { WRAPPER_NO_CONTRACT; return (m_idClearNative == METHOD__NIL ? NULL : MscorlibBinder::GetMethod(m_idClearNative)); }
virtual MethodDesc *GetClearNativeContentsMethod() { WRAPPER_NO_CONTRACT; return (m_idClearNativeContents == METHOD__NIL ? NULL : MscorlibBinder::GetMethod(m_idClearNativeContents)); }
virtual MethodDesc *GetClearManagedMethod() { WRAPPER_NO_CONTRACT; return (m_idClearManaged == METHOD__NIL ? NULL : MscorlibBinder::GetMethod(m_idClearManaged)); }
const BinderMethodID m_idConvertSpaceToManaged;
const BinderMethodID m_idConvertContentsToManaged;
const BinderMethodID m_idConvertSpaceToNative;
const BinderMethodID m_idConvertContentsToNative;
const BinderMethodID m_idClearNative;
const BinderMethodID m_idClearNativeContents;
const BinderMethodID m_idClearManaged;
};
class ILNativeArrayMarshaler : public ILMngdMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
};
ILNativeArrayMarshaler() :
ILMngdMarshaler(
METHOD__MNGD_NATIVE_ARRAY_MARSHALER__CONVERT_SPACE_TO_MANAGED,
METHOD__MNGD_NATIVE_ARRAY_MARSHALER__CONVERT_CONTENTS_TO_MANAGED,
METHOD__MNGD_NATIVE_ARRAY_MARSHALER__CONVERT_SPACE_TO_NATIVE,
METHOD__MNGD_NATIVE_ARRAY_MARSHALER__CONVERT_CONTENTS_TO_NATIVE,
METHOD__MNGD_NATIVE_ARRAY_MARSHALER__CLEAR_NATIVE,
METHOD__MNGD_NATIVE_ARRAY_MARSHALER__CLEAR_NATIVE_CONTENTS,
METHOD__NIL
)
{
LIMITED_METHOD_CONTRACT;
m_dwSavedSizeArg = LOCAL_NUM_UNUSED;
}
virtual void EmitMarshalArgumentCLRToNative();
virtual void EmitConvertSpaceNativeToCLR(ILCodeStream* pslILEmit);
virtual void EmitConvertSpaceCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitClearNative(ILCodeStream* pslILEmit);
virtual void EmitClearNativeContents(ILCodeStream* pslILEmit);
virtual void EmitMarshalArgumentNativeToCLRByref();
virtual void EmitMarshalArgumentCLRToNativeByref();
protected:
bool UsePinnedArraySpecialCase();
BOOL CheckSizeParamIndexArg(const CREATE_MARSHALER_CARRAY_OPERANDS &mops, CorElementType *pElementType);
// Calculate element count and load it on evaluation stack
void EmitLoadElementCount(ILCodeStream* pslILEmit);
virtual void EmitCreateMngdMarshaler(ILCodeStream* pslILEmit);
void EmitLoadNativeSize(ILCodeStream* pslILEmit);
void EmitNewSavedSizeArgLocal();
private :
DWORD m_dwSavedSizeArg;
};
class MngdNativeArrayMarshaler
{
public:
static FCDECL3(void, CreateMarshaler, MngdNativeArrayMarshaler* pThis, MethodTable* pMT, UINT32 dwFlags);
static FCDECL3(void, ConvertSpaceToNative, MngdNativeArrayMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome);
static FCDECL3(void, ConvertContentsToNative, MngdNativeArrayMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome);
static FCDECL4(void, ConvertSpaceToManaged, MngdNativeArrayMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome, INT32 cElements);
static FCDECL3(void, ConvertContentsToManaged, MngdNativeArrayMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome);
static FCDECL3(void, ClearNative, MngdNativeArrayMarshaler* pThis, void** pNativeHome, INT32 cElements);
static FCDECL3(void, ClearNativeContents, MngdNativeArrayMarshaler* pThis, void** pNativeHome, INT32 cElements);
static void DoClearNativeContents(MngdNativeArrayMarshaler* pThis, void** pNativeHome, INT32 cElements);
enum
{
FLAG_NATIVE_DATA_VALID = 0x40000000
};
MethodTable* m_pElementMT;
TypeHandle m_Array;
BOOL m_NativeDataValid;
BOOL m_BestFitMap;
BOOL m_ThrowOnUnmappableChar;
VARTYPE m_vt;
};
#ifdef FEATURE_COMINTEROP
class ILSafeArrayMarshaler : public ILMngdMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
};
ILSafeArrayMarshaler() :
ILMngdMarshaler(
METHOD__MNGD_SAFE_ARRAY_MARSHALER__CONVERT_SPACE_TO_MANAGED,
METHOD__MNGD_SAFE_ARRAY_MARSHALER__CONVERT_CONTENTS_TO_MANAGED,
METHOD__MNGD_SAFE_ARRAY_MARSHALER__CONVERT_SPACE_TO_NATIVE,
METHOD__MNGD_SAFE_ARRAY_MARSHALER__CONVERT_CONTENTS_TO_NATIVE,
METHOD__MNGD_SAFE_ARRAY_MARSHALER__CLEAR_NATIVE,
METHOD__NIL,
METHOD__NIL
),
m_dwOriginalManagedLocalNum(-1)
{
LIMITED_METHOD_CONTRACT;
}
protected:
virtual void EmitCreateMngdMarshaler(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitReInitNative(ILCodeStream* pslILEmit)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;
if (NeedsCheckForStatic() && pslILEmit->GetStreamType() != ILStubLinker::kExceptionCleanup)
{
// Keep the original value in native home as we are not going to allocate a new
// one. If we cleared it here, we wouldn't be able to ConvertContentsToNative.
// Always perform the real re-init in the ExceptionCleanup stream so the caller
// doesn't get back garbage.
}
else
{
ILMngdMarshaler::EmitReInitNative(pslILEmit);
}
}
bool NeedsCheckForStatic()
{
WRAPPER_NO_CONTRACT;
return IsByref(m_dwMarshalFlags) && !IsCLRToNative(m_dwMarshalFlags) && IsIn(m_dwMarshalFlags) && IsOut(m_dwMarshalFlags);
}
DWORD m_dwOriginalManagedLocalNum;
};
class MngdSafeArrayMarshaler
{
public:
static FCDECL4(void, CreateMarshaler, MngdSafeArrayMarshaler* pThis, MethodTable* pMT, UINT32 iRank, UINT32 dwFlags);
static FCDECL3(void, ConvertSpaceToNative, MngdSafeArrayMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome);
static FCDECL4(void, ConvertContentsToNative, MngdSafeArrayMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome, Object* pOriginalManagedUNSAFE);
static FCDECL3(void, ConvertSpaceToManaged, MngdSafeArrayMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome);
static FCDECL3(void, ConvertContentsToManaged, MngdSafeArrayMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome);
static FCDECL3(void, ClearNative, MngdSafeArrayMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome);
enum StaticCheckStateFlags
{
SCSF_CheckForStatic = 1,
SCSF_IsStatic = 2,
SCSF_NativeDataValid = 4
};
MethodTable* m_pElementMT;
int m_iRank;
VARTYPE m_vt;
BYTE m_fStatic; // StaticCheckStateFlags
BYTE m_nolowerbounds;
};
class ILHiddenLengthArrayMarshaler : public ILMngdMarshaler
{
friend class MngdHiddenLengthArrayMarshaler;
public:
enum
{
c_nativeSize = sizeof(LPVOID),
c_CLRSize = sizeof(OBJECTREF),
c_fInOnly = FALSE,
};
ILHiddenLengthArrayMarshaler() :
ILMngdMarshaler(METHOD__MNGD_HIDDEN_LENGTH_ARRAY_MARSHALER__CONVERT_SPACE_TO_MANAGED,
METHOD__MNGD_HIDDEN_LENGTH_ARRAY_MARSHALER__CONVERT_CONTENTS_TO_MANAGED,
METHOD__MNGD_HIDDEN_LENGTH_ARRAY_MARSHALER__CONVERT_SPACE_TO_NATIVE,
METHOD__MNGD_HIDDEN_LENGTH_ARRAY_MARSHALER__CONVERT_CONTENTS_TO_NATIVE,
METHOD__WIN32NATIVE__COTASKMEMFREE,
METHOD__MNGD_HIDDEN_LENGTH_ARRAY_MARSHALER__CLEAR_NATIVE_CONTENTS,
METHOD__NIL)
{
LIMITED_METHOD_CONTRACT;
m_dwMngdMarshalerLocalNum = -1;
}
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitCreateMngdMarshaler(ILCodeStream* pslILEmit);
virtual void EmitMarshalArgumentCLRToNative();
virtual void EmitConvertSpaceCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertSpaceNativeToCLR(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual void EmitClearNative(ILCodeStream* pslILEmit);
virtual void EmitClearNativeContents(ILCodeStream* pslILEmit);
private:
bool CanUsePinnedArray();
void EmitLoadNativeArrayLength(ILCodeStream *pslILEmit);
virtual MethodDesc *GetConvertContentsToManagedMethod();
virtual MethodDesc *GetConvertContentsToNativeMethod();
virtual MethodDesc *GetClearNativeContentsMethod();
MethodDesc *GetExactMarshalerMethod(MethodDesc *pGenericMD);
};
class MngdHiddenLengthArrayMarshaler
{
public:
static FCDECL4(void, CreateMarshaler, MngdHiddenLengthArrayMarshaler* pThis, MethodTable* pMT, SIZE_T cbElement, UINT16 vt);
static FCDECL3(void, ConvertSpaceToNative, MngdHiddenLengthArrayMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome);
static FCDECL3(void, ConvertContentsToNative, MngdHiddenLengthArrayMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome);
static FCDECL4(void, ConvertSpaceToManaged, MngdHiddenLengthArrayMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome, INT32 cElements);
static FCDECL3(void, ConvertContentsToManaged, MngdHiddenLengthArrayMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome);
static FCDECL3(void, ClearNativeContents, MngdHiddenLengthArrayMarshaler* pThis, void** pNativeHome, INT32 cElements);
private:
SIZE_T GetArraySize(SIZE_T elements);
void DoClearNativeContents(void** pNativeHome, INT32 cElements);
private:
MethodTable *m_pElementMT;
SIZE_T m_cbElementSize;
VARTYPE m_vt;
};
#endif // FEATURE_COMINTEROP
class ILReferenceCustomMarshaler : public ILMngdMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
};
ILReferenceCustomMarshaler() :
ILMngdMarshaler(
METHOD__NIL,
METHOD__MNGD_REF_CUSTOM_MARSHALER__CONVERT_CONTENTS_TO_MANAGED,
METHOD__NIL,
METHOD__MNGD_REF_CUSTOM_MARSHALER__CONVERT_CONTENTS_TO_NATIVE,
METHOD__MNGD_REF_CUSTOM_MARSHALER__CLEAR_NATIVE,
METHOD__NIL,
METHOD__MNGD_REF_CUSTOM_MARSHALER__CLEAR_MANAGED
)
{
LIMITED_METHOD_CONTRACT;
}
protected:
virtual void EmitCreateMngdMarshaler(ILCodeStream* pslILEmit);
};
class MngdRefCustomMarshaler
{
public:
static FCDECL2(void, CreateMarshaler, MngdRefCustomMarshaler* pThis, void* pCMHelper);
static FCDECL3(void, ConvertContentsToNative, MngdRefCustomMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome);
static FCDECL3(void, ConvertContentsToManaged, MngdRefCustomMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome);
static FCDECL3(void, ClearNative, MngdRefCustomMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome);
static FCDECL3(void, ClearManaged, MngdRefCustomMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome);
static void DoClearNativeContents(MngdRefCustomMarshaler* pThis, OBJECTREF* pManagedHome, void** pNativeHome);
CustomMarshalerHelper* m_pCMHelper;
};
#ifdef FEATURE_COMINTEROP
class ILUriMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(LPVOID),
c_CLRSize = sizeof(OBJECTREF),
};
static void EmitConvertCLRUriToWinRTUri(ILCodeStream* pslILEmit, BaseDomain* pDomain);
static void EmitConvertWinRTUriToCLRUri(ILCodeStream* pslILEmit, BaseDomain* pDomain);
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual bool NeedsClearNative();
void EmitClearNative(ILCodeStream* pslILEmit);
};
class ILNCCEventArgsMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(LPVOID),
c_CLRSize = sizeof(OBJECTREF),
};
static void EmitConvertCLREventArgsToWinRTEventArgs(ILCodeStream* pslILEmit, BaseDomain* pDomain);
static void EmitConvertWinRTEventArgsToCLREventArgs(ILCodeStream* pslILEmit, BaseDomain* pDomain);
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual bool NeedsClearNative();
void EmitClearNative(ILCodeStream* pslILEmit);
};
class ILPCEventArgsMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = TRUE,
c_nativeSize = sizeof(LPVOID),
c_CLRSize = sizeof(OBJECTREF),
};
static void EmitConvertCLREventArgsToWinRTEventArgs(ILCodeStream* pslILEmit, BaseDomain* pDomain);
static void EmitConvertWinRTEventArgsToCLREventArgs(ILCodeStream* pslILEmit, BaseDomain* pDomain);
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual bool NeedsClearNative();
void EmitClearNative(ILCodeStream* pslILEmit);
};
class ILDateTimeMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
c_nativeSize = sizeof(INT64), // = sizeof(Windows::Foundation::DateTime)
c_CLRSize = VARIABLESIZE,
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual bool NeedsClearNative();
virtual void EmitReInitNative(ILCodeStream* pslILEmit);
};
class ILNullableMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
c_nativeSize = sizeof(LPVOID),
c_CLRSize = VARIABLESIZE,
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual bool NeedsClearNative();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual void EmitClearNative(ILCodeStream* pslILEmit);
private:
MethodDesc *GetExactMarshalerMethod(MethodDesc *pGenericMD);
};
class ILSystemTypeMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
c_nativeSize = sizeof(TypeNameNative),
c_CLRSize = sizeof(OBJECTREF)
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream * pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream * pslILEmit);
virtual bool NeedsClearNative();
virtual void EmitClearNative(ILCodeStream * pslILEmit);
virtual void EmitReInitNative(ILCodeStream * pslILEmit);
};
class ILHResultExceptionMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
c_nativeSize = sizeof(INT32), // = sizeof(Windows::Foundation::HResult)
c_CLRSize = sizeof(OBJECTREF),
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual bool NeedsClearNative();
};
class ILKeyValuePairMarshaler : public ILMarshaler
{
public:
enum
{
c_fInOnly = FALSE,
c_nativeSize = sizeof(LPVOID),
c_CLRSize = VARIABLESIZE,
};
protected:
virtual LocalDesc GetNativeType();
virtual LocalDesc GetManagedType();
virtual bool NeedsClearNative();
virtual void EmitConvertContentsCLRToNative(ILCodeStream* pslILEmit);
virtual void EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmit);
virtual void EmitClearNative(ILCodeStream* pslILEmit);
private:
MethodDesc *GetExactMarshalerMethod(MethodDesc *pGenericMD);
};
#endif // FEATURE_COMINTEROP
| {
"content_hash": "17d623a88692b923db44f09f04e794af",
"timestamp": "",
"source": "github",
"line_count": 3413,
"max_line_length": 203,
"avg_line_length": 31.89950190448286,
"alnum_prop": 0.6095358812561424,
"repo_name": "schellap/coreclr",
"id": "1730eabb40fe8728034e57e31fb87aef9bdd60b7",
"size": "109402",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/vm/ilmarshalers.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "975466"
},
{
"name": "Awk",
"bytes": "5861"
},
{
"name": "Batchfile",
"bytes": "93432"
},
{
"name": "C",
"bytes": "6456687"
},
{
"name": "C#",
"bytes": "138694602"
},
{
"name": "C++",
"bytes": "69069375"
},
{
"name": "CMake",
"bytes": "589692"
},
{
"name": "Groff",
"bytes": "529523"
},
{
"name": "Groovy",
"bytes": "134594"
},
{
"name": "HTML",
"bytes": "16196"
},
{
"name": "Makefile",
"bytes": "2527"
},
{
"name": "Objective-C",
"bytes": "230707"
},
{
"name": "PAWN",
"bytes": "926"
},
{
"name": "Perl",
"bytes": "24550"
},
{
"name": "PowerShell",
"bytes": "8875"
},
{
"name": "Python",
"bytes": "106461"
},
{
"name": "Shell",
"bytes": "102485"
},
{
"name": "Smalltalk",
"bytes": "1496826"
},
{
"name": "Stata",
"bytes": "45"
},
{
"name": "SuperCollider",
"bytes": "4752"
},
{
"name": "Yacc",
"bytes": "157348"
}
],
"symlink_target": ""
} |
import Vue from 'vue';
// ====
const Event = new Vue();
// ====
export default Event; | {
"content_hash": "1adabdea2ad001d651fe7657adfdf883",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 24,
"avg_line_length": 9.88888888888889,
"alnum_prop": 0.5617977528089888,
"repo_name": "starkland/veggiemap",
"id": "846089de3bf5b915766b94f92aa50c883fdd44f2",
"size": "89",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/events/all.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "24622"
},
{
"name": "HTML",
"bytes": "4114"
},
{
"name": "JavaScript",
"bytes": "22698"
},
{
"name": "Vue",
"bytes": "20798"
}
],
"symlink_target": ""
} |
@echo off
:: Copy the icon to the temp folder
COPY RES\icon.ico %TEMP%\tic-tac-toe-icon.ico
:: Run 'pythonw --version' and put it into variable PYTHON_VERSION
FOR /F "tokens=* USEBACKQ" %%F IN (`pythonw --version`) DO (
SET PYTHON_VERSION=%%F
)
:: Check if Python 3 is installed
IF "%PYTHON_VERSION:~0,8%" == "Python 2" (
:: If Python 2 is installed, show the message
ECHO Your Python version is %PYTHON_VERSION%. You need to install Python 3 and set its path first.
mshta javascript:alert^("Your Python version is %PYTHON_VERSION%. \nYou need to install Python 3 and set its path first."^);close^(^);
start "" http://www.python.org/downloads/
exit /b
)
IF NOT "%PYTHON_VERSION:~0,8%" == "Python 3" (
:: If Python 3 is not installed, show the message
ECHO You need to install Python 3 first.
mshta javascript:alert^("You need to install Python 3 first."^);close^(^);
start "" http://www.python.org/downloads/
exit /b
)
:: Run the GUI python script
start "" pythonw ttt_client_gui.py | {
"content_hash": "15ad697144656ce113484f4f91fc56ea",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 135,
"avg_line_length": 35.57142857142857,
"alnum_prop": 0.6987951807228916,
"repo_name": "CharmySoft/tic-tac-toe-in-python",
"id": "1c1ae28a14e7608c32fb34e856883233fe00cce3",
"size": "996",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "start-game.bat",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "50592"
}
],
"symlink_target": ""
} |
{
var _this = this;
return new Promise(
(() => {
var _ref = babelHelpers.asyncToGenerator(function*(resolve) {
console.log(_this);
setTimeout(resolve, 1000);
});
return function(_x) {
return _ref.apply(this, arguments);
};
})()
);
}
| {
"content_hash": "cc387c5f0c67fd96e57a8e1f7eff4bdb",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 67,
"avg_line_length": 18.5625,
"alnum_prop": 0.5151515151515151,
"repo_name": "stas-vilchik/bdd-ml",
"id": "b5c12c3d5bfbaa1bc26abf0f5906799812dfcfac",
"size": "297",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "data/1138.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "6666795"
},
{
"name": "Python",
"bytes": "3199"
}
],
"symlink_target": ""
} |
using FluentAssertions;
using FsCheck;
using FsCheck.Xunit;
using NSubstitute;
using System;
using System.Threading.Tasks;
using Toggl.Core.Analytics;
using Toggl.Core.Interactors;
using Toggl.Core.Services;
using Toggl.Core.Tests.Generators;
using Xunit;
namespace Toggl.Core.Tests.Services
{
public sealed class BackgroundServiceTests
{
public abstract class BackgroundServiceTest
{
protected ITimeService TimeService { get; }
protected IAnalyticsService AnalyticsService { get; }
protected IUpdateRemoteConfigCacheService UpdateRemoteConfigCacheService { get; }
protected IUnsyncedDataPersistenceService UnsyncedDataPersistenceService { get; }
protected IInteractorFactory InteractorFactory { get; }
public BackgroundServiceTest()
{
TimeService = Substitute.For<ITimeService>();
AnalyticsService = Substitute.For<IAnalyticsService>();
UpdateRemoteConfigCacheService = Substitute.For<IUpdateRemoteConfigCacheService>();
UnsyncedDataPersistenceService = Substitute.For<IUnsyncedDataPersistenceService>();
InteractorFactory = Substitute.For<IInteractorFactory>();
}
}
public sealed class TheConstructor
{
[Theory, LogIfTooSlow]
[ConstructorData]
public void ThrowsWhenTheArgumentIsNull(bool useTimeService, bool useAnalyticsService, bool useRemoteConfigUpdateService, bool useUnsyncedDataPersistenceService, bool useInteractorFactory)
{
var timeService = useTimeService ? Substitute.For<ITimeService>() : null;
var analyticsService = useAnalyticsService ? Substitute.For<IAnalyticsService>() : null;
var updateRemoteConfigCacheService = useRemoteConfigUpdateService ? Substitute.For<IUpdateRemoteConfigCacheService>() : null;
var unsyncedDataPersistenceService = useUnsyncedDataPersistenceService ? Substitute.For<IUnsyncedDataPersistenceService>() : null;
var interactorFactory = useInteractorFactory ? Substitute.For<IInteractorFactory>() : null;
Action constructor = () => new BackgroundService(timeService, analyticsService, updateRemoteConfigCacheService, unsyncedDataPersistenceService, interactorFactory);
constructor.Should().Throw<ArgumentNullException>();
}
}
public sealed class TheAppResumedFromBackgroundMethod : BackgroundServiceTest
{
private readonly DateTimeOffset now = new DateTimeOffset(2017, 12, 11, 0, 30, 59, TimeSpan.Zero);
[Fact, LogIfTooSlow]
public void DoesNotEmitAnythingWhenItHasNotEnterBackgroundFirst()
{
bool emitted = false;
var backgroundService = new BackgroundService(TimeService, AnalyticsService, UpdateRemoteConfigCacheService, UnsyncedDataPersistenceService, InteractorFactory);
backgroundService
.AppResumedFromBackground
.Subscribe(_ => emitted = true);
backgroundService.EnterForeground();
emitted.Should().BeFalse();
}
[Fact, LogIfTooSlow]
public void EmitsValueWhenEnteringForegroundAfterBeingInBackground()
{
bool emitted = false;
var backgroundService = new BackgroundService(TimeService, AnalyticsService, UpdateRemoteConfigCacheService, UnsyncedDataPersistenceService, InteractorFactory);
TimeService.CurrentDateTime.Returns(now);
backgroundService
.AppResumedFromBackground
.Subscribe(_ => emitted = true);
backgroundService.EnterBackground();
backgroundService.EnterForeground();
emitted.Should().BeTrue();
}
[Fact, LogIfTooSlow]
public void DoesNotEmitAnythingWhenTheEnterForegroundIsCalledMultipleTimes()
{
bool emitted = false;
var backgroundService = new BackgroundService(TimeService, AnalyticsService, UpdateRemoteConfigCacheService, UnsyncedDataPersistenceService, InteractorFactory);
TimeService.CurrentDateTime.Returns(now);
backgroundService.EnterBackground();
TimeService.CurrentDateTime.Returns(now.AddMinutes(1));
backgroundService.EnterForeground();
TimeService.CurrentDateTime.Returns(now.AddMinutes(2));
backgroundService
.AppResumedFromBackground
.Subscribe(_ => emitted = true);
backgroundService.EnterForeground();
emitted.Should().BeFalse();
}
[Property]
public void EmitsAValueWhenEnteringForegroundAfterBeingInBackgroundForMoreThanTheLimit(NonNegativeInt waitingTime)
{
TimeSpan? resumedAfter = null;
var backgroundService = new BackgroundService(TimeService, AnalyticsService, UpdateRemoteConfigCacheService, UnsyncedDataPersistenceService, InteractorFactory);
backgroundService
.AppResumedFromBackground
.Subscribe(timeInBackground => resumedAfter = timeInBackground);
TimeService.CurrentDateTime.Returns(now);
backgroundService.EnterBackground();
TimeService.CurrentDateTime.Returns(now.AddMinutes(waitingTime.Get).AddSeconds(1));
backgroundService.EnterForeground();
resumedAfter.Should().NotBeNull();
resumedAfter.Should().BeGreaterThan(TimeSpan.FromMinutes(waitingTime.Get));
}
[Fact]
public void TracksEventWhenAppResumed()
{
var backgroundService = new BackgroundService(TimeService, AnalyticsService, UpdateRemoteConfigCacheService, UnsyncedDataPersistenceService, InteractorFactory);
backgroundService.EnterBackground();
backgroundService.EnterForeground();
AnalyticsService.Received().AppDidEnterForeground.Track();
}
[Fact]
public void TracksEventWhenAppGoesToBackground()
{
var backgroundService = new BackgroundService(TimeService, AnalyticsService, UpdateRemoteConfigCacheService, UnsyncedDataPersistenceService, InteractorFactory);
backgroundService.EnterBackground();
AnalyticsService.Received().AppSentToBackground.Track();
}
[Fact]
public void PersistsUnsyncedDataWhenAppGoesToBackground()
{
var backgroundService = new BackgroundService(TimeService, AnalyticsService, UpdateRemoteConfigCacheService, UnsyncedDataPersistenceService, InteractorFactory);
backgroundService.EnterBackground();
UnsyncedDataPersistenceService.Received().PersistUnsyncedData();
}
}
public sealed class TheEnterForegroundMethod : BackgroundServiceTest
{
[Fact, LogIfTooSlow]
public async Task TriggersRemoteConfigUpdateWhenRemoteConfigDataNeedsToBeUpdated()
{
var updateRemoteConfigCacheService = Substitute.For<IUpdateRemoteConfigCacheService>();
updateRemoteConfigCacheService.NeedsToUpdateStoredRemoteConfigData().Returns(true);
var backgroundService = new BackgroundService(TimeService, AnalyticsService, updateRemoteConfigCacheService, UnsyncedDataPersistenceService, InteractorFactory);
backgroundService.EnterForeground();
// This delay is make sure FetchAndStoreRemoteConfigData has time to execute, since it's called inside a
// fire and forget TaskTask.Run(() => {}).ConfigureAwait(false))
await Task.Delay(1);
updateRemoteConfigCacheService.Received().FetchAndStoreRemoteConfigData();
}
[Fact, LogIfTooSlow]
public async Task DoesNotTriggerRemoteConfigUpdateWhenRemoteConfigDataDoesNotNeedToBeUpdated()
{
var updateRemoteConfigCacheService = Substitute.For<IUpdateRemoteConfigCacheService>();
updateRemoteConfigCacheService.NeedsToUpdateStoredRemoteConfigData().Returns(false);
var backgroundService = new BackgroundService(TimeService, AnalyticsService, updateRemoteConfigCacheService, UnsyncedDataPersistenceService, InteractorFactory);
backgroundService.EnterForeground();
// This delay is make sure FetchAndStoreRemoteConfigData has time to execute, since it's called inside a
// fire and forget TaskTask.Run(() => {}).ConfigureAwait(false))
await Task.Delay(1);
updateRemoteConfigCacheService.DidNotReceive().FetchAndStoreRemoteConfigData();
}
[Fact, LogIfTooSlow]
public async Task TriggersEventNotificationsUpdate()
{
var updateRemoteConfigCacheService = Substitute.For<IUpdateRemoteConfigCacheService>();
updateRemoteConfigCacheService.NeedsToUpdateStoredRemoteConfigData().Returns(false);
var backgroundService = new BackgroundService(TimeService, AnalyticsService, updateRemoteConfigCacheService, UnsyncedDataPersistenceService, InteractorFactory);
backgroundService.EnterForeground();
// This delay is make sure UpdateEventNotificationsSchedules has time to execute, since it's called inside a
// fire and forget TaskTask.Run(() => {}).ConfigureAwait(false))
await Task.Delay(1);
await InteractorFactory.Received().UpdateEventNotificationsSchedules().Execute();
}
}
}
}
| {
"content_hash": "838cdb8ed9b9b8068be8fd4c08f8a4c0",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 200,
"avg_line_length": 50.954314720812185,
"alnum_prop": 0.6643753735803944,
"repo_name": "toggl/mobileapp",
"id": "0d4ef08f187d42857a369d7667792badd4cc2142",
"size": "10038",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "Toggl.Core.Tests/Services/BackgroundServiceTests.cs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C#",
"bytes": "5733490"
},
{
"name": "Makefile",
"bytes": "847"
},
{
"name": "Objective-C",
"bytes": "41986"
},
{
"name": "Shell",
"bytes": "3407"
}
],
"symlink_target": ""
} |
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#333333" >
<view
class="co.wakarimasen.chanexplorer.ImageViewPager"
android:id="@+id/mainPager"
android:layout_width="match_parent"
android:layout_height="match_parent">
</view>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#99000000"
android:layout_gravity="top"
android:id="@+id/image_top_bar">
<ImageButton
android:id="@+id/image_viewer_back"
android:layout_alignParentLeft="true"
android:paddingLeft="2dp"
android:background="@drawable/button_selector_holo"
android:src="@drawable/ic_image_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/image_top_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="%d of %d"
android:gravity="center"
android:layout_centerInParent="true"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
<Gallery
android:id="@+id/thumb_gallery"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginBottom="52dp"
android:layout_gravity="bottom"
android:spacing="4dp"
android:alpha=".6" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#99000000"
android:layout_gravity="bottom"
android:id="@+id/image_bottom_bar" >
<ImageButton
android:id="@+id/image_viewer_save"
android:layout_alignParentRight="true"
android:paddingLeft="2dp"
android:background="@drawable/button_selector_holo"
android:src="@drawable/ic_image_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/image_bottom_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="this.jpg"
android:gravity="center"
android:layout_centerInParent="true"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
</FrameLayout> | {
"content_hash": "66b8d2299dbd2df77c14e7d1573c81b2",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 71,
"avg_line_length": 33.025,
"alnum_prop": 0.6165783497350492,
"repo_name": "wakarimasenco/ChanExplorer",
"id": "7a358ecd76fbd69d4424820ca13ca489679346ea",
"size": "2642",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "res/layout/image_viewer.xml",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "81356"
},
{
"name": "Java",
"bytes": "391358"
}
],
"symlink_target": ""
} |
@interface UIView (AdjustFrame)
@property (assign, nonatomic) CGFloat x;
@property (assign, nonatomic) CGFloat y;
@property (assign, nonatomic) CGFloat width;
@property (assign, nonatomic) CGFloat height;
@property (assign, nonatomic) CGSize size;
@property (assign, nonatomic) CGPoint origin;
@end
| {
"content_hash": "2a5e55cbf188300f38f8617919992f7a",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 45,
"avg_line_length": 30.1,
"alnum_prop": 0.7674418604651163,
"repo_name": "xiaohesongww/HESProject",
"id": "1797b0d44a994548638d4859e5eb5c9d44769113",
"size": "449",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "huiErShi-iOS/Other/Third/RZPopupMenu/Category/UIView+AdjustFrame.h",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "832384"
},
{
"name": "Ruby",
"bytes": "349"
}
],
"symlink_target": ""
} |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Using keys manager for verification/decryption.</title>
<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.79">
<link rel="HOME" title="XML Security Library Reference Manual" href="index.html">
<link rel="UP" title="Keys manager." href="xmlsec-notes-keysmngr.html">
<link rel="PREVIOUS" title="Using keys manager for signatures/encryption." href="xmlsec-notes-keys-manager-sign-enc.html">
<link rel="NEXT" title="Implementing a custom keys store." href="xmlsec-notes-custom-keys-store.html">
<meta name="GENERATOR" content="GTK-Doc V1.11 (SGML mode)">
<style type="text/css">.synopsis, .classsynopsis {
background: #eeeeee;
border: solid 1px #aaaaaa;
padding: 0.5em;
}
.programlisting {
background: #eeeeff;
border: solid 1px #aaaaff;
padding: 0.5em;
}
.variablelist {
padding: 4px;
margin-left: 3em;
}
.navigation {
background: #ffeeee;
border: solid 1px #ffaaaa;
margin-top: 0.5em;
margin-bottom: 0.5em;
}
.navigation a {
color: #770000;
}
.navigation a:visited {
color: #550000;
}
.navigation .title {
font-size: 200%;
}</style>
</head>
<body><table witdh="100%" valign="top"><tr valign="top">
<td valign="top" align="left" width="210">
<img src="../images/logo.gif" alt="XML Security Library" border="0"><p></p>
<ul>
<li><a href="../index.html">Home</a></li>
<li><a href="../download.html">Download</a></li>
<li><a href="../news.html">News</a></li>
<li><a href="../documentation.html">Documentation</a></li>
<ul>
<li><a href="../faq.html">FAQ</a></li>
<li><a href="../api/xmlsec-notes.html">Tutorial</a></li>
<li><a href="../api/xmlsec-reference.html">API reference</a></li>
<li><a href="../api/xmlsec-examples.html">Examples</a></li>
</ul>
<li><a href="../xmldsig.html">XML Digital Signature</a></li>
<ul><li><a href="http://www.aleksey.com/xmlsec/xmldsig-verifier.html">Online Verifier</a></li></ul>
<li><a href="../xmlenc.html">XML Encryption</a></li>
<li><a href="../c14n.html">XML Canonicalization</a></li>
<li><a href="../bugs.html">Reporting Bugs</a></li>
<li><a href="http://www.aleksey.com/pipermail/xmlsec">Mailing list</a></li>
<li><a href="../related.html">Related</a></li>
<li><a href="../authors.html">Authors</a></li>
</ul>
<table width="100%">
<tr>
<td width="15"></td>
<td><a href="http://xmlsoft.org/"><img src="../images/libxml2-logo.png" alt="LibXML2" border="0"></a></td>
</tr>
<tr>
<td width="15"></td>
<td><a href="http://xmlsoft.org/XSLT"><img src="../images/libxslt-logo.png" alt="LibXSLT" border="0"></a></td>
</tr>
<tr>
<td width="15"></td>
<td><a href="http://www.openssl.org/"><img src="../images/openssl-logo.png" alt="OpenSSL" border="0"></a></td>
</tr>
<!--Links - start--><!--Links - end-->
</table>
</td>
<td valign="top"><table width="100%" valign="top"><tr><td valign="top" align="left" id="xmlsecContent">
<table width="100%" class="navigation" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="xmlsec-notes-keys-manager-sign-enc.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="xmlsec-notes-keysmngr.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">XML Security Library Reference Manual</th>
<td><a accesskey="n" href="xmlsec-notes-custom-keys-store.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<br clear="all"><div class="SECT1">
<h1 class="SECT1"><a name="XMLSEC-NOTES-KEYS-MNGR-VERIFY-DECRYPT">Using keys manager for verification/decryption.</a></h1>
<p>If more than one key could be used for signature or encryption,
then using <code class="STRUCTFIELD">signKey</code> member of
<a href="xmlsec-xmldsig.html#XMLSECDSIGCTX">xmlSecDSigCtx</a> structure or
<code class="STRUCTFIELD">encKey</code> member of
<a href="xmlsec-xmlenc.html#XMLSECENCCTX">xmlSecEncCtx</a> structure
is not possible. Instead, the application should load known keys in
the keys manager and use <dsig:KeyName/> element to specify
the key name.
</p>
<p> </p>
<div class="EXAMPLE">
<a name="AEN391"></a><p><b>Example 3. Initializing keys manager and loading DES keys from binary files.</b></p>
<pre class="PROGRAMLISTING">/**
* load_des_keys:
* @files: the list of filenames.
* @files_size: the number of filenames in #files.
*
* Creates default keys manager and load DES keys from #files in it.
* The caller is responsible for destroing returned keys manager using
* @xmlSecKeysMngrDestroy.
*
* Returns the pointer to newly created keys manager or NULL if an error
* occurs.
*/
xmlSecKeysMngrPtr
load_des_keys(char** files, int files_size) {
xmlSecKeysMngrPtr mngr;
xmlSecKeyPtr key;
int i;
assert(files);
assert(files_size > 0);
/* create and initialize keys manager, we use a default list based
* keys manager, implement your own xmlSecKeysStore klass if you need
* something more sophisticated
*/
mngr = xmlSecKeysMngrCreate();
if(mngr == NULL) {
fprintf(stderr, "Error: failed to create keys manager.\n");
return(NULL);
}
if(xmlSecCryptoAppDefaultKeysMngrInit(mngr) < 0) {
fprintf(stderr, "Error: failed to initialize keys manager.\n");
xmlSecKeysMngrDestroy(mngr);
return(NULL);
}
for(i = 0; i < files_size; ++i) {
assert(files[i]);
/* load DES key */
key = xmlSecKeyReadBinaryFile(xmlSecKeyDataDesId, files[i]);
if(key == NULL) {
fprintf(stderr,"Error: failed to load des key from binary file \"%s\"\n", files[i]);
xmlSecKeysMngrDestroy(mngr);
return(NULL);
}
/* set key name to the file name, this is just an example! */
if(xmlSecKeySetName(key, BAD_CAST files[i]) < 0) {
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", files[i]);
xmlSecKeyDestroy(key);
xmlSecKeysMngrDestroy(mngr);
return(NULL);
}
/* add key to keys manager, from now on keys manager is responsible
* for destroying key
*/
if(xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key) < 0) {
fprintf(stderr,"Error: failed to add key from \"%s\" to keys manager\n", files[i]);
xmlSecKeyDestroy(key);
xmlSecKeysMngrDestroy(mngr);
return(NULL);
}
}
return(mngr);
}
</pre>
<p><a href="xmlsec-decrypt-with-keys-mngr.html#XMLSEC-EXAMPLE-DECRYPT2">Full program listing</a></p>
</div>
</div>
<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="2"><tr valign="middle">
<td align="left"><a accesskey="p" href="xmlsec-notes-keys-manager-sign-enc.html"><b><<< Using keys manager for signatures/encryption.</b></a></td>
<td align="right"><a accesskey="n" href="xmlsec-notes-custom-keys-store.html"><b>Implementing a custom keys store. >>></b></a></td>
</tr></table>
</td></tr></table></td>
</tr></table></body>
</html>
| {
"content_hash": "1b2d5de1ae63f08b2e1e5a16334717af",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 155,
"avg_line_length": 39.62777777777778,
"alnum_prop": 0.6671807093789429,
"repo_name": "SoteriousIdaofevil/xmlstar",
"id": "8cbcba357ddcbfbff1c346b19a3d20998f0088a3",
"size": "7133",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "share/doc/xmlsec1/api/xmlsec-notes-keys-mngr-verify-decrypt.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ada",
"bytes": "89080"
},
{
"name": "Assembly",
"bytes": "141281"
},
{
"name": "Awk",
"bytes": "3158"
},
{
"name": "Batchfile",
"bytes": "105895"
},
{
"name": "C",
"bytes": "60224544"
},
{
"name": "C#",
"bytes": "55626"
},
{
"name": "C++",
"bytes": "1629857"
},
{
"name": "CLIPS",
"bytes": "5291"
},
{
"name": "CMake",
"bytes": "36522"
},
{
"name": "CSS",
"bytes": "19082"
},
{
"name": "Clean",
"bytes": "27204"
},
{
"name": "DIGITAL Command Language",
"bytes": "70628"
},
{
"name": "HTML",
"bytes": "46310322"
},
{
"name": "JavaScript",
"bytes": "143520"
},
{
"name": "M4",
"bytes": "1378720"
},
{
"name": "Makefile",
"bytes": "3795634"
},
{
"name": "Max",
"bytes": "1184"
},
{
"name": "Module Management System",
"bytes": "1545"
},
{
"name": "Objective-C",
"bytes": "36179"
},
{
"name": "PHP",
"bytes": "81852"
},
{
"name": "Pascal",
"bytes": "70297"
},
{
"name": "Perl",
"bytes": "289466"
},
{
"name": "Python",
"bytes": "4550602"
},
{
"name": "Roff",
"bytes": "19596601"
},
{
"name": "SAS",
"bytes": "1847"
},
{
"name": "Shell",
"bytes": "7077595"
},
{
"name": "XSLT",
"bytes": "2271778"
},
{
"name": "Yacc",
"bytes": "7516"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.