Tutorial by Examples

For the following DataFrame: import numpy as np import pandas as pd np.random.seed(0) df = pd.DataFrame({'Age': np.random.randint(20, 70, 100), 'Sex': np.random.choice(['Male', 'Female'], 100), 'number_of_foo': np.random.randint(1, 20, 100)}) df.head() ...
The prototype pattern focuses on creating an object that can be used as a blueprint for other objects through prototypal inheritance. This pattern is inherently easy to work with in JavaScript because of the native support for prototypal inheritance in JS which means we don't need to spend time or e...
import Alamofire Alamofire.request(.GET, "https://httpbin.org/get")
Alamofire.request("https://httpbin.org/get").validate().responseJSON { response in switch response.result { case .success: print("Validation Successful") case .failure(let error): print(error) } }
Alamofire.request(.GET, "https://httpbin.org/get", parameters: ["foo": "bar"]) .responseJSON { response in print(response.request) // original URL request print(response.response) // URL response print(response.data) // server da...
Alamofire.request(.GET, "https://httpbin.org/get", parameters: ["foo": "bar"]) .validate(statusCode: 200..<300) .validate(contentType: ["application/json"]) .response { response in print(response) }
Alamofire.request(.GET, "https://httpbin.org/get", parameters: ["foo": "bar"]) .validate() .response { request, response, data, error in print(request) print(response) print(data) print(error) }
Alamofire.request(.GET, "https://httpbin.org/get") .validate() .responseString { response in print("Response String: \(response.result.value)") } .responseJSON { response in print("Response JSON: \(response.result.value)") ...
public string Remove() { string input = "Hello./!"; return Regex.Replace(input, "[^a-zA-Z0-9]", ""); }
Extension methods can be used for writing strongly typed wrappers for dictionary-like objects. For example a cache, HttpContext.Items at cetera... public static class CacheExtensions { public static void SetUserInfo(this Cache cache, UserInfo data) => cache["UserInfo"] ...
This is a runtime error that happens when you request a large amount of memory on the heap. This is common when loading a Bitmap into an ImageView. You have some options: Use a large application heap Add the "largeHeap" option to the application tag in your AndroidManifest.xml. This...
Often when programming it is necessary to make some distinction between a variable that has a value and one that does not. For reference types, such as C Pointers, a special value such as null can be used to indicate that the variable has no value. For intrinsic types, such as an integer, it is mo...
In Swift, structures use a simple “dot syntax” to access their members. For example: struct DeliveryRange { var range: Double let center: Location } let storeLocation = Location(latitude: 44.9871, longitude: -93.2758) var pizzaRange = DeliveryRange(range: 200...
Installing OPAM OPAM is a package manager for OCaml. It builds and manages compiler versions and OCaml libraries for you easily. The easiest way to install OPAM on your operating system is to use a package manager for your system. e.g apt-get, yum or homebrew. Mac OSX Installation Instructions U...
In order to enable EdgeCache, set the following HTTP response headers (Do not deviate from this exact format): Cache-Control header to public, max-age=X where: X = the number of seconds that you want the response to be cached for X > 60 seconds X < 365*24*60*60 Set the Pragma he...
You can also receive regular updates of the user's location; for example, as they move around while using a mobile device. Location tracking over time can be very sensitive, so be sure to explain to the user ahead of time why you're requesting this permission and how you'll use the data. if (naviga...
The await keyword was added as part of C# 5.0 release which is supported from Visual Studio 2012 onwards. It leverages Task Parallel Library (TPL) which made the multi-threading relatively easier. The async and await keywords are used in pair in the same function as shown below. The await keyword is...
Under res folder, create a new folder called "anim" to store your animation resources and put this on that folder. shakeanimation.xml <?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" and...
public static Unsafe getUnsafe() { try { Field unsafe = Unsafe.class.getDeclaredField("theUnsafe"); unsafe.setAccessible(true); return (Unsafe) unsafe.get(null); } catch (IllegalAccessException e) { // Handle } catch (IllegalArgumentExcept...
public class UnsafeLoader { public static Unsafe loadUnsafe() { return Unsafe.getUnsafe(); } } While this example will compile, it is likely to fail at runtime unless the Unsafe class was loaded with the primary classloader. To ensure that happens the JVM should be loaded with...

Page 225 of 1336