Tutorial by Examples: sin

If you use the paste command from your terminal emulator program, Vim will interpret the stream of characters as if they were typed. That will cause all kind of undesirable effects, particularly bad indendation. To fix that, from command mode: :set paste Then move on to insert mode, with i, for...
Even if third-party libraries are good, a simple way to parse the JSON is provided by protocols You can imagine you have got an object Todo as struct Todo { let comment: String } Whenever you receive the JSON, you can handle the plain NSData as shown in the other example using NSJSONSeria...
Instead of using the delegate pattern, that split the implementation in various part of the UIViewController class, you can even use closures to pass data back and forward. By assuming that you're using the UIStoryboardSegue, in the prepareForSegue method you can easily setup the new controller in ...
Common Requirements All reports, regardless of how the data is presented, take a path to the report template and a parameter map. The variables are used in all examples that follow: // Parameters passed into the report. Map<String, Object> parameters = new HashMap<>(); // Arbitrary...
It's possible to pass Java objects to Nashorn engine to be processed in Java code. At the same time, there are some JavaScript (and Nashorn) specific constructions, and it's not always clear how they work with java objects. Below there is a table which describes behaviour of native Java objects ins...
Once the type handlers are registered, everything should work automatically, and you should be able to use these types as either parameters or return values: string redmond = "POINT (122.1215 47.6740)"; DbGeography point = DbGeography.PointFromText(redmond, DbGeography.DefaultCoordi...
To interact with WebElements in a webpage, first we need to identify the location of the element. By is the keyword available in selenium. You can locate the elements By.. By ID By Class Name By TagName By Name By Link Text By Partial Link Text By CSS Selector By XPath Using JavaScript ...
CSS div.needle { margin: 100px; height: 150px; width: 150px; transform: rotateY(85deg) rotateZ(45deg); /* presentational */ background-image: linear-gradient(to top left, #555 0%, #555 40%, #444 50%, #333 97%); box-shadow: inset 6px 6px 22px 8px #272727; } HTML <div c...
If you want to change the order of a character strings you can use parentheses in the pattern to group parts of the string together. These groups can in the replacement argument be addresed using consecutive numbers. The following example shows how you can reorder a vector of names of the form &quo...
Python 3.x3.2 accumulate yields a cumulative sum (or product) of numbers. >>> import itertools as it >>> import operator >>> list(it.accumulate([1,2,3,4,5])) [1, 3, 6, 10, 15] >>> list(it.accumulate([1,2,3,4,5], func=operator.mul)) [1, 2, 6, 24, 120] ...
Creating a separate instance of the WP_Query object is easy: $query_args = array( 'post_type' => 'post', 'post_per_page' => 10 ); $my_query = new WP_Query($query_args); if( $my_query->have_posts() ): while( $my_query->have_posts...
get_posts() is a wrapper for a separate instance of a WP_Query object. The returned value is an array of post object. global $post; $args = array( 'numberposts' => 5, 'offset'=> 1, 'category' => 1 ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : ...
A Cordova application runs as a website on a WebView component within the native mobile platform. Debugging a cordova application can therefore be done by utilizing your favourite browsers development tools. The following steps are needed to hook the application, running on the device, to the Chrome...
cycle is an infinite iterator. >>> import itertools as it >>> it.cycle('ABCD') A B C D A B C D A B C D ... Therefore, take care to give boundaries when using this to avoid an infinite loop. Example: >>> # Iterate over each element in cycle for a fixed range >&g...
Disclaimer: In no way does this example advocate the use of singletons. Singletons are to be used with a lot of care. In PHP there is quite a standard way of implementing a singleton: public class Singleton { private $instance; private function __construct() { }; public function...
example: df = pd.DataFrame({'group1' : ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'B'], 'group2' : ['C', 'C', 'C', 'D', 'E', 'E', 'F', 'F'], 'B' : ['one', np.NaN, np.NaN, np.NaN, ...
Problem There is a series of repeating elements in page that you need to know which one an event occurred on to do something with that specific instance. Solution Give all common elements a common class Apply event listener to a class. this inside event handler is the matching selector elemen...
Be aware that Microsoft Excel 2013 (and higher) uses Single Document Interface (SDI) and that Excel 2010 (And below) uses Multiple Document Interfaces (MDI). This implies that for Excel 2013 (SDI), each workbook in a single instance of Excel contains its own ribbon UI: Conversely for Excel...
From the documentation : In C#, arguments can be passed to parameters either by value or by reference. Passing by reference enables function members, methods, properties, indexers, operators, and constructors to change the value of the parameters and have that change persist in the calling e...
tree = log --oneline --decorate --source --pretty=format:'"%Cblue %h %Cgreen %ar %Cblue %an %C(yellow) %d %Creset %s"' --all --graph example * 40554ac 3 months ago Alexander Zolotov Merge pull request #95 from gmandnepr/external_plugins |\ | * e509f61 3 months ago Ievg...

Page 63 of 161