Tutorial by Examples

Passing a 2d array to a functions seems simple and obvious and we happily write: #include <stdio.h> #include <stdlib.h> #define ROWS 3 #define COLS 2 void fun1(int **, int, int); int main() { int array_2D[ROWS][COLS] = { {1, 2}, {3, 4}, {5, 6} }; int n = ROWS; int m...
If you want to add a UIImageView to the center of the screen with width and height of 100 pixel, you need to set center x constraint and center y constraint to the superview from the UIImageView and width, height constraint to the UIIMageView. Here is the code. There is way to do this in storyboard ...
Detailed instructions on getting google-cloud-platform set up or installed.
A NullReferenceException is thrown when you try to access a non-static member (property, method, field or event) of a reference object but it is null. Car myFirstCar = new Car(); Car mySecondCar = null; Color myFirstColor = myFirstCar.Color; // No problem as myFirstCar exists / is not null Color...
PHPUnit provides the following functions to watch for thrown exceptions, which were released with 5.2.0: expectException($exception) expectExceptionMessage($message) expectExceptionCode($code) expectExceptionMessageRegExp($messageRegExp) These are used to watch for an exception to be thrown...
If you need to listen for changes to the page selected you can implement the ViewPager.OnPageChangeListener listener on the ViewPager: viewPager.addOnPageChangeListener(new OnPageChangeListener() { // This method will be invoked when a new page becomes selected. Animation is not necessar...
In Java, any object or primitive type can be an array. Array indicies are accessed via arrayName[index], e.g. myArray[0]. Values in an array are set via myArray[0] = value, e.g. if myArray is an array of type String[] myArray[0] = "test"; public class CreateBasicArray{ public static ...
public class CreateAnArray{ public static void main(String[] args){ // Creates a new array of Strings with a length of 3 // This length cannot be changed later String[] myStringArray = new String[3]; myStringArray[0] = "Hello"; // Java array ind...
public class CreateArrayWithValues { public static void main(String[] args){ // Initializes an array of Strings with values String[] myArray = {"this", "array", "has", "six", "initial", "values"}; System.out....
Problem statement: Find the minimum (over x, y) of the function f(x,y), subject to g(x,y)=0, where f(x,y) = 2 * x**2 + 3 * y**2 and g(x,y) = x**2 + y**2 - 4. Solution: We will solve this problem by performing the following steps: Specify the Lagrangian function for the problem Determine the K...
Xamarin is becoming more and more popular - it is hard to decide when to use Xamarin.Forms and when Xamarin.Platform (so Xamarin.iOS and Xamarin.Android). First of all you should know for what kind of applications you can use Xamarin.Forms: Prototypes - to visualize how your application will l...
Detailed instructions on getting scenekit set up or installed.
public static IWebDriver dismissAlert(this IWebDriver driver) { try { IAlert alert = driver.SwitchTo().Alert(); alert.Dismiss(); } catch {} return driver; } public static IWebDriver acceptAlert(this IWebDriver driver) { try { IAlert a...
public static Screenshot TakeScreenshot(this IWebDriver _driver) { return ((ITakesScreenshot)_driver).GetScreenshot(); } Usage example: driver.TakeScreenshot().SaveAsFile(@"/Test/Test.png",ImageFormat.Png);
The function show is automatically exported when use Data::Show; is executed. This function takes a variable as its sole argument and it outputs: the name of the variable the contents of that variable (in a readable format) the line of the file that show is run from the file show is run from ...
Every time jQuery is called, by using $() or jQuery(), internally it is creating a new instance of jQuery. This is the source code which shows the new instance: // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init construct...
Sympy is a Python library for doing symbolic — rather than numeric — calculations. For instance, consider the quadratic equation in x, x**2 + HELLO * x + WORLD = 0 where HELLO and WORLD are constants. What's the solution of this equation? In Python, using Sympy we can code, from sympy import s...
jQuery accepts a wide variety of parameters, and one of them is an actual DOM element. Passing a DOM element to jQuery will cause the underlying array-like structure of the jQuery object to hold that element. jQuery will detect that the argument is a DOM element by inspecting its nodeType. The mos...
In some cases, you would need to execute SQL query placed in string. EXEC, EXECUTE, or system procedure sp_executesql can execute any SQL query provided as string: sp_executesql N'SELECT * FROM sys.objects' -- or sp_executesql @stmt = N'SELECT * FROM sys.objects' -- or EXEC sp_executesql N'SEL...
You can execute SQL query as different user using AS USER = 'name of database user' EXEC(N'SELECT * FROM product') AS USER = 'dbo' SQL query will be executed under dbo database user. All permission checks applicable to dbo user will be checked on SQL query.

Page 932 of 1336