Tutorial by Examples: c

When you do a groupby you can select either a single column or a list of columns: In [11]: df = pd.DataFrame([[1, 1, 2], [1, 2, 3], [2, 3, 4]], columns=["A", "B", "C"]) In [12]: df Out[12]: A B C 0 1 1 2 1 1 2 3 2 2 3 4 In [13]: g = df.groupby(...
It is possible to define custom string interpolators in addition to the built-in ones. my"foo${bar}baz" Is expanded by the compiler to: new scala.StringContext("foo", "baz").my(bar) scala.StringContext has no my method, therefore it can be provided by implicit c...
Example Using Activity w/ LocationRequest /* * This example is useful if you only want to receive updates in this * activity only, and have no use for location anywhere else. */ public class LocationActivity extends AppCompatActivity implements GoogleApiClient.ConnectionCallbacks, ...
SELECT s.name + '.' + t.NAME AS TableName, SUM(a.used_pages)*8 AS 'TableSizeKB' --a page in SQL Server is 8kb FROM sys.tables t JOIN sys.schemas s on t.schema_id = s.schema_id LEFT JOIN sys.indexes i ON t.OBJECT_ID = i.object_id LEFT JOIN sys.partitions p ON i.object_id = ...
Caller info attributes can be used to pass down information about the invoker to the invoked method. The declaration looks like this: using System.Runtime.CompilerServices; public void LogException(Exception ex, [CallerMemberName]string callerMemberName = "", ...
Boolean(...) will convert any data type into either true or false. Boolean("true") === true Boolean("false") === true Boolean(-1) === true Boolean(1) === true Boolean(0) === false Boolean("") === false Boolean("1") === true Boolean("0") === t...
In themes.xml: <style name="AppTheme" parent="Theme.AppCompat"> <!-- Theme attributes here --> </style> In AndroidManifest.xml: <application android:icon="@mipmap/ic_launcher" android:label="@string/app_name" andr...
You can customize your theme’s color palette. Using framework APIs 5.0 <style name="AppTheme" parent="Theme.Material"> <item name="android:colorPrimary">@color/primary</item> <item name="android:colorPrimaryDark">@color/pri...
In themes.xml: <style name="MyActivityTheme" parent="Theme.AppCompat"> <!-- Theme attributes here --> </style> In AndroidManifest.xml: <application android:icon="@mipmap/ic_launcher" android:label="@string/app_name" ...
XML elements often nest, have data in attributes and/or as character data. The way to capture this data is by using ,attr and ,chardata respectively for those cases. var doc = ` <parent> <child1 attr1="attribute one"/> <child2>and some cdata</child2> </p...
The primary task of the manifest is to inform the system about the app's components. For example, a manifest file can declare an activity as follows: <?xml version="1.0" encoding="utf-8"?> <manifest ... > <application android:icon="@drawable/app_icon.pn...
Using the Android API 23 or higher, very often such situation can be seen: This situation is caused by the structural change of the Android API regarding getting the resources. Now the function: public int getColor(@ColorRes int id, @Nullable Theme theme) throws NotFoundException should ...
You can mix normal parameters and parameter arrays: public class LotteryTicket : IEnumerable{ public int[] LuckyNumbers; public string UserName; public void Add(string userName, params int[] luckyNumbers){ UserName = userName; Lottery = luckyNumbers; } } ...
/** * Created by Alex Sullivan on 7/21/16. */ public class Foo implements Parcelable { private final int myFirstVariable; private final String mySecondVariable; private final long myThirdVariable; public Foo(int myFirstVariable, String mySecondVariable, long myThirdVariab...
This tutorial explains how to download Image using AsyncTask in Android. The example below download image while showing progress bar while during download. Understanding Android AsyncTask Async task enables you to implement MultiThreading without get Hands dirty into threads. AsyncTask enables pro...
Operators such as +, -, ?? are a kind of function named using symbols rather than letters. They are invoked differently from functions: Prefix: -x Infix: x + y Postfix: x++ You can read more about basic operators and advanced operators in The Swift Programming Language.
MediaPlayer class can be used to control playback of audio/video files and streams. Creation of MediaPlayer object can be of three types: Media from local resource MediaPlayer mediaPlayer = MediaPlayer.create(context, R.raw.resource); mediaPlayer.start(); // no need to call prepare(); create...
The MediaPlayer$prepare() is a blocking call and will freeze the UI till execution completes. To solve this problem, MediaPlayer$prepareAsync() can be used. mMediaPlayer = ... // Initialize it here mMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener(){ @Override public ...
Inline style You can manipulate the inline CSS style of an HTML element by simply reading or editing its style property. Assume the following element: <div id="element_id" style="color:blue;width:200px;">abc</div> With this JavaScript applied: var element = doc...
Since all lifecycle hooks in Vue.js are just functions, you can place any of them directly in the instance declaraction. //JS new Vue({ el: '#example', data: { ... }, methods: { ... }, //LIFECYCLE HOOK HANDLING created: function() { ...

Page 140 of 826