Tutorial by Examples: er

Reading the content of a Reader as a String: // Reading from a file try (Reader reader = new FileReader("in.txt")) { String content = CharStreams.toString(reader); // do something with content } Reading the content of a Reader as a list of line contents: try (Reader reader = n...
Nginx configuration to detect request from mobile user-agent and redirect them to mobile site. location / { #mobile site handling as per user agent set $mobile_rewrite do_not_perform; // variable to store action. default set to not perform redirection to mobile site. if ($htt...
Traditionally, you can use routing to map an the request with the Routing Component who handled request and response parameters by HttpFoundation Component. Additionally, a custom route parameter can be created by using the FOSRestBundle to extends the default functionalities of the Routing Compone...
Custom matchers can be added in jasmine using the syntax: jasmine.addMatchers([ toMatch: function () { return { compare: function (actual, expected) { return { pass: actual===expected, message: "Expected actual to match expected...
Protractor can selectively run groups of tests using fdescribe() instead of describe(). fdescribe('first group',()=>{ it('only this test will run',()=>{ //code that will run }); }); describe('second group',()=>{ it('this code will not run',()=>{ //code...
Custom matchers will have their pass value negated when using 'not'. Custom matchers can have a negative compare attribute to explicitly handle cases where their negation is desired: toMatch: function () { return { compare: function (actual, expected) { return...
Two of the most fundamental higher-order functions included in the standard library are map and filter. These functions are generic and can operate on any iterable. In particular, they are well-suited for computations on arrays. Suppose we have a dataset of schools. Each school teaches a particular...
You can use the IFA for measuring ad clicks and the IFV for measuring app installs. IFA has built-in privacy mechanisms that make it perfect for advertising. In contrast, the IFV is for developers to use internally to measure users who install their apps. IFA ASIdentifierManager class pr...
A lot of example code posted on StackOverflow includes snippets like this: if ("A".equals(someString)) { // do something } This does "prevent" or "avoid" a possible NullPointerException in the case that someString is null. Furthermore, it is arguable that ...
- Without quotes: You can just split a long piece of text like this. - With quotes: "[But be careful: if you \"need\" punctuation, put double quotes around it. You can ev\ en split without spaces by using backslashes." - Or single quotes: 'This wor...
This is a simple trigger function. CREATE OR REPLACE FUNCTION my_simple_trigger_function() RETURNS trigger AS $BODY$ BEGIN -- TG_TABLE_NAME :name of the table that caused the trigger invocation IF (TG_TABLE_NAME = 'users') THEN --TG_OP : operation the trigger was fired IF (TG_O...
It's also possible to use selectors together. This is done by using the OpenQA.Selenium.Support.PageObjects.ByChained object: element = driver.FindElement(new ByChained(By.TagName("input"), By.ClassName("class")); Any number of Bys can be chained and are used as an AND type ...
This class open a .gz file (usual format of compressed log files) and will return a line at each call of .NextLine() There is no memory usage for temporary decompression, very useful for large file. Imports System.IO Class logread_gz Private ptr As FileStream Private UnGZPtr As Compress...
var person = { name: ko.observable('John') }; console.log(person.name()); console.log('Update name'); person.name.subscribe(function(newValue) { console.log("Updated value is " + newValue); }); person.name('Jane');
Though Go supports ++ and -- operators and the behaviour is found to be almost similar to c/c++, variables with such operators cannot be passed as argument to function. package main import ( "fmt" ) func abcd(a int, b int) { fmt.Println(a," &...
You can attach an image in a texture to a framebuffer, so that you can render directly to that texture. glGenFramebuffers (1, &framebuffer); glBindFramebuffer (GL_FRAMEBUFFER, framebuffer); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, ...
Go to the Microsoft link for the OpenXML SDK download. Click the red download button. On the next screen click the box next to OpenXMLSDKToolV25.msi and click next to begin the download. Once the download is complete, launch the OpenXMLSDKToolV25.msi and follow the instructions on the screen. Th...
preserveAspectRatio is an attribute that indicates whether the image should be scaled uniformly. This attribute only works if the <svg> element also has a viewBox. The default value is xMidYMid, which maintains the aspect ratio and centers the path inside the SVG container: <!-- when not ...
If you are inserting data into a table with an auto increment column and if you want to get the value of the auto increment column. Say you have a table called my_table: CREATE TABLE my_table ( id serial NOT NULL, -- serial data type is auto incrementing four-byte integer name character varying...
There are two types of Active Patterns that somewhat differ in usage - Complete and Partial. Complete Active Patterns can be used when you are able to enumerate all the outcomes, like "is a number odd or even?" let (|Odd|Even|) number = if number % 2 = 0 then Even else Odd N...

Page 296 of 417