Tutorial by Examples: f

When rendering a form 'by hand', it can be useful to know if there are fields left to render or not. The function isRendered() from the FormView class returns true if there are still fields left to be rendered to the template. This snippet prints <h3>Extra fields</h3> if there are fiel...
You can obtain the url for an existing remote by using the command git remote get-url <name> By default, this will be git remote get-url origin
While a simple mock returns null (or defaults for primitives) to every call, it is possible to change that behaviour. Dependency mock = Mockito.mock(Dependency.class, new Answer() { @Override public Object answer(InvocationOnMock invocationOnMock) throws Throwable { ...
If everything whas been set up correctly, the following snippet will show a window titled "SFML works!" with a green circle: #include <SFML/Graphics.hpp> int main() { sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!"); sf::CircleShape shape(100.f...
As a developer, you frequently find yourself dealing with strings that are not created by your own code. These will often be supplied by third party libraries, external systems, or even end users. Validating strings of unclear provenance is considered to be one of the hallmarks of defensive program...
module.exports.routes = { 'GET /foo': 'FooController.index', 'GET /foo/new': 'FooController.new', 'POST /foo/create': 'FooController.create', 'GET /foo/:id/edit': 'FooController.edit', 'PUT /foo/:id/update': 'FooController.update', 'GET /foo/:id': 'FooController.show', ...
module.exports.routes = { // This function will be executed for all http verbs on all urls 'all /*', function (req, res, next) { // Expose the function `fooBar` to all views (via the locals object) res.locals.fooBar = function (arg1) { return 'foobar' + arg1; }; }, };...
module.exports.routes = { 'GET /foo/*': { fn: function(req, res) { res.send("FOO!"); }, skipAssets: true }, };
You can limit the number of rows to be returned by using the maxrows attribute. <cfquery datasource="Entertainment" maxrows="50"> select * from Movies </cfquery>
create destination with <a id="destinationLinkName"></a> link to destination [link text](#destinationLinkName)
In order to get information about the URI the user agent used to access your resource, you can use the @Context parameter annotation with a UriInfo parameter. The UriInfo object has a few methods that can be used to get different parts of the URI. //server is running on https://localhost:8080, // ...
Virtual Methods are methods in Java that are non-static and without the keyword Final in front. All methods by default are virtual in Java. Virtual Methods play important roles in Polymorphism because children classes in Java can override their parent classes' methods if the function being overriden...
Structures in Rust are defined using the struct keyword. The most common form of structure consists of a set of named fields: struct Foo { my_bool: bool, my_num: isize, my_string: String, } The above declares a struct with three fields: my_bool, my_num, and my_string, of the type...
C.I.A.s are intended as a simple way of getting attributes from whatever is calling the targeted method. There is really only 1 way to use them and there are only 3 attributes. Example: //This is the "calling method": the method that is calling the target method public void doProcess() ...
Example showing how to create Guis using functions instead of labels. Gui, Add, Button, gCtrlEvent vButton1, Button 1 Gui, Add, Button, gCtrlEvent vButton2, Button 2 Gui, Add, Button, gGoButton, Go Button Gui, Add, Edit, vEditField, Example text Gui, Show,, Functions instead of labels CtrlEv...
You cam amend the time of a commit using git commit --amend --date="Thu Jul 28 11:30 2016 -0400" or even git commit --amend --date="now"
If you make a commit as the wrong author, you can change it, and then amend git config user.name "Full Name" git config user.email "[email protected]" git commit --amend --reset-author
Function scope is the special scope for labels. This is due to their unusual property. A label is visible through the entire function it is defined and one can jump (using instruction gotolabel) to it from any point in the same function. While not useful, the following example illustrate the point: ...
Caffe can run on multiple cores. One way is to enable multithreading with Caffe to use OpenBLAS instead of the default ATLAS. To do so, you can follow these three steps: sudo apt-get install -y libopenblas-dev Before compiling Caffe, edit Makefile.config, replace BLAS := atlas by BLAS := open A...
What's between \Q and \E is treated as normal characters #!/usr/bin/perl my $str = "hello.it's.me"; my @test = ( "hello.it's.me", "hello/it's!me", ); sub ismatched($) { $_[0] ? "MATCHED!" : "DID NOT MATCH!" } my @match = ( ...

Page 207 of 457