Tutorial by Examples: f

Here is a tested code for image and video.It will work for all APIs less than 19 and greater than 19 as well. Image: if (Build.VERSION.SDK_INT <= 19) { Intent i = new Intent(); i.setType("image/*"); i.setAction...
Once you have setup the Retrofit environment in your project, you can use the following example that demonstrates how to upload multiple files using Retrofit: private void mulipleFileUploadFile(Uri[] fileUri) { OkHttpClient okHttpClient = new OkHttpClient(); OkHttpClient clientWith30sTime...
The Java Native Interface (JNI) allows you to call native functions from Java code, and vice versa. This example shows how to load and call a native function via JNI, it does not go into accessing Java methods and fields from native code using JNI functions. Suppose you have a native library named ...
You can add a "Browse Our Other Apps" button in your app, listing all your(publisher) applications in the Google Play Store app. String urlApp = "market://search?q=pub:Google+Inc."; String urlWeb = "http://play.google.com/store/search?q=pub:Google+Inc."; try { I...
In Java, it's too "easy" to create many String instances which are not needed. That and other reasons might cause your program to have lots of Strings that the GC is busy cleaning up. Some ways you might be creating String instances: myString += "foo"; Or worse, in a loop or...
The Preview pane displays default values for data binding expressions if provided. For example : android:layout_height="@{@dimen/main_layout_height, default=wrap_content}" It will take wrap_content while designing and will act as a wrap_content in preview pane. Another example i...
A component can be registered either globally or locally (bind to another specific component). var Child = Vue.extend({ // ... }) var Parent = Vue.extend({ template: '...', components: { 'my-component': Child } }) Thiw new component () will only be available in...
public class VolleyErrorHelper { /** * Returns appropriate message which is to be displayed to the user * against the specified error object. * * @param error * @param context * @return */ public static String ...
In order to obtain a Google Maps API key for your certificate, you must provide the API console with the SH1-fingerprint of your debug/release keystore. You can obtain the keystore by using the JDK's keytool program as described here in the docs. Another approach is to obtain the fingerprint progr...
The following abstract defines an EmailAddress type based on the String type which will use a regular expression to validate the passed argument as an e-mail address. If the address isn't valid, an exception will be thrown. abstract EmailAddress(String) { static var ereg = ~/^[\w-\.]{2,}@[\w-\.]...
Windows : for %f in (C:\your_app_path\*.apk) do adb install "%f" Linux : for f in *.apk ; do adb install "$f" ; done
It is perfectly fine to use a package name other than the folder name. If we do so, we still have to import the package based on the directory structure, but after the import we have to refer to it by the name we used in the package clause. For example, if you have a folder $GOPATH/src/mypck, and i...
Sometimes gotoAndStop() is called in the middle of the code that refers some frame-based properties. But, right after the frame is changed all links to properties that existed on the current frame are invalidated, so any processing that involves them should be immediately terminated. There are two ...
Iterators utilize a form of the for loop known as the generic for loop. The generic form of the for loop uses three parameters: An iterator function that gets called when the next value is needed. It receives both the invariant state and control variable as parameters. Returning nil signals term...
Stateful iterators carry some additional information about the current state of the iterator. Using Tables The addition state can be packed into the generic for loop's invariant state. local function chars_iter(t, i) local i = i + 1 if i <= t.len then return i, t.s:sub(i, i)...
import pandas as pd generate random DF df = pd.DataFrame(np.random.randint(0,10,size=(10, 3)), columns=list('ABC')) In [16]: print(df) A B C 0 4 1 4 1 0 2 0 2 7 8 8 3 2 1 9 4 7 3 8 5 4 0 7 6 1 5 5 7 6 7 8 8 6 7 3 9 6 4 5 select rows where value...
Without a try catch block, undefined functions will throw errors and stop execution: undefinedFunction("This will not get executed"); console.log("I will never run because of the uncaught error!"); Will throw an error and not run the second line: // Uncaught ReferenceError:...
.Rprofile is a file containing R code that is executed when you launch R from the directory containing the .Rprofile file. The similarly named Rprofile.site, located in R's home directory, is executed by default every time you load R from any directory. Rprofile.site and to a greater extend .Rprofil...
For this example to work you'll need a JDBC driver compatible to the system the database is running on. An opensource one that allows you to connect to DB2 databases on an IBM System i can be found here: JT400 Even though this example is DB2 specific, it works for almost every other system if you e...

Page 185 of 457