Tutorial by Examples: c

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...
Group by one column Using the following DataFrame df = pd.DataFrame({'A': ['a', 'b', 'c', 'a', 'b', 'b'], 'B': [2, 8, 1, 4, 3, 8], 'C': [102, 98, 107, 104, 115, 87]}) df # Output: # A B C # 0 a 2 102 # 1 b 8 98 # 2 c 1 107 # 3 a...
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") .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]", ""); }
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...
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...
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...
MySQL3.19 DROP TABLE IF EXISTS MyTable; PostgreSQL8.x DROP TABLE IF EXISTS MyTable; SQL Server2005 If Exists(Select * From Information_Schema.Tables Where Table_Schema = 'dbo' And Table_Name = 'MyTable') Drop Table dbo.MyTable SQLite3.0 DROP TABLE IF EXI...
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():...
You can use ReactJS's components easily in TypeScript. Just rename the 'jsx' file extension to 'tsx': //helloMessage.tsx: var HelloMessage = React.createClass({ render: function() { return <div>Hello {this.props.name}</div>; } }); ReactDOM.render(<HelloMessage name=&q...
If a sentence contains computer code (for example, the name of an HTML element), use the code element to mark it up: <p>The <code>a</code> element creates a hyperlink.</p>
If the formatting (white space, new lines, indentation) of the code matters, use the pre element in combination with the code element: <pre> <code> x = 42 if x == 42: print "x is … … 42" </code> </pre> You still have to esc...
To match something that does not contain a given string, one can use negative lookahead: Regex syntax: (?!string-to-not-match) Example: //not matching "popcorn" String regexString = "^(?!popcorn).*$"; System.out.println("[popcorn] " + ("popcorn".matches(r...
A char is single letter stored inside a variable. It is built-in value type which takes two bytes of memory space. It represents System.Char data type found in mscorlib.dll which is implicitly referenced by every C# project when you create them. There are multiple ways to do this. char c = 'c'; ...

Page 139 of 826