Tutorial by Examples: o

public class ViewAnimationUtils { public static void expand(final View v) { v.measure(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); final int targtetHeight = v.getMeasuredHeight(); v.getLayoutParams().height = 0; v...
Sometimes it is desirable to nest forms for the purpose of grouping controls and inputs logically on the page. However, HTML5 forms should not be nested. Angular supplies ng-form instead. <form name="myForm" noValidate> <!-- nested form can be referenced via 'myForm.myNestedFo...
Create drawable file named with custom_rectangle.xml in drawable folder: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color=&quo...
Add the following method to check whether an email address is valid or not: private boolean isValidEmailId(String email){ return Pattern.compile("^(([\\w-]+\\.)+[\\w-]+|([a-zA-Z]{1}|[\\w-]{2,}))@" + "((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?" ...
activity_main.xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation=...
Docstrings are - unlike regular comments - stored as an attribute of the function they document, meaning that you can access them programmatically. An example function def func(): """This is a function that does nothing at all""" return The docstring can ...
Add code in your Activity. This would work for Fragment also, no need to add this code in Fragment. @Override public boolean dispatchTouchEvent(MotionEvent ev) { View view = getCurrentFocus(); if (view != null && (ev.getAction() == MotionEvent.ACTION_UP || ev.getAction() == Moti...
DP to Pixel: private int dpToPx(int dp) { return (int) (dp * Resources.getSystem().getDisplayMetrics().density); } Pixel to DP: private int pxToDp(int px) { return (int) (px / Resources.getSystem().getDisplayMetrics().density); }
Tags make it particularly easy to locate specific game objects. We can look for a single game object, or look for multiple. Finding a Single GameObject We can use the static function GameObject.FindGameObjectWithTag(string tag) to look for individual game objects. It is important to note that, i...
When comparing two GameObjects by Tags, it should be noted that the following would cause Garbage Collector overhead as a string is created everytime: if (go.Tag == "myTag") { //Stuff } When performing those comparisons inside Update() and other regular Unity's callback (or a ...
Set High resolution programmatically. Camera mCamera = Camera.open(); Camera.Parameters params = mCamera.getParameters(); // Check what resolutions are supported by your camera List<Size> sizes = params.getSupportedPictureSizes(); // Iterate through all available resolutions and choos...
I have created GeoFenceObserversationService singleton class. GeoFenceObserversationService.java: public class GeoFenceObserversationService extends Service implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, ResultCallback<Status> { protected s...
As described in the remarks section the Android build system uses the Android Plugin for Gradle to support building Android applications with Gradle. You can specify the Android Plugin for Gradle version in the top-level build.gradle file. The plugin version applies to all modules built in that And...
There are many possible ways of customizing the look of a Button. This example presents several options: Option 0: Use ThemeOverlay (currently the easiest/quickest way) Create a new style in your styles file: styles.xml <resources> <style name=“mybutton” parent=”ThemeOverlay.AppC...
The purpose of the classpath is to tell a JVM where to find classes and other resources. The meaning of the classpath and the search process are intertwined. The classpath is a form of search path which specifies a sequence of locations to look for resources. In a standard classpath, these places...
By default stored procedures and functions or not generated by mysqldump, you will need to add the parameter --routines (or -R): mysqldump -u username -p -R db_name > dump.sql When using --routines the creation and change time stamps are not maintained, instead you should dump and reload the ...
#include <stddef.h> /* for offsetof() */ #include <stdlib.h> /* for exit() */ #include <stdio.h> /* for perror() */ #include <string.h> /* for strcmp() */ #include <unistd.h> /* for close(), unlink() */ #include <fcntl.h> /* for open() */ #incl...
In [1]: import pandas as pd In order to run a query in BigQuery you need to have your own BigQuery project. We can request some public sample data: In [2]: data = pd.read_gbq('''SELECT title, id, num_characters ...: FROM [publicdata:samples.wikipedia] ...: ...
If you have created service account and have private key json file for it, you can use this file to authenticate with pandas In [5]: pd.read_gbq('''SELECT corpus, sum(word_count) words FROM [bigquery-public-data:samples.shakespeare] GROUP BY co...
This example demonstrates how to do compile time checking of an annotated element. The annotation The @Setter annotation is a marker can be applied to methods. The annotation will be discarded during compilation not be available afterwards. package annotation; import java.lang.annotation.Eleme...

Page 597 of 1038