The binder gives you an opportunity to inspect what types are being loaded in your application domain
Create a class inherited from SerializationBinder
class MyBinder : SerializationBinder
{
public override Type BindToType(string assemblyName, string typeName)
{
if (typeName.Eq...
To be able to use the P3D renderer you must specify it in the size() function
size(200, 200, P3D);
Now, there are three axes: x, y and z.
Now you can proceed in drawing in 3D.
One of the most interesting Number Patterns is Pascal's Triangle. The Name "Pascal's Triangle" named after Blaise Pascal, a famous French Mathematician and Philosopher.
In Mathematics, Pascal's Triangle is a triangular array of binomial coefficients.The rows of Pascal's triangle are conve...
public class PascalsTriangle
{
static void PascalTriangle(int n)
{
for (int line = 1; line <= n; line++)
{
int c = 1;
for (int i = 1; i <= line; i++)
{
Console.WriteLine(c);
c = c * (line - i)...
Routes in Laravel are case-sensitive. It means that a route like
Route::get('login', ...);
will match a GET request to /login but will not match a GET request to /Login.
In order to make your routes case-insensitive, you need to create a new validator class that will match requested URLs agains...
For full documentation, run the command:
godoc -http=:<port-number>
For a tour of Go (highly recommended for beginners in the language):
go tool tour
The two commands above will start web-servers with documentation similar to what is found online here and here respectively.
For quick ...
Most of the time a TabLayout is used together with a ViewPager, in order to get the swipe functionality that comes with it.
It is possible to use a TabLayout without a ViewPager by using a TabLayout.OnTabSelectedListener.
First, add a TabLayout to your activity's XML file:
<android.support.des...
// Assuming N/search is imported as `s`
var mySalesOrderSearch = s.create({
type: 'salesorder'
// Use the summary property of a Column to perform grouping/summarizing
columns: [{
name: 'salesrep',
summary: s.Summary.GROUP
},{
name: 'internalid',
...
A DataGridView is a control in .NET UI design, which consists of rows and columns used to arrange data.
Often there is need to depict data either from a spreadsheet or database on a UI design in an application. When this data is to be shown grouped by its properties, we choose a DataGridView.
In C...
Background Theory:
Bresenham’s Line Drawing Algorithm is an efficient and accurate raster line generating algorithm developed by Bresenham. It involves only integer calculation so it is accurate and fast. It can also be extended to display circles another curves.
In Bresenham line drawing algorith...
To draw a cuboid, you have to use the box() function by giving its dimensions as its parameters.
size(200, 200, P3D); //Starting the P3D renderer
translate(width/2, height/2); //Translating to the centre of the sketch
rotateY(PI/4); //rotate so that...
rotateX(PI/6); //... it will be easy to see...
If you have an attribute that needs to be saved and retrieved to database as an object, then specify the name of that attribute using the serialize method and it will be handled automatically.
The attribute must be declared as a text field.
In the model you must declare the type of the field (Hash...
Here's a program which might benefit from refactoring. It's a simple program using C++11 which is intended to calculate and print all prime numbers from 1 to 100 and is based on a program that was posted on CodeReview for review.
#include <iostream>
#include <vector>
#include <cma...
You need to get some details from your OAuth provider of choice. We'll be looking at Google, but ASP.NET is also set up to allow out-the-box use of Twitter, Facebook and Microsoft (obviously).
You'll want to go to the Google developer console (https://console.developers.google.com/) and create a pr...
When someone registers with your application, a new ApplicationUser object will be stored in the database. By default the class is very barebones, but it can be customised - you can find it in Models > IdentityModels.cs. This is mine:
public class ApplicationUser : IdentityUser
{
public ...
Go to Providers > ApplicationOAuthProvider.cs and edit the ValidateClientRedirectUri function. This was a big gotcha to me, as if you don't do this there'll be a fantastically unhelpful error message. By default, this code will make any callbacks to your site invalid unless they're to the site's ...
I have found that the Web API template is broken - the default implementation relies on cookies in the final step, which you probably don't want to be using in a Rest API. Without a cookie, GetExternalLoginInfoAsync in RegisterExternal always returns null.
I removed RegisterExternal entirely, inste...
The Shortest Common Super Sequence is a problem closely related to the longest common subsequence, which you can use as an external function for this task. The shortest common super sequence problem is a problem closely related to the longest common subsequence problem.
A shortest common superseque...
public class ShortestCommonSupersequence
{
private static int Max(int a, int b)
{
return a > b ? a : b;
}
private static int Lcs(string x, string y, int m, int n)
{
var l = new int[m + 1, n + 1];
for (var i = 0; i <= m; i++)
{...