This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @note: | |
| * Works properly with numbers. | |
| * other types may have to define another equality criteria. | |
| * | |
| * @return: Item index if found. -1 otherwise. | |
| */ | |
| template<typename T> | |
| int BinarySearch(T * arr, int size, T searchKey) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Windows; | |
| using System.Windows.Threading; | |
| namespace __temp_WPF | |
| { | |
| /// <summary> | |
| /// Interaction logic for MainWindow.xaml | |
| /// </summary> | |
| public partial class MainWindow : Window |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| namespace Bionomial_Distribution | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| BionomialDistribution b = new BionomialDistribution(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace App.Infrastructure | |
| { | |
| public class FileMaxSizeAttribute : ValidationAttribute | |
| { | |
| public FileMaxSizeAttribute(int maxSize = 10 * 1024 * 1024, string errorMessage = "{0} is not a valid file.") | |
| : base(errorMessage) | |
| { | |
| // 10 MB by default // | |
| this._maxSize = maxSize; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// A simple Model with validation logic built within it. | |
| /// Another approach of validation besides " Data Annotations " is to implement IValidatableObject interface. | |
| /// </summary> | |
| public class User : IValidatableObject | |
| { | |
| public int Age { get; set; } | |
| public string Name { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class PrimesTester | |
| def initialize number | |
| @number = number | |
| end | |
| attr_accessor :number | |
| def prime? | |
| # test primaility for the input number. |