By default, mix new <projectname> will generate a .gitignore file in the project root that is suitable for Elixir.
# The directory Mix will write compiled artifacts to.
/_build
# If you run "mix test --cover", coverage assets end up here.
/cover
# The directory Mix downloads...
Here is the corresponding Java configuration:
Add this annotation to an @Configuration class to have the Spring Security configuration defined in any WebSecurityConfigurer or more likely by extending the WebSecurityConfigurerAdapter base class and overriding individual methods:
@Configuration
@En...
This example uses SqlConnection, but any IDbConnection is supported.
Also any IDbTransaction is supported from the related IDbConnection.
public void UpdateWidgetQuantity(int widgetId, int quantity)
{
using(var conn = new SqlConnection("{connection string}")) {
conn.Open()...
Wrapping a group of inserts in a transaction will speed them up according to this StackOverflow Question/Answer.
You can use this technique, or you can use Bulk Copy to speed up a series of related operations to perform.
// Widget has WidgetId, Name, and Quantity properties
public void InsertWidg...
[TestCase(0, 0, 0)]
[TestCase(34, 25, 59)]
[TestCase(-1250, 10000, 8750)]
public void AddNumbersTest(int a, int b, int expected)
{
// Act
int result = a + b;
// Assert
Assert.That(result, Is.EqualTo(expected));
}
!!! Container should be positioned relatively or absolutely
$direction - top, bottom, left, right
$margin - margin by the edge in $direction. For top and bottom direction - it's from left to right. For left and right - it's from top to bottom.
$colors - first is a border color, second - is a back...
//define a short alias to avoid chubby method signatures
using AppFunc = Func<IDictionary<string, object>, Task>;
class RequestTimeMiddleware
{
private AppFunc _next;
public RequestTimeMiddleware(AppFunc next)
{
_next = next;
}
public async Task...
Groups can be added and nested within a report to organize the data in a hierarchy of sorted lists. Outer groups supersede any groups within. This directly affects which records are affected by the Previous keyword.
Select Insert, Group from the menu bar.
Select the field to group the data by fr...
A thing to look out for when using the toString method in Kotlin is the handling of null in combination with the String?.
For example you want to get text from an EditText in Android.
You would have a piece of code like:
// Incorrect:
val text = view.textField?.text.toString() ?: ""
...
You can use the following instructions to install Theano and configure the GPU (assume a freshly installed Ubuntu 14.04):
# Install Theano
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git
sudo pip install Theano
# Install Nvidia drivers, ...
You can run Theano on multiple CPU cores with the OMP_NUM_THREADS=[number_of_cpu_cores] flag.
Example:
OMP_NUM_THREADS=4 python gpu_test.py
The script theano/misc/check_blas.py outputs information regarding which BLAS is used:
cd [theano_git_directory]
OMP_NUM_THREADS=4 python theano/misc/ch...
Assuming you have already set up an app in Android Studio, add a ListView to a layout
(or skip if that's already done):
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/...
defmodule MyModule do
@my_favorite_number 13
@use_snake_case "This is a string (use double-quotes)"
end
These are only accessible from within this module.
A basic reducer would look like this:
// Import the action types to recognise them
import { ACTION_ERROR, ACTION_ENTITIES_LOADED, ACTION_ENTITY_CREATED } from './actions';
// Set up a default state
const initialState = {
error: undefined,
entities: []
};
// If no state is provi...
Immutable is a great library that provides us with immutable versions of widely used types of collections, such as Lists, Stacks, Maps, and more.
It simplifies the manipulation of the state and makes it easier to make pure calculations and avoid mutation.
Let's see how the Basic reducer can be rew...
You can add a method to any class in Ruby, whether it's a builtin or not. The calling object is referenced using self.
class Fixnum
def plus_one
self + 1
end
def plus(num)
self + num
end
def concat_one
self.to_s + '1'
end
end
1.plus_one # => 2
3.plus(5) ...
Objective: Use SignalR for notification between Web API, and TypeScript/JavaScript based Web App, where Web API and the Web App is hosted in different domain.
Enabling SignalR and CORS on Web API:
Create a standard Web API project, and install the following NuGet packages:
Microsoft.Owin.Cors
...