Tutorial by Examples: er

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...
Class: public class Version : IComparable<Version> { public int[] Parts { get; } public Version(string value) { if (value == null) throw new ArgumentNullException(); if (!Regex.IsMatch(value, @"^[0-9]+(\.[0-9]+)*$")) th...
To enable or disable a BroadcastReceiver, we need to get a reference to the PackageManager and we need a ComponentName object containing the class of the receiver we want to enable/disable: ComponentName componentName = new ComponentName(context, MyBroadcastReceiver.class); PackageManager packageM...
.NET Core app should be published using dotnet publish FROM microsoft/dotnet:latest COPY bin/Debug/netcoreapp1.0/publish/ /root/ EXPOSE 5000 ENTRYPOINT dotnet /root/sampleapp.dll
You can convert a timestamp or interval value to a string with the to_char() function: SELECT to_char('2016-08-12 16:40:32'::timestamp, 'DD Mon YYYY HH:MI:SSPM'); This statement will produce the string "12 Aug 2016 04:40:32PM". The formatting string can be modified in many different wa...
If you want to retrieve the details of a user's Facebook profile, you need to set permissions for the same: loginButton = (LoginButton)findViewById(R.id.login_button); loginButton.setReadPermissions(Arrays.asList("email", "user_about_me")); You can keep adding more permiss...
If you want your application to support a plug-in system, for example to load plug-ins from assemblies located in plugins folder: interface IPlugin { string PluginDescription { get; } void DoWork(); } This class would be located in a separate dll class HelloPlugin : IPlugin { ...
WinDbg is often used as an abbreviation of "Debugging tools for Windows". It contains different debuggers: DebuggerDescriptionWinDbgthe debugger with a graphical user interfaceCDBconsole debugger, user mode debugger which runs in the currently open consoleNTSDnew terminal symbolic debugge...
Extension Method can work on null references, but you can use ?. to null-check anyway. public class Person { public string Name {get; set;} } public static class PersonExtensions { public static int GetNameLength(this Person person) { return person == null ? -1 : pers...
An HTTP POST request is sent to a URL of the format: "https://api.twilio.com/2xxx-xx-xx/Accounts/[AccountSid]/Messages.json The example below uses a alphanumeric string as the sender. At the time of writing a sender ID can only be added through a service request Twlio. Example Request: To=&q...
[ContractClass(typeof(ValidationContract))] interface IValidation { string CustomerID{get;set;} string Password{get;set;} } [ContractClassFor(typeof(IValidation))] sealed class ValidationContract:IValidation { string IValidation.CustomerID { [Pure] get ...
A common use-case for iterators is to perform some operation over a collection of numbers. The example below demonstrates how each element within an array of numbers can be individually printed out to the console. This is possible because arrays implement the IEnumerable interface, allowing clients...
Swift let isPushEnabled = UIApplication.sharedApplication().isRegisteredForRemoteNotifications()
The logic of registering for push notification is recommended to be added in AppDelegate.swift as the callback functions (success, failure) will be called their. To register just do the following: let application = UIApplication.sharedApplication() let settings = UIUserNotificationSettings(forType...
Assume you want to create an extension property that is expensive to compute. Thus you would like to cache the computation, by using the lazy property delegate and refer to current instance (this), but you cannot do it, as explained in the Kotlin issues KT-9686 and KT-13053. However, there is an off...
cURL is the name of the project which depicts: 'Client for URLs' and also be called as Client URL Request Library it combines two separate packages: curl and libcurl. curl is a command line tool used to get documents/files from or send documents to a server, using any of the supported protocol...
Python 2.x2.3 python -m SimpleHTTPServer 9000 Python 3.x3.0 python -m http.server 9000 Running this command serves the files of the current directory at port 9000. If no argument is provided as port number then server will run on default port 8000. The -m flag will search sys.path for ...
dplyr::filter() - Select a subset of rows in a data frame that meet a logical criteria: dplyr::filter(iris,Sepal.Length>7) # Sepal.Length Sepal.Width Petal.Length Petal.Width Species # 1 7.1 3.0 5.9 2.1 virginica # 2 7.6 3.0 ...
Displaying all the logs from the default buffer on the Command Line can be accomplished by: adb logcat This command will show you all the logs from the device's main buffer. Notice that if you use it for the first time, you'll get a lot of information, an enormous stream of data. So you may want...
Methods are inherited class A def boo; p 'boo' end end class B < A; end b = B.new b.boo # => 'boo' Class methods are inherited class A def self.boo; p 'boo' end end class B < A; end p B.boo # => 'boo' Constants are inherited class A WOO = 1 end class ...

Page 182 of 417