Tutorial by Examples: ti

You can access each property that belongs to an object with this loop for (var property in object) { // always check if an object has a property if (object.hasOwnProperty(property)) { // do stuff } } You should include the additional check for hasOwnProperty because an o...
pip may be used to install BeautifulSoup. To install Version 4 of BeautifulSoup, run the command: pip install beautifulsoup4 Be aware that the package name is beautifulsoup4 instead of beautifulsoup, the latter name stands for old release, see old beautifulsoup
Here is an example class which has a couple of instance variables, without using properties: @interface TestClass : NSObject { NSString *_someString; int _someInt; } -(NSString *)someString; -(void)setSomeString:(NSString *)newString; -(int)someInt; -(void)setSomeInt:(NSString *)...
DataFrame: import pandas as pd import numpy as np np.random.seed(5) df = pd.DataFrame(np.random.randint(100, size=(5, 5)), columns = list("ABCDE"), index = ["R" + str(i) for i in range(5)]) df Out[12]: A B C D E R0 99 78 61 16 73...
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"]) .validate(statusCode: 200..<300) .validate(contentType: ["application/json"]) .response { response in print(response) }
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...
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...
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...
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...
Microsoft describes 3 ways of installing WinDbg: as part of the WDK (Windows Driver Kit) as part of the SDK (Software Development Kit) with the installer of the SDK and deselecting everything else but "Debugging Tools for Windows" To get the installer, visit Download the WDK, WinDb...
Sometimes, programmers who are new Java will use primitive types and wrappers interchangeably. This can lead to problems. Consider this example: public class MyRecord { public int a, b; public Integer c, d; } ... MyRecord record = new MyRecord(); record.a = 1; // OK ...
Use this option if you don't need an Application subclass. This is the simplest option, but this way you can't provide your own Application subclass. If an Application subclass is needed, you will have to switch to one of the other options to do so. For this option, simply specify the fully-quali...
Use this option if your project requires an Application subclass. Specify this Application subclass using the android:name property in the manifest file inside the application tag. In the Application subclass, add the attachBaseContext() method override, and in that method call MultiDex.install():...
lib.rs: pub fn to_test(output: bool) -> bool { output } Each file in the tests/ folder is compiled as single crate. tests/integration_test.rs extern crate test_lib; use test_lib::to_test; #[test] fn test_to_test(){ assert_eq!(to_test(true), true); }
When you do a groupby you can select either a single column or a list of columns: In [11]: df = pd.DataFrame([[1, 1, 2], [1, 2, 3], [2, 3, 4]], columns=["A", "B", "C"]) In [12]: df Out[12]: A B C 0 1 1 2 1 1 2 3 2 2 3 4 In [13]: g = df.groupby(...
Example Using Activity w/ LocationRequest /* * This example is useful if you only want to receive updates in this * activity only, and have no use for location anywhere else. */ public class LocationActivity extends AppCompatActivity implements GoogleApiClient.ConnectionCallbacks, ...
Since JUnit is a Java library, all you have to do to install it is to add a few JAR files into the classpath of your Java project and you're ready to go. You can download these two JAR files manually: junit.jar & hamcrest-core.jar. If you're using Maven, you can simply add in a dependency into...

Page 88 of 505