Tutorial by Examples: a

To enable the ripple animation in a CardView, add the following attributes: <android.support.v7.widget.CardView ... android:clickable="true" android:foreground="?android:attr/selectableItemBackground"> ... </android.support.v7.widget.CardView>
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 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 ...
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.
Dynamic queries are SET @sql = N'SELECT COUNT(*) FROM AppUsers WHERE Username = ''' + @user + ''' AND Password = ''' + @pass + '''' EXEC(@sql) If value of user variable is myusername'' OR 1=1 -- the following query will be executed: SELECT COUNT(*) FROM AppUsers WHERE Username = 'myusername...
In order to avoid injection and escaping problems, dynamic SQL queries should be executed with parameters, e.g.: SET @sql = N'SELECT COUNT(*) FROM AppUsers WHERE Username = @user AND Password = @pass EXEC sp_executesql @sql, '@user nvarchar(50), @pass nvarchar(50)', @username, @password Second ...

Page 760 of 1099