Tutorial by Examples: code

namespace Spirograph type MainWindow(app: App, model: Model) as this = inherit MainWindowXaml() let myApp = app let myModel = model let whenLoaded _ = () let whenClosing _ = () let whenClosed _ = () let menuExitHandler _ = System.Wind...
This part of development you should serialize the python RDD to the JVM. This process uses the main development of Spark to call the jar function. from pyspark.serializers import PickleSerializer, AutoBatchedSerializer rdd = sc.parallelize(range(10000)) reserialized_rdd = rdd._reserialize(Aut...
/* * Component is an interface * which all elements (files, * folders, links ...) will implement */ class Component { public: virtual int getSize() const = 0; }; /* * File class represents a file * in file system. */ class File : public Component { public: virtual int...
Abstract Class : package base; /* Abstract classes cannot be instantiated, but they can be subclassed */ public abstract class ClsVirusScanner { //With One Abstract method public abstract void fnStartScan(); protected void fnCheckForUpdateVersion(){ System....
Code the_title( '<h1>', '</h1>' ); Output The title of the current post or page in h1 tags
public function someAction(){ // Action's code return new Response($error, 500); } Another example: public function someAction(){ // Action's code $response = new Response(); $response->setStatusCode(500) $response->setContent($content); ...
public abstract class BaseActivity extends AppCompatActivity { private Map<Integer, PermissionCallback> permissionCallbackMap = new HashMap<>(); @Override protected void onStart() { super.onStart(); ... } @Override public void setConten...
Calling C code from Go package main /* // Everything in comments above the import "C" is C code and will be compiles with the GCC. // Make sure you have a GCC installed. int addInC(int a, int b) { return a + b; } */ import "C" import "fmt" func ma...
To comment or uncomment code select the lines and use Ctrl + Shift + C or Ctrl + Shift + /
With the help of West Wind's wwDotNetBridge, you can easily have access .NET code within a VFP program. The white paper has all the details, but this concise example will help illustrate the basic steps to running a method in a .NET assembly. Note that wwDotNetBridge can directly access simple pro...
To generalise what we've demonstrated above: individual things contain a fixed margin of "half-the-whitespace", and the container they are held in should have a padding of "half-the-whitespace". You can apply these styles in your application resource dictionary, and then you won'...
It is very common for C functions to accept pointers to other functions as arguments. Most popular example is setting an action to be executed when a button is clicked in some GUI toolkit library. It is possible to pass Haskell functions as C callbacks. To call this C function: void event_callback...
Native string functions are mapped to single byte functions, they do not work well with Unicode. The extentions iconv and mbstring offer some support for Unicode, while the Intl-extention offers full support. Intl is a wrapper for the facto de standard ICU library, see http://site.icu-project.org fo...
To enable Pull to Refresh in a ListView in Xamarin, you first need to specify that it is PullToRefresh enabled and then specify the name of the command you want to invoke upon the ListView being pulled: <ListView x:Name="itemListView" IsPullToRefreshEnabled="True" RefreshComm...
button.Click +=async delegate { var MScanner = new MobileBarcodeScanner(); var Result = await MScanner.Scan(); if(Result == null) { return; } //get the bar code text here string BarcodeText = Result.text; }
Algorithm PMinVertexCover (graph G) Input connected graph G Output Minimum Vertex Cover Set C Set C <- new Set<Vertex>() Set X <- new Set<Vertex>() X <- G.getAllVerticiesArrangedDescendinglyByDegree() for v in X do List<Vertex> adjacentVertices1 <- G....
Interpolating values is helpful if you need to pass a server-side variable to client-side JavaScript (or other languages that require it). In the case of variables, numbers, strings, and the like, you can pass these types of variables directly into your JavaScript with bracket syntax plus an explan...
Let's see how we can organize the code, when the codebase is getting larger. 01. Functions fn main() { greet(); } fn greet() { println!("Hello, world!"); } 02. Modules - In the same file fn main() { greet::hello(); } mod greet { // By default, everything inside a...
Like iOS where you use @IBOutlet and @IBAction, here you could use them too. Let's say we have a button which when clicked changes the label's text to something else. To get started: Add a WKInterfaceLabel and a WKInterfaceLabel to the InterfaceController. Ctrl-Drag from the WKInterfaceL...
Kotlin Plugin for Android Studio support converting existing Java files to Kotlin files. Choose a Java file and invoke action Convert Java File to Kotlin File:

Page 18 of 21