Tutorial by Examples: code

public class NetworkConnection : IDisposable { string _networkName; public NetworkConnection(string networkName, NetworkCredential credentials) { _networkName = networkName; var netResource = new NetResource() {...
Once you have installed Visual Studio from https://www.visualstudio.com/downloads/, start a new project. Select 'Windows Forms Application' from Visual Basic Tab. You can rename it here if you need to. Once you click 'OK', you will see this window: Click on the 'Toolbo...
Add the slf4j dependency to your pom.xml: <properties> <slf4j.version>1.7.21</slf4j.version> </properties> <!-- ... --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version&gt...
platform.ready().then(() => { // Okay, so the platform is ready and our plugins are available. // Here you can do any higher level native things you might need. var url= "https://blog.knoldus.com/"; var browserRef = window.cordova.InAppBrowser.open(url, &qu...
Debugging starts with understanding the code you are trying to debug. Bad code: int main() { int value; std::vector<int> vectorToSort; vectorToSort.push_back(42); vectorToSort.push_back(13); for (int i = 52; i; i = i - 1) { vectorToSort.push_back(i *2); } ...
Firstly it's important to note that when a new socket is created it is assigned a unique Id which is retrieved by calling socket.id. This id can then be stored within a user object and we can assign an identifier such as a username which has been used in this example to retrieve user objects. /** ...
The gross majority of the time a SyntaxError which points to an uninteresting line means there is an issue on the line before it (in this example, it's a missing parenthesis): def my_print(): x = (1 + 1 print(x) Returns File "<input>", line 3 print(x) ^...
def main(): if len(sys.argv) != 4 or '--help' in sys.argv[1:]: print('usage: my_program <arg1> <arg2> <arg3>', file=sys.stderr) sys.exit(1) # use an exit code to signal the program was unsuccessful process_data()
Use Nginx map to parse fields and reject requests. # Allowed hosts map $http_host $name { hostnames; default no; example.com yes; *.example.com yes; example.org yes; *.example.org yes; .example.net yes; wap.* yes; } # Allowed count...
It's possible to have your own custom code styles, share them with other team members and use a shortcut to auto format the code in a file. To create your own custom code style, go to: Preferences -> Editor -> Code Style There are some general code style settings here. You can also select ...
Decoding the chunks of a PNG file demonstrates Okio in practice. private static final ByteString PNG_HEADER = ByteString.decodeHex("89504e470d0a1a0a"); public void decodePng(InputStream in) throws IOException { try (BufferedSource pngSource = Okio.buffer(Okio.source(in))) { Byt...
To see you unit tests go to Test -> Windows -> Code Coverage Results (Figure 1) It will open the following window (Figure 2) The window is now empty Go to the Test menu -> Analyze Code Coverage (Figure 3) The tests will now be run as well (See the results in the T...
Function definition: def run_training(train_X, train_Y): Inputs variables: X = tf.placeholder(tf.float32, [m, n]) Y = tf.placeholder(tf.float32, [m, 1]) Weight and bias representation W = tf.Variable(tf.zeros([n, 1], dtype=np.float32), name="weight") b = tf.Variable(tf.zeros([...
In your sign-in activity's onCreate method, configure Google Sign-In to request the user data required by your app. GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .build(); create a GoogleApiClient object wi...
Create new instance of UISegmentedControl filled with 3 items (segments): let mySegmentedControl = UISegmentedControl (items: ["One", "Two", "Three"]) Setup frame; mySegmentedControl.frame = CGRect(x: 0.0, y: 0.0, width: 300, height: 50) Make default s...
function noOfLooping(m,n) { if(m > n) { smallestValue = n; } else { smallestValue = m; } if(smallestValue % 2 == 0) { return smallestValue/2; } else { return (smallestValue+1)/2; } } function squarePrint(m,n) { v...
Integration to open database using password. -(void)checkAndOpenDB{ sqlite3 *db; NSString *strPassword = @"password"; if (sqlite3_open_v2([[databaseURL path] UTF8String], &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL) == SQLITE_OK) { const cha...
(function(){ var hashMap = {}; function isAnagram (str1, str2) { if(str1.length !== str2.length){ return false; } // Create hash map of str1 character and increase value one (+1). createStr1HashMap(str1); /...
Public: public val name = "Avijit" Private: private val name = "Avijit" Protected: protected val name = "Avijit" Internal: internal val name = "Avijit"
from requests import post payload = {'key1' : 'value1', 'key2' : 'value2' } foo = post('http://httpbin.org/post', data=payload) To pass form encoded data with the post operation, data must be structured as dictionary and supplied as the data parameter. If the data d...

Page 19 of 21