[Big data from introductory to discard series tutorial] in Idea's Java project, configure and join Scala, write and run Scala's Hello WorldOriginal link: http://www.cnblogs.com/blog5277/p/8615984.htmlOriginal Author: Blog Park------Click on the menu below to view Big data Getting started all tutorialsBig data from getting started to giving upUrl:Http://www.cnblogs.com/blog5277/category/1179528.htmlSplit ***
Why do you write this blog?First of all, for the Spark project, it is highly recommended to build, with IntelliJ idea (Ultimate version), if you have another hobby to try Scala ideas for Eclipse, have time to play for yourself. But it's best to follow the crowd.For Hadoop projects, Eclipse is strongly recommended.Second, out of a Bo friends to give me the need to leave a message, in order to more efficient
2, Scala simple example
Reference Tutorial: HTTPS://YQ.ALIYUN.COM/TOPIC/69 2.1 Interactive Programming
Spark-shell is spark interactive operating mode, provides interactive programming, side-knocking code side execution, do not need to create program source files, convenient debugging procedures, conducive to rapid learning spark.
[Root@node1 spark-2.2.0]# Bin/spark-shell Using Spark ' s default log4j prof
This is a Scala by Example from the official website.The example of how Scala is used in more detail after tutorial1.Programing with Actors and Message2.Expressions and Simple Functions3.first-class Functions4.Class and Objects5.Case Classes and Pattern Matching6.Generic Types and Methods7.Lists8.for-comprehensions9.Mu
Tags: in addition to the input situation Eclipse blog free org Speed waterBuild maven Scala projects with eclipse1. Install the Scala IDE first, help-->eclipse Marketplace---> Enter scala--and install.2, select the following 4 need to install3, then install down, until the installation is complete.Second, in addition to installing the
-line environmentEnter the project directory at the command line, enter SBT, and go to the SBT command line. (It is recommended to enter the project catalog before running the SBT command.) )Note: The first time you use the SBT command, the program will download the required jar packages. The whole process takes a long time and you have to wait patiently. When the ">" prompt appears in the window, SBT has s
If you compile a Scala project, you encounter the following exception:Can't expand macros compiled by previous versions of ScalaIt is possible that the Scala version of the project is inconsistent with the version of the dependent package, which requires that the project ver
Today is the second day to learn Liaoliang teacher Big data, today is mainly about the basic knowledge of Scala, the following begins the development of Scala tour.Tuple usePrint out the contents of the tripleArray usesArray is similar to the use of arrays in Java, but the way of traversal is somewhat differentOne of the above traversal methods is equivalent to the following traversal, and the output is the
First, get the location of the jar Package 1. Using ClasspathString path = This.getclass (). Getprotectiondomain (). Getcodesource (). GetLocation (). GetPath ();The return value is/xxx/xxx.jar this form. If the path contains Unicode characters, you also need to transcode the pathPath = Java.net.URLDecoder.decode (path, "UTF-8");2. Using the Java runtime's system properties to get the jar file location is also/xxx/xxx.jar this formString Path = System.getproperty ("Java.class.path"); int firstin
Brief introductionThere is no enumeration type in Scala, but the enumeration class is provided in the standard class library to produce enumerations. After extending the enumeration class, call the value method to initialize the possible values in the enumeration. The inner class value is actually an abstract class, and the real creation is Val. Because it's actually Val, you can pass in the ID and name for value If not specified, the ID is added to t
Here's a simple Scala call-by-name example. I ' ll show the normal approach to writing a method and passing in a parameter, and then show a call-by-name (pass by name) Example. 1) A "Normal" Scala method
Here I show how to pass a parameter to a method "normally", i.e., call by value:
Object Test extends App {
def ti
Package Yjmyzzimport Java.io.PrintWriterimport Java.util.Dateimport scala.io.Sourceobject ScalaApp02 {def main (args: Array[string]) {tupledemo println mapdemo println arraydemo println filewriteandread println (getu Rlcontent ("http://www.cnblogs.com/yjmyzz/")}/** * Tuple example */def Tupledemo = {//val represents a constant (equivalent to final in Java), VAR represents a variable Val tuple = ("Jimmy", +, New Date ())//This is more concise th
The program simply reads the data from the file and calculates it.Package com.bill.www/** * Created by Bill on 2016/2/3. * Purpose: Simple data calculation using Scala * source file: Interface record number of 20, including timestamp and floating-point data * execution: Scala Readfile.scala "E:\\spark\\data\\i_22_221000000073_l_ 20151016\\i_22_221000000073_l_20151016_223458.dat "* Development environment: W
Brief introductionThere are no enumeration types in Scala, but the enumeration class is provided in the standard class library to produce enumerations. After extending the enumeration class, call the value method class to initialize the possible values in the enumeration.The inner class value is actually an abstract class, and the real creation is Val. Because it is actually Val, you can pass in the ID and name for value. If not specified, the ID is a
After learning about some basic features of Scala, we can see its thread implementation: actor. I don't know if this is appropriate, because actor seems to focus on using message transmission to collaborate between entities. The prototype is as follows:
abstract class Actor extends Thread with MailBox{def act() : Unitoverride def run(): Unit = act()def !(msg: Any) = send(msg)}
From the source code of this version (The definition of actor and the abst
Cross-validation
method thought:
Crossvalidator divides the dataset into several subsets for training and testing respectively. When K=3, Crossvalidator produces 3 training data and test data pairs, each data is trained with 2/3 of the data, and 1/3 of the data is tested. For a specific set of parameter tables, Crossvalidator calculates the average of the evaluation criteria for the training model based on three sets of different training data and test data. After the optimal parameter table is
Original: https://my.oschina.net/u/877759/blog/501733
Write a scala multi-threaded demo to prepare for later use
Runnable/callable
Difference: runnable No return value, callable thread executes with return value
runnable Example
Importjava.util.concurrent. {Executors,executorservice} objecttest{defmain (args:Array[String]) {//Creating a thread pool valthreadpool:executorservice=
Executors.newfixedthreadpo
run as the Times wrong) 4. New Web. XML for configuring spring information 5. After spring is configured, hibernate information and auto-injection are configured in the spring configuration file as follows Applicationcontext-core.xml 6. Create a new Jdbc.properties file and configure the database connection (database can be adapted to MySQL, Oracle, SQL Server) #hibernate. Dialect=cn.walle.core.support.hibernate.oracle10gdialect
hibernate.dialect= Org.hibernate.dialect.SQLServerDialect
#jdbc. D
Maven's workspace.Under the. Settings directoryModified into-------Files under Project. Setting/org.eclipse.wst.common.project.facet.core.xmlModified intoReopen Properties Project Facets, see this place has been modified to 3.0; Tick on TomcatProject Engineering Creation CompleteNew one serverAfter starting to see if there are any errors, there is noRun, Test no problem---Browser input localhost:8080/
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.