Tutorial by Examples: st

Swift let image = UIGraphicsGetImageFromCurrentImageContext() imageView.image = image //assuming imageView is a valid UIImageView object Objective-C UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); imageView.image = image; //assuming imageView is a valid UIImageView object
You may wish to update your custom setting's during the execution of your code, to switch off validation or workflow rules. In the below code, I have created a Schedulable Apex Class which will update the Close Date of any Opportunities whose Close Date is less than or equal to 6 days from the curr...
Xamarin sturio opens Xib file and Storyboards by default in the Xamarin Designer. User can right click on the file and Open With -> `Xcode Interface Builder'
The Monostate pattern is usually referred to as syntactic sugar over the Singleton pattern or as a conceptual Singleton. It avoids all the complications of having a single instance of a class, but all the instances use the same data. This is accomplished mostly by using static data members. One o...
In contrasto to the Singleton, the Monostate is suitable to be inherited to extend its functionalities, as long as member methods are not static. It follows a minimal example in C++: struct Settings { virtual std::size_t width() const noexcept { return width_; } virtual std::size_t heigh...
import unittest def addition(*args): """ add two or more summands and return the sum """ if len(args) < 2: raise ValueError, 'at least two summands are needed' for ii in args: if not isinstance(ii, (int, long, float, compl...
1. Logs: By default, Heroku allows only 1500 lines of consolidated logs. When more than 1500 lines of logs are required, one has to use addons provided Heroku. 2. Router: HTTP request have 30s timeout for initial response and 55s timeout thereafter. Maximum of 1MB buffer allowed for response. 3....
The += operator is a common extension that adds the specified content to the end of the variable, separated by a space. x = hello x += world Variable references in the right-hand side will be expanded if and only if the original variable was defined as a simply-expanded variable.
Helpers and fakeApplication Class Helpers is used a lot for unit tests. It imitates a Play application, fakes HTTP requests and responses, session, cookies - all whatever may be needed for tests. A controller under the test should be executed in a context of a Play application. The Helpers method f...
glfwDefaultWindowHints(); glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_VISIBLE, GL_FALSE); //Window hints are used to manipulate the behavior of later created windows //As the name suggests, they are only hints, not hard constraints, which mea...
File Structure: pom.xml src/test/java/PlayStoreAutomation.java Launch command: mvn test -Dtest=PlayStoreAutomation PlayStoreAutomation.java import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import io.appium.java_client.android.AndroidDriver; import i...
Lets examine the following two examples for reading a file's contents: The first one, which uses an async method for reading a file, and providing a callback function which is called once the file is fully read into the memory: fs.readFile(`${__dirname}/utils.js`, (err, data) => { if (err) {...
The below example widget demonstrates how to format individual cells of a TreeView column conditionally, depending on value of the field in the particular cell. If value of field is negative, then it'll be displayed in red color and minus symbol will be hidden, otherwise it'll be displayed in normal...
Yield true on the stack if currentpoint executes successfully, or false if it signals a /nocurrentpoint error. {currentpoint pop pop} stopped not % bool
Tests are an excellent way to ensure stable, bug-free applications. They serve as an interactive documentation and allow to modify code without fear to break functionality. D provides a convenient and native syntax for unittest block as part of the D language. Anywhere in a D module unittest blocks ...
If -unittest flag is passed to the D compiler, it will run all unittest blocks. Often it is useful to let the compiler generate a stubbed main function. Using the compile & run wrapper rdmd, testing your D program gets as easy as: rdmd -main -unittest yourcode.d Of course you can also split ...
For templated code it is often useful to verify that for function attributes (e.g. @nogc are inferred correctly. To ensure this for a specific test and thus type the entire unittest can be annotated @safe @nogc pure nothrow unittest { import std.math; assert(exp(0) == 1); assert(l...
Component definition ko.components.register('progress-bar', { viewModel: function(params) { var that = this; // progress is a numeric value between 0 and 100 that.progress = params.progress; that.progressPercentual = ko.computed...
Before you decide to work on puppet there are few things that you need to know. puppet work in both client-server architecture (widely used) as well single machine (specially for testing purpose) puppet master can only be configured on a linux machine (master machine/node), windows can b...
System Requirements However, the Puppet master service is fairly resource intensive, and should be installed on a robust dedicated server. At a minimum, your Puppet master server should have two processor cores and at least 1 GB of RAM. To comfortably serve at least 1,000 nodes, it should have ...

Page 234 of 369