Tutorial by Examples

To use a FloatingActionButton just add the dependency in the build.gradle file as described in the remarks section. Then add to the layout: <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" ...
Download and install Xamarin Studio Community. Open Xamarin Studio. Click File → New → Solution. Click .NET → Console Project and choose C#. Click Next to proceed. Enter the Project Name and Browse... for a Location to Save and then click Create. The newly created project w...
HTTP requests are made through the WSClient class, which you can use as an injected parameter into your own classes. import javax.inject.Inject import play.api.libs.ws.WSClient import scala.concurrent.{ExecutionContext, Future} class MyClass @Inject() ( wsClient: WSClient )(implicit ...
Creating the JFrame Creating a window is easy. You just have to create a JFrame. JFrame frame = new JFrame(); Titling the Window You may wish to give your window a title. You can so do by passing a string when creating the JFrame, or by calling frame.setTitle(String title). JFrame frame = new...
A component is some sort of user interface element, such as a button or a text field. Creating a Component Creating components is near identical to creating a window. Instead of creating a JFrame however, you create that component. For example, to create a JButton, you do the following. JButton b...
Components have various parameters that can be set for them. They vary from component to component, so a good way to see what parameters can be set for components is to start typing componentName.set, and let your IDE's autocomplete (If you use an IDE) suggest methods. The default shortcut in many I...
DescriptionClassButtonJButtonCheckboxJCheckBoxDrop down menu / Combo boxJComboBoxLabelJLabelListJListMenu barJMenuBarMenu in a menu barJMenuItem in a menuJMenuItemPanelJPanelProgress barJProgressBarRadio buttonJRadioButtonScroll barJScrollBarSliderJSliderSpinner / Number pickerJSpinnerTableJTableTre...
Layouts are used whenever you want your components to not just be displayed next to each other. The GridBagLayout is a useful one, as it divides your window into rows and columns, and you decide which row and column to put components into, as well as how many rows and colums big the component is. L...
Having a button there is all well and good, but what's the point if clicking it does nothing? ActionListeners are used to tell your button, or other component to do something when it is activated. Adding ActionListeners is done as such. buttonA.addActionListener(new ActionListener() { @Overri...
The following examples show 3 main methods for installing Erlang/OTP on FreeBSD. Method 1 - Pre-built Binary Package Use pkg to install the pre-built binary package: $ pkg install erlang Test your new installation: $ erl Erlang/OTP 18 [erts-7.3.1] [source] [64-bit] [smp:2:2] [async-threads:1...
You can build a JSON object tree (a JsValue) manually import play.api.libs.json._ val json = JsObject(Map( "name" -> JsString("Jsony McJsonface"), "age" -> JsNumber(18), "hobbies" -> JsArray(Seq( JsString("Fishing"), ...
Fix takes a "template" type and ties the recursive knot, layering the template like a lasagne. newtype Fix f = Fix { unFix :: f (Fix f) } Inside a Fix f we find a layer of the template f. To fill in f's parameter, Fix f plugs in itself. So when you look inside the template f you find a...
Catamorphisms, or folds, model primitive recursion. cata tears down a fixpoint layer by layer, using an algebra function (or folding function) to process each layer. cata requires a Functor instance for the template type f. cata :: Functor f => (f a -> a) -> Fix f -> a cata f = f . fma...
Anamorphisms, or unfolds, model primitive corecursion. ana builds up a fixpoint layer by layer, using a coalgebra function (or unfolding function) to produce each new layer. ana requires a Functor instance for the template type f. ana :: Functor f => (a -> f a) -> a -> Fix f ana f = Fi...
It's common to structure a program as building up a data structure and then collapsing it to a single value. This is called a hylomorphism or refold. It's possible to elide the intermediate structure altogether for improved efficiency. hylo :: Functor f => (a -> f a) -> (f b -> b) ->...
If you already have sbt installed I find it easier to create a minimal Play project without activator. Here's how. # create a new folder mkdir myNewProject # launch sbt sbt When previous steps are completed, edit build.sbt and add the following lines name := """myProjectName&q...
CREATE TABLE table_name ( id INT NOT NULL AUTO_INCREMENT, json_col JSON, PRIMARY KEY(id) );
INSERT INTO table_name (json_col) VALUES ('{"City": "Galle", "Description": "Best damn city in the world"}'); That's simple as it can get but note that because JSON dictionary keys have to be surrounded by double quotes the entire thing should b...
C++11 Basic example: template<typename T> using pointer = T*; This definition makes pointer<T> an alias of T*. For example: pointer<int> p = new int; // equivalent to: int* p = new int; Alias templates cannot be specialized. However, that functionality can be obtained indi...
import os, sys from openpyxl import Workbook from datetime import datetime dt = datetime.now() list_values = [["01/01/2016", "05:00:00", 3], \ ["01/02/2016", "06:00:00", 4], \ ["01/03/2016", "07:00:00",...

Page 386 of 1336