This example has more tests available in unit testing.
Employee.vb (Class Library)
''' <summary>
''' Employee Class
''' </summary>
Public Class Employee
''' <summary>
''' First name of employee
''' </summary>
Public Property FirstName As String = &q...
1. Bagged Decision Trees
Bagging performs best with algorithms that have high variance. A popular example are decision trees, often constructed without pruning.
In the example below see an example of using the BaggingClassifier with the Classification and Regression Trees algorithm (DecisionTreeCl...
Here is a basic class documentation example:
/// Class description
class Student {
// Member description
var name: String
/// Method description
///
/// - parameter content: parameter description
///
/// - returns: return value description
func say...
All instances (objects) of an entity class can be loaded from the underlying database table as follows (akin to retrieving all rows from the table):
Iterable<Foo> foos = fooRepository.findAll();
The findAll method is provided by the CrudRepository interface. It returns an Iterable instead ...
A particular instance of an entity class can be loaded as follows:
Foo foo = fooRepository.findOne(id);
The findOne method is provided by the CrudRepository interface. It expects an identifier that uniquely identifies an entity instance (for instance, a primary key in a database table). The Java...
All instances of an entity class with one of the class attributes matching a specified value can be retrieved as follows:
public interface FooRepository extends CrudRepository<Foo, Long> {
List<Foo> findAllByName(String name);
}
Invoking the findAllByName method results in the JP...
There are several ways to implement a plugin system for a Java application. One of the simplest is to use URLClassLoader. The following example will involve a bit of JavaFX code.
Suppose we have a module of a main application. This module is supposed to load plugins in form of Jars from 'plugins' f...
Given Example class extending BaseExample class with some properties:
open class BaseExample(val baseField: String)
class Example(val field1: String, val field2: Int, baseField: String):
BaseExample(baseField) {
val field3: String
get() = "Property without backing ...
using System;
[assembly:CLSCompliant(true)]
namespace CLSDoc
{
[CLSCompliant(false)]
public class Animal
{
public int age = 0;
}
//Warning CS3009 'Dog': base type 'Animal' is not CLS-compliant
public class Dog : Animal
{
}
}
In a const-correct class, all member functions which don't change logical state have this cv-qualified as const, indicating that they don't modify the object (apart from any mutable fields, which can freely be modified even in const instances); if a const cv-qualified function returns a reference, t...
// Record
type Ribbon = {Length:int}
// Class
type Line(len:int) =
member x.Length = len
type IHaveALength =
abstract Length:int
let inline getLength s = (^a: (member Length: _) s)
let ribbon = {Length=1}
let line = Line(3)
let someLengthImplementer =
{ new IHaveALength wit...
Another way to .Install installers is by using Castle's FromAssembly class. It gives an array of functions to locate installers in the loaded assemblies. For example:
//Will locate IInstallers in the current assembly that is calling the method
container.Install(FromAssembly.This());
For more d...
public class AmazonRootobject
{
public Itemsearchresponse ItemSearchResponse { get; set; }
}
public class Itemsearchresponse
{
public string xmlns { get; set; }
public Operationrequest OperationRequest { get; set; }
public Items Items { g...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using ApplicationDataServices.SBEntityBox;
namespace ApplicationManagementLayer.Affiliate
{
public cl...
Schema changes:
You will need to define a new field type in your solr schema file and then you can create fields of that type. Example schema snippet:
<!-- Source: solr/example/.../conf/schema.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="a...
Dim classFile : classFile = "carClass.vbs"
Dim fsObj : Set fsObj = CreateObject("Scripting.FileSystemObject")
Dim vbsFile : Set vbsFile = fsObj.OpenTextFile(classFile, 1, False)
Dim myFunctionsStr : myFunctionsStr = vbsFile.ReadAll
vbsFile.Close
Set vbsFile = Nothing
Set fs...
You can also make a switch statement switch based on the class of the thing you're switching on.
An example where this is useful is in prepareForSegue. I used to switch based on the segue identifier, but that's fragile. if you change your storyboard later and rename the segue identifier, it breaks ...
A generic Car class has some car property and a description method
class Car{
name:string;
engineCapacity:string;
constructor(name:string,engineCapacity:string){
this.name = name;
this.engineCapacity = engineCapacity;
}
describeCar(){
console....