Tutorial by Examples: st

mapWithState, similarly to updateState, can be used to create a stateful DStream based on upcoming data. It requires StateSpec: import org.apache.spark.streaming._ object StatefulStats { val state = StateSpec.function( (key: String, current: Option[Double], state: State[StatCounter]) =&g...
package { import flash.events.Event; public class CustomEvent extends Event { public static const START:String = "START"; public static const STOP:String = "STOP"; public var data:*; public function CustomEvent(type:Strin...
function meridiem(d:Date):String { return (d.hours > 11) ? "pm" : "am"; }
function isDaylightSavings(d:Date):Boolean { var months:uint = 12; var offset:uint = d.timezoneOffset; var offsetCheck:Number; while (months--) { offsetCheck = (new Date(d.getFullYear(), months, 1)).timezoneOffset; if (offsetCheck != offset) ret...
function today(date:Date = null):Date { if (date == null) date = new Date(); return new Date(date.fullYear, date.month, date.date, 0, 0, 0, 0); }
yii migrate/history # showing the last 10 applied migrations yii migrate/history 5 # showing the last 5 applied migrations yii migrate/history all # showing all applied migrations yii migrate/new # showing the first 10 new migrations yii migrate/new 5 # showing the first 5 ...
yii migrate/mark 150101_185401 # using timestamp to specify the migration yii migrate/mark "2015-01-01 18:54:01" # using a string that can be parsed by strtotime() yii migrate/mark m150101_185401_create_news_table # using full name yii migrate/mark 13...
An abstract class is a class that cannot be instantiated. Abstract classes can define abstract methods, which are methods without any body, only a definition: abstract class MyAbstractClass { abstract public function doSomething($a, $b); } Abstract classes should be extended by a child cla...
We can use Predefined Constants for Date format in date() instead of the conventional date format strings since PHP 5.1.0. Predefined Date Format Constants Available DATE_ATOM - Atom (2016-07-22T14:50:01+00:00) DATE_COOKIE - HTTP Cookies (Friday, 22-Jul-16 14:50:01 UTC) DATE_RSS - RSS (Fri, 22...
Installation Requirements The minimum requirement by this project template is that your Web server supports PHP 5.4.0. Yii2-advanced-app can be installed in two ways. They are Installing via Composer Installing from an Archive File 1) Installing via Composer If you do not already have Comp...
First, download the compiler and components. Next, add Swift to your path. On macOS, the default location for the downloadable toolchain is /Library/Developer/Toolchains. Run the following command in Terminal: export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}...
A std::vector can be useful for returning a dynamic number of variables of the same type. The following example uses int as data type, but a std::vector can hold any type that is trivially copyable: #include <vector> #include <iostream> // the following function returns all integers...
Program units often make use of literal constants. These cover the obvious cases like print *, "Hello", 1, 1.0 Except in one case, each literal constant is a scalar which has type, type parameters and value given by the syntax. Integer literal constants are of the form 1 -1 -1_1 ...
Postconditions ensure that the returned results from a method will match the provided definition. This provides the caller with a definition of the expected result. Postconditions may allowed for simplied implmentations as some possible outcomes can be provided by the static analyizer. Example......
Let there be Activity B that can be opened, and can further start more Activities. But, user should not encounter it when navigating back in task activities. The simplest solution is to set the attribute noHistory to true for that <activity> tag in AndroidManifest.xml: <activity a...
BeautifulSoup has a limited support for CSS selectors, but covers most commonly used ones. Use select() method to find multiple elements and select_one() to find a single element. Basic example: from bs4 import BeautifulSoup data = """ <ul> <li class="item&quo...
Leading Zeros let number: Int = 7 let str1 = String(format: "%03d", number) // 007 let str2 = String(format: "%05d", number) // 00007 Numbers after Decimal let number: Float = 3.14159 let str1 = String(format: "%.2f", number) // 3.14 let str2 = String(format: &...
Download a distributed archive from Binaries section of JMeter from Download Apache JMeter page. Depending on the version you downloaded, check minimal Java version requirements and install Java if needed. Ensure the JAVA_HOME environment variable is set and points to a correct version. ...
Installing Wildfly is just a matter of unzipping the distribution into your local machine. Wildfly can be dowloaded from its official website. Once it is unzipped go in to bin directory of installation and run standalone.sh for Linux systems or standalone.bat for Windows systems to start your WildF...
SyncAdapter /** * Define a sync adapter for the app. * <p/> * <p>This class is instantiated in {@link SyncService}, which also binds SyncAdapter to the system. * SyncAdapter should only be initialized in SyncService, never anywhere else. * <p/> * <p>The system ca...

Page 65 of 369