Tutorial by Examples: dac

This topic specifically talks about UTF-8 and considerations for using it with a database. If you want more information about using databases in PHP then checkout this topic. Storing Data in a MySQL Database: Specify the utf8mb4 character set on all tables and text columns in your database. ...
A syntactic extension that lets you write \case in place of \arg -> case arg of. Consider the following function definition: dayOfTheWeek :: Int -> String dayOfTheWeek 0 = "Sunday" dayOfTheWeek 1 = "Monday" dayOfTheWeek 2 = "Tuesday" dayOfTheWeek 3 = "W...
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...
Define AccumulatorParam import org.apache.spark.AccumulatorParam object StringAccumulator extends AccumulatorParam[String] { def zero(s: String): String = s def addInPlace(s1: String, s2: String)= s1 + s2 } Use: val accumulator = sc.accumulator("")(StringAccumulator) sc.pa...
Define AccumulatorParam: from pyspark import AccumulatorParam class StringAccumulator(AccumulatorParam): def zero(self, s): return s def addInPlace(self, s1, s2): return s1 + s2 accumulator = sc.accumulator("", StringAccumulator()) def add(x): gl...
Overload resolution occurs after name lookup. This means that a better-matching function will not be selected by overload resolution if it loses name lookup: void f(int x); struct S { void f(double x); void g() { f(42); } // calls S::f because global f is not visible here, ...
#include <stdio.h> #define ARRLEN (10) int main (void) { int n[ ARRLEN ]; /* n is an array of 10 integers */ size_t i, j; /* Use size_t to address memory, that is to index arrays, as its guaranteed to be wide enough to address all of the possible availab...
It is also possible to create nested actors, i.e. grand-children, like this: // here we pass in the ActorRefFactory explicitly as an example val a = actor(system, "fred")(new Act { val b = actor("barney")(new Act { whenStarting { context.parent ! ("hello from &quot...
Func provides a holder for parameterised anonymous functions. The leading types are the inputs and the last type is always the return value. // square a number. Func<double, double> square = (x) => { return x * x; }; // get the square root. // note how the signature matches the built ...
.message color: white .message-important @extend .message background-color: red This will take all of the styles from .message and add them to .message-important. It generates the following CSS: .message, .message-important { color: white; } .message-important { background-...
<?php /** * Panel: WPCustomize * * Basic Customizer panel with basic controls. * * @since 1.0.0 * @package WPC */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } // Customize function. if ( ! function_exists( 'wpc_panel_wpcustomize' ) ) { ...
Panels can have sections, sections can have settings, and settings can have controls. Settings are saved in the database, while the controls for particular settings are only used to display their corresponding setting to the user. This code creates a basic section in the panel from above. Inside a...
Sometimes you will have a grid of subplots, and you want to have a single legend that describes all the lines for each of the subplots as in the following image. In order to do this, you will need to create a global legend for the figure instead of creating a legend at the axes level (which wil...
A basic AppComponent that depends on a single AppModule to provide application-wide singleton objects. @Singleton @Component(modules = AppModule.class) public interface AppComponent { void inject(App app); Context provideContext(); Gson provideGson(); } A module to use to...
With the RequireQualifiedAccess attribute, union cases must be referred to as MyUnion.MyCase instead of just MyCase. This prevents name collisions in the enclosing namespace or module: type [<RequireQualifiedAccess>] Requirements = None | Single | All // Uses the DU with qualified acc...
Assume an application with a MainActivity which can call the Next Activity using a button click. public class MainActivity extends AppCompatActivity { private final String LOG_TAG = MainActivity.class.getSimpleName(); @Override protected void onCreate(Bundle savedInstanceState) { ...
Input.acceleration is used to read the accelerometer sensor. It returns Vector3 as a result which contains x,y and z axis values in 3D space. void Update() { Vector3 acclerometerValue = rawAccelValue(); Debug.Log("X: " + acclerometerValue.x + " Y: " + acclerometerV...
Using raw values directly from the accelerometer sensor to move or rotate a GameObject can cause problems such as jerky movements or vibrations. It is recommended to smooth out the values before using them. In fact, values from the accelerometer sensor should always be smoothed out before use. This ...
Read the accelerometer Sensor with precision. This example allocates memory: void Update() { //Get Precise Accelerometer values Vector3 accelValue = preciseAccelValue(); Debug.Log("PRECISE X: " + accelValue.x + " Y: " + accelValue.y + " Z: " + acc...
/** * Load a class by from a ClassNode * * @param cn * ClassNode to load * @return */ public static Class<?> load(ClassNode cn) { ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES); return new ClassDefiner(ClassLoader.getSystemClassLoader()).get(cn....

Page 1 of 3