$user = sanitize_user("attacker username<script>console.log(document.cookie)</script>");
$user value after sanitize is "attacker username"
Lets say you want to filter a query by two columns, but only certain combinations of those columns. For example, it's OK to have account 60400 with reference JE, but you cannot have account 60400 with reference ED, but you can have account 60500 with reference ED.
select * from schema.table where ...
First off you create the form
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
}
Action Method
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Test(FormViewModel formData)
{
// ...
}
Script
<script src="https://code.jquery.com/jquery-1.12.4.min.js"&g...
Data Access Object(DAO) design pattern is a standard J2EE design pattern.
In this design pattern data is accessed through classes containing methods to access data from databases or other sources, which are called data access objects. Standard practice assumes that there are POJO classes. DAO can b...
Exchange/convert a partition to a non-partitioned table and vice versa. This facilitates a fast "move" of data between the data segments (opposed to doing something like "insert...select" or "create table...as select") as the operation is DDL (the partition exchange ope...
Member names of an anonymous union belong to the scope of the union declaration an must be distinct to all other names of this scope. The example here has the same construction as example Anonymous Members using "struct" but is standard conform.
struct Sample {
union {
int a...
ValueExpression ve = AdfmfJavaUtilities.getValueExpression(<binding>, String.class);
String <variable_name> = (String) ve.getValue(AdfmfJavaUtilities.getELContext());
Here "binding" indicates the EL expression from which the value is to be get.
"variabl...
ValueExpression ve = AdfmfJavaUtilities.getValueExpression(<binding>, String.class);
ve.setValue(AdfmfJavaUtilities.getELContext(), <value>);
Here "binding" indicates the EL expression to which the value is to be stored.
"value" is the desired val...
AdfELContext adfELContext = AdfmfJavaUtilities.getAdfELContext();
MethodExpression me;
me = AdfmfJavaUtilities.getMethodExpression(<binding>, Object.class, new Class[] { });
me.invoke(adfELContext, new Object[] { });
"binding" indicates the EL expression from wh...
AdfmfContainerUtilities.invokeContainerJavaScriptFunction(AdfmfJavaUtilities.getFeatureId(), <function>, new Object[] {
});
"function" is the desired js function to be invoked
Achieving multitenancy on database server with multiple databases hosted on it.
Multitenancy is common requirement of enterprise application nowadays and creating connection pool for each database in database server is not recommended. so, what we can do instead is create connection pool with datab...
Another approach to handling asynchrony in Redux is to use action creators. In Flux, action creators are special functions that construct action objects and dispatch them.
myActionCreator(dispatch) {
dispatch({ type: "ASYNC_ACTION_START" });
setTimeout(() => {
dispatch({ typ...
The Python function import_csv_to_dynamodb(table_name, csv_file_name, colunm_names, column_types) below imports a CSV file into a DynamoDB table. Column names and column must be specified. It uses boto. Below is the function as well as a demo (main()) and the CSV file used.
import boto
MY_ACCESS...
This example shows how you can use IIS Rewrite rules to force HTTPS by making all HTTP requests return a 301 (Permanent) Redirect to the HTTPS page.
This is usually better than using the [RequireHttps] attribute because the attribute uses a 302 redirect, and being in the MVC pipeline it is much slo...
Bootstrap provides a couple of classes for advanced table styling.
Striped rows
You will have a table with striped rows, if you add .table-striped class:
<table class="table table-striped">
<thead><tr><th>First Name</th><th>Last name</th><...
You have to wrap any .table in html container with .table-responsive class to create responsive tables:
<div class="table-responsive">
<table class="table">
<thead><tr><th>First Name</th><th>Last name</th></tr></th...