Tutorial by Examples: er

// Get the reference to your ListView ListView listResults = (ListView) findViewById(R.id.listResults); // Set its adapter listResults.setAdapter(adapter); // Enable filtering in ListView listResults.setTextFilterEnabled(true); // Prepare your adapter for filtering adapter.setFilter...
We can use the class DateInterval to add or subtract some interval in a DateTime object. See the example below, where we are adding an interval of 7 days and printing a message on the screen: $now = new DateTime();// empty argument returns the current date $interval = new DateInterval('P7D');//th...
Any nullable type is a generic type. And any nullable type is a value type. There are some tricks which allow to effectively use the result of the Nullable.GetUnderlyingType method when creating code related to reflection/code-generation purposes: public static class TypesHelper { public stat...
C-style bit-manipulation template <typename T> T rightmostSetBitRemoved(T n) { // static_assert(std::is_integral<T>::value && !std::is_signed<T>::value, "type should be unsigned"); // For c++11 and later return n & (n - 1); } Explanation if...
Redis configuration: Install redis (2.4+ required) Install phpredis Install the Magento extension Cm_Cache_Backend_Redis (only for Magento 1.7 and below) Edit your app/etc/local.xml: <global> ... <cache> <backend>Cm_Cache_Backend_Redis</backend> <b...
public class Producer { private static Random random = new Random((int)DateTime.UtcNow.Ticks); //produce the value that will be posted to buffer block public double Produce ( ) { var value = random.NextDouble(); Console.WriteLine($"Producing value: {value}...
We can draw a connection between the Haskell types and the natural numbers. This connection can be made assigning to every type the number of inhabitants it has. Finite union types For finite types, it suffices to see that we can assign a natural type to every number, based in the number of constr...
The derivative of a type is the type of its type of one-hole contexts. This is the type that we would get if we make a type variable disappear in every possible point and sum the results. As an example, we can take the triple type (a,a,a), and derive it, obtaining data OneHoleContextsOfTriple = (a...
The auto keyword by itself represents a value type, similar to int or char. It can be modified with the const keyword and the & symbol to represent a const type or a reference type, respectively. These modifiers can be combined. In this example, s is a value type (its type will be inferred as s...
A function template can be overloaded under the rules for non-template function overloading (same name, but different parameter types) and in addition to that, the overloading is valid if The return type is different, or The template parameter list is different, except for the naming of paramete...
This attaches the results of the query SELECT * FROM Users and sends it to [email protected] EXEC msdb.dbo.sp_send_dbmail @profile_name = 'The Profile Name', @recipients = '[email protected]', @query = 'SELECT * FROM Users', @subject = 'List of users', ...
Returns an integer (int) value that indicates the difference between the soundex values of two character expressions. Parameters: character expression 1. character expression 2. Both parameters are alphanumeric expressions of character data. The integer returned is the number of chars in th...
This is a very basic feature selection technique. Its underlying idea is that if a feature is constant (i.e. it has 0 variance), then it cannot be used for finding any interesting patterns and can be removed from the dataset. Consequently, a heuristic approach to feature elimination is to first re...
Whereas inside a Translation Unit, order of initialization of global variables is specified, order of initialization across Translation Units is unspecified. So program with following files foo.cpp #include <iostream> int dummyFoo = ((std::cout << "foo"), 0); b...
A simple EntitySystem that processes a Family of entities not once per frame, but after a given interval. Entity processing logic should be placed in processEntity(Entity). For more info, please see IntervalIteratingSystem In the below code example, the best usage for this is the physics world ...
The first time a user runs a project's gradlew, it should be realized that it will do two key things: Check to see if the version of the gradle used by the wrapper is already in ~/.gradle/wrapper/dists If not, download the archive of the version from the internet If you're in an environment t...
In this question, @Viclib asked about using rewrite rules to exploit typeclass laws to eliminate some overloaded function calls: Mind the following class: class ListIsomorphic l where toList :: l a -> [a] fromList :: [a] -> l a I also demand that toList . fromList == id. H...
Inverts the order of the elements in a sequence. If there is no items throws a ArgumentNullException: source is null. Example: // Create an array. int[] array = { 1, 2, 3, 4 }; //Output: // Call reverse extension method on the array. //4 var reverse = array.R...
The IEnumerable<T> interface is the base interface for all generic enumerators and is a quintessential part of understanding LINQ. At its core, it represents the sequence. This underlying interface is inherited by all of the generic collections, such as Collection<T>, Array, List<T&g...
To create seeders, you may use the make:seeder Artisan command. All seeders generated will be placed in the database/seeds directory. $ php artisan make:seeder MoviesTableSeeder Generated seeders will contain one method: run. You may insert data into your database in this method. <?php us...

Page 213 of 417