Tutorial by Examples: f

The Hello World Web Script handles GET HTTP methods. But what if you want to create data on the server? For that your web script should handle POST. Here is a simple example that creates new folders in Company Home. It is invoked by making a POST call with a JSON body that looks like: {'name':'tes...
Dagger 2 supports creating a component from multiple modules. You can create your component this way: @Singleton @Component(modules = {GeneralPurposeModule.class, SpecificModule.class}) public interface MyMultipleModuleComponent { void inject(MyFragment myFragment); void inject(MyServic...
twitter-bootstrap-3 has provided four different sizes of buttons Large button btn-lg Default button does not require any btn size Small button btn-sm Extra small button btn-xs <button type="button" class="btn btn-lg">Large button</button> <button type=...
When automating the provisioning of new nodes to a swarm, you need to know what the right join token is for the swarm as well as the advertised address of the manager. You can find this out by running the following commands on any of the existing manager nodes: # grab the ipaddress:port of the mana...
Function pointers are the most basic way of passing functions around, which can also be used in C. (See the C documentation for more details). For the purpose of callable objects, a function pointer can be defined as: typedef returnType(*name)(arguments); // All using name =...
Every class which overloads the operator() can be used as a function object. These classes can be written by hand (often referred to as functors) or automatically generated by the compiler by writing Lambdas from C++11 on. struct Person { std::string name; unsigned int age; }; // Func...
When Vim opens a file with <CR><NL> line endings (common on MSDOS based operating systems, also called CRLF) it will set fileformat to dos, you can check what with: :set fileformat? fileformat=dos Or just :set ff? fileformat=dos To convert it to <NL> line endings (com...
If there is a null object on the collection it not throws a NPE, it returns a null instead: assert ['cat', 'dog', 'fish', null]*.length() == [3, 3, 4, null] Using it directly in a null object it's also null-safe: def nullCollection = null assert nullCollection*.length() == null
The sample content used here is Tears of Steel, by Blender Foundation. Specifically, we will use the download titled "HD 720p (~365MB, mov, 2.0)". This is a single file that ends with the extension "mov" and will play in just about any modern media player. Note that the download...
Same as, with writing classes - start with the simple cases, then add requirement (aka tests) and implementation (aka production code) case by case: [Test] public void EnsureThat_IsLeapYearIfDecimalMultipleOf4() {...} [Test] public void EnsureThat_IsNOTLeapYearIfDecimalMultipleOf100 {...} [Tes...
Here the steps required to create a Firebase project and to connect with an Android app. Add Firebase to your app Create a Firebase project in the Firebase console and click Create New Project. Click Add Firebase to your Android app and follow the setup steps. When prompted, enter yo...
Function Call add_theme_support( 'post-formats' )
First we initialize our initial value problem we want to solve. odefun = @(t,y) cos(y).^2*sin(t); tspan = [0 16*pi]; y0=1; We then use the ode45 function without any specified options to solve this problem. To compare it later we plot the trajectory. [t,y] = ode45(odefun, tspan, y0); plot(t,...
If we want some code to be executed periodically after the execution which was before is finished, we should use fixed delay (measured in milliseconds): @Component public class MyScheduler{ @Scheduled(fixedDelay=5000) public void doSomething() { // this will execute pe...
If we want something to be executed periodically, this code will be triggered once per the value in milliseconds we specify: @Component public class MyScheduler{ @Scheduled(fixedRate=5000) public void doSomething() { // this will execute periodically } }
Class for which you will create unit test case. class Authorization { /* Observer so that mock object can work. */ public function attach(Curl $observer) { $this->observers = $observer; } /* Method for which we will create test */ public function postAuthorization($url, $met...
require(['N/search'], function(SEARCHMODULE){ var savedSearchId = 'customsearch_mySavedSearch'; var mySearch = SEARCHMODULE.load(savedSearchId); var resultset = mySearch.run(); var results = resultset.getRange(0, 1000); for(var i in results){ var result = results[i]...
Formset is a way to render multiple forms in one page, like a grid of data. Ex: This ChoiceForm might be associated with some question of sort. like, Kids are most Intelligent between which age?. appname/forms.py from django import forms class ChoiceForm(forms.Form): choice = forms.CharFie...
A method called in one object will move up the chain of objects until one is found that can properly handle the call. This particular example uses scientific experiments with functions that can just get the title of the experiment, the experiments id or the tissue used in the experiment. abstract c...
Sometimes you might want to pass information that has been generated in one form, to another form for additional use. This is useful for forms that display a search tool, or a settings page among many other uses. Let's say you want to pass a DataTable between a form that is already open (MainForm) ...

Page 283 of 457