Tutorial by Examples: sin

public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddCors(); services.ConfigureCors(options => options.AddPolicy("AllowSpecific", p => p.WithOrigins("http://localhost:1233") ...
Categorical products In category theory, the product of two objects X, Y is another object Z with two projections: π₁ : Z → X and π₂ : Z → Y; such that any other two morphisms from another object decompose uniquely through those projections. In other words, if there exist f₁ : W → X and f₂ : W →...
This example is not tied to any concrete GUI toolkit, like reactive-banana-wx does, for instance. Instead it shows how to inject arbitary IO actions into FRP machinery. The Control.Event.Handler module provides an addHandler function which creates a pair of AddHandler a and a -> IO () values. Th...
The Collection object implements the ArrayAccess and IteratorAggregate interface, allowing it to be used like an array. Access collection element: $collection = collect([1, 2, 3]); $result = $collection[1]; Result: 2 Assign new element: $collection = collect([1, 2, 3]); $collection[] = ...
The Singleton pattern is designed to restrict creation of a class to exactly one single instance. This pattern is used in a scenario where it makes sense to have only one of something, such as: a single class that orchestrates other objects' interactions, ex. Manager class or one class that rep...
Using Inline View (If it is considered updateable by Oracle) Note: If you face a non key preserved row error add an index to resolve the same to make it update-able UPDATE (SELECT TESTTABLE.TEST_COLUMN AS OLD, 'Testvalue' AS NEW FROM TESTTA...
Using Merge MERGE INTO TESTTABLE USING (SELECT T1.ROWID AS RID, T2.TESTTABLE_ID FROM TESTTABLE T1 INNER JOIN MASTERTABLE T2 ON TESTTABLE.TESTTABLE_ID = MASTERTABLE.TESTTABLE_ID WHERE...
To detect the environment on the server, we have to create a helper method on the server, as the server will determine which environment it is in, and then call the helper method from the client. Basically, we just relay the environment info from the server to the client. //------------------------...
As of Meteor 1.3, Meteor now exposes the NODE_ENV variable on the client by default. if (Meteor.isClient) { Meteor.startup(function () { if(process.env.NODE_ENV === "testing"){ console.log("In testing..."); } if(process.env.NODE_ENV === "production&...
Logcat is a command-line tool that dumps a log of system messages, including stack traces when the device throws an error and messages that you have written from your app with the Log class. The Logcat output can be displayed within Android Studio's Android Monitor or with adb command line. In And...
Generally, if we want to remove an element from an array, we need to know it's index so that we can remove it easily using remove(at:) function. But what if we don't know the index but we know the value of element to be removed! So here is the simple extension to an array which will allow us to re...
If you plan to host your Django website on Heroku, you can start your project using the Heroku Django Starter Template : django-admin.py startproject --template=https://github.com/heroku/heroku-django-template/archive/master.zip --name=Procfile YourProjectName It has Production-ready configurati...
HVFL is a language designed to constrain UI elements in a simple and quick fashion. Generally, VFL has an advantage over traditional UI customization in the Interface Builder because it's much more readable, accessible and compact. Here's an example of VFL, in which three UIViews are constrained f...
A lot of the value from local JVM unit tests comes from the way you design your application. You have to design it in such a way where you can decouple your business logic from your Android Components. Here is an example of such a way using the Model-View-Presenter pattern. Lets practice this out by...
Passing Variable in URL as a method's parameter return $this->redirect([ 'controller' => 'users', 'action' => 'profile', $id ]); Url should be looks like this http://your_app_url/users/profile/{id} in UsersController.php file in profile() method class UsersController e...
We can load components in two ways. By initialize or override $components property in Controller By using loadComponent() method in initialize() method of Controller. Way-1 It should be override loading component by AppsController.php load one or more component class UsersController extend...
initialize() is introduced in CakePHP version > 3.0 As a code structure, it looks like same as beforeFilter() method. but there is many differences between beforeFilter() and initialize(). initialize() is always called after constructor is called. but beforeFilter() is not calling in case of ...
This will load a JSON file from disk and convert it to the given type. public static <T> T getFile(String fileName, Class<T> type) throws FileNotFoundException { Gson gson = new GsonBuilder() .create(); FileReader json = new FileReader(fileName); return gson....
First of all you need to add the GsonConverterFactory to your build.gradle file compile 'com.squareup.retrofit2:converter-gson:2.1.0' Then, you have to add the converter factory when creating the Retrofit Service: Gson gson = new GsonBuilder().create(); new Retrofit.Builder() .baseUrl...
Given this function: annualSalaryCalc :: (RealFloat a) => a -> a -> String annualSalaryCalc hourlyRate weekHoursOfWork | hourlyRate * (weekHoursOfWork * 52) <= 40000 = "Poor child, try to get another job" | hourlyRate * (weekHoursOfWork * 52) <= 120000 = "Money...

Page 67 of 161