Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 03 04:20

    pishen on master

    fix-number-length-for-order fix corresponding link Merge pull request #26 from Wei… (compare)

  • May 03 04:20
    pishen closed #26
  • May 03 04:17
    Wei-1 synchronize #26
  • May 03 04:16
    Wei-1 opened #26
  • Mar 29 07:03

    weihsiu on bengal

    (compare)

  • Mar 29 07:03

    weihsiu on master

    bengal initial commit Merge pull request #25 from Sca… (compare)

  • Mar 29 07:03
    weihsiu closed #25
  • Mar 29 07:03
    weihsiu opened #25
  • Mar 29 07:02

    weihsiu on bengal

    bengal initial commit (compare)

  • Feb 27 06:02

    pishen on master

    update ToC (compare)

  • Feb 27 05:58

    pishen on master

    add 2019-2-26 talk of wilbercaho Merge pull request #24 from cec… (compare)

  • Feb 27 05:58
    pishen closed #24
  • Feb 27 04:23
    cecol opened #24
  • Dec 21 2018 06:06

    weihsiu on master

    add 2018-12-20 wilber share of … Merge pull request #23 from cec… (compare)

  • Dec 21 2018 06:06
    weihsiu closed #23
  • Dec 21 2018 06:03
    cecol opened #23
  • Nov 14 2018 05:50

    pishen on master

    add the link to Miserable Future (compare)

  • Nov 14 2018 02:23

    pishen on master

    Add 'Scala in the Wild' present… Merge pull request #22 from jir… (compare)

  • Nov 14 2018 02:23
    pishen closed #22
  • Nov 14 2018 00:39
    jirijakes opened #22
Raymond Tay
@raymondtay
just like a few months ago
Yan Su
@yaroot
@raymondtay it was Tokyo :)
@weihsiu 10/3~8
jirijakes
@jirijakes
Yesterday, we shortly talked about Zio's STM. This is the video I mentioned: https://www.youtube.com/watch?v=d6WWmia0BPM .
Vito Jeng
@vitojeng
Hi, folks,
Does there a easy way to convert Scala Future(Scala 2.12) to Java Future ? :)
I know scala 2.13 have java future converter, but I still in scala 2.12... :(
jirijakes
@jirijakes

Hi, Vito.

I used this one before: https://github.com/scala/scala-java8-compat

SBT: "org.scala-lang.modules" %% "scala-java8-compat" % "0.9.0"

Vito Jeng
@vitojeng
Hi, Jiri,
Looks great. Thanks a lot!
Yan Su
@yaroot
you mean CompletableFuture, right?
Wilber Chao
@cecol
@jirijakes that is great !!
Tony KUO
@jinniw43805

Hello everyone:
Just started learning how to using spark/scala.

I have a question: how to explode the string one column and then explode to following row?
Suppose the dataframe have code column and we want to split the string inside then populate dataframe, how to deal with that
Example: "CODE - 123456789", it will generate "CODE - 123" and "CODE - 456789", length of two different will be 3 and 6

Screen Shot 2019-08-07 at 5.13.00 PM.png
Tony KUO
@jinniw43805
/* Do something with r1 */
val r1 = code(0, "Amy", "19940201", "CODE-123456789")

/* Define code class */
case class code(ID: Integer, NAME: String, DOB: String, CODE: String)
jirijakes
@jirijakes

Hi!

Things like this are usually done using method .flatMap. I don't remember how it is done in Spark but I believe it will be similar as Spark's API tries to be similar to standard collections' API. With List, it would be:

List("123456789", "987654321").flatMap(s => List(s, s.take(3), s.drop(3)))
// List("123456789", "123", "456789", "987654321", "987", "654321")

So .flatMap for list needs a function that returns a list. Then it will magically put it all together. Try, if you can do the same with Spark's datatype, I guess there will be .flatMap, too.

Tony KUO
@jinniw43805
@jirijakes
Thanks, I think I catch.
Yan Su
@yaroot
@ebenwert: In the IntelliJ Scala plugin 2019.2, we released Build Server Protocol as an official feature.
https://mobile.twitter.com/ebenwert/status/1159506095976660992
Jimin Hsieh
@jiminhsieh
That’s great news. I did try IntelliJ + Bloop when it was an experimental feature. It’s much faster than sbt when talking about import projects.
TzeKei Lee
@chikei
https://youtu.be/POUEz8XHMhE nice talk, IMHO the part 1-3 are best introduction to functional effect I've ever seen.
Jimin Hsieh
@jiminhsieh

https://blog.cleancoder.com/uncle-bob/images/fpvsoo.jpg

I know this slide came from which talk. lol

Jimin Hsieh
@jiminhsieh

https://www.youtube.com/watch?v=E8I19uA-wGY

I think everyone should take a look at that talk. Not only the content is really great but also kind of funny. lol

今天我說錯了,不是Scala.JS的作者,是Binding.scala
VueJS作者其中的一個回覆
你那么多东西挤一行里面,空行那么少,比行数有意义么… 是来搞笑的吧?想要的话我分分钟可以把 Vue 的 todomvc 行数压得比你的短。行了,你这样的态度我也没兴趣理你,连 Vue star 零头的不到的项目继续自娱自乐去吧。
Pishen Tsai
@pishen
我有 star Binding.scala 我驕傲,星星刷起來
Walter Chang
@weihsiu
@youngce very funny! thanks for sharing!
Pishen Tsai
@pishen
Bhfbnn3CMAA93mg.png
Tony KUO
@jinniw43805
Question:
如果想要確保如下的Input會符合三個group的格式,並且確保group0 == "1", group1 == "2", group2 == "3"
請問有什麼方法可以把後面三個判斷式寫在一個function呢
// Regex
val regex = """(\d)(\d)(\d)""".r
// Input
val input = "123"

input match {
  case regex(group0, group1, group2) if group0 == "1" && group1 == "2" && group2 == "3" => println(group0, group1, group2)
  case _ => print("Error format")
}
Pishen Tsai
@pishen

寫在一個 function?

def check(group0: String, group1: String, group2: String) = group0 == "1" && group1 == "2" && group2 == "3"

input match {
  case regex(group0, group1, group2) if check(group0, group1, group2) => println(group0, group1, group2)
  case _ => print("Error format")
}

不太清楚你想解決的是什麼問題?

Walter Chang
@weihsiu
@jinniw43805 as @pishen said, your question is a little unclear. this is my take of your question:
def matches(one: String, two: String, three: String, ifMatch: => Unit): PartialFunction[String, Unit] = {
  val threeNumbers = """(\d)(\d)(\d)""".r
  _ match {
    case threeNumbers(_1, _2, _3) if _1 == one && _2 == two && _3 == three => ifMatch
  }
}

val m: String => Unit = matches("1", "2", "3", println("got it")) orElse { case _ => println("boo") }

m("123") // got it
m("456") // boo
Tony KUO
@jinniw43805
不好意思,沒有說得很明白。
我的問題比較像是能在呼叫check()時引入參數的是group catching array, 而可以不用一個一個打參數進去。
input match {
  case regex(group0, group1, group2) if check(groups) => println(group0, group1, group2)
  case _ => print("Error format")
}

或是說比較漂亮的寫法是想要能夠實現當unapply時可以取得(group0, group1, group2),並且能夠針對這些group值順帶判斷

我思路是可能可以寫一個Object做pattern match,override unapply function並在unapply裡面順帶判斷check(groups)呢?

Pishen Tsai
@pishen
Tony KUO
@jinniw43805
啊,感覺可以實現
Walter Chang
@weihsiu
Scala Taiwan #32 - Introduction to Minitime
https://www.meetup.com/Scala-Taiwan-Meetup/events/263961981/
Please note that we have change the venue yet again, sorry for the inconvenience!
jirijakes
@jirijakes
Named holes in Scala: https://github.com/cb372/scala-typed-holes
def hello(args: Array[String]): Option[Result] = Foo.doStuff(args) match {
  case Left(error)  => __left
  case Right(x)     => __right
}
Found hole 'left' with type: Option[Result]
Relevant bindings include
  args: Array[String] (bound at input.scala:11:13)
  error: String (bound at input.scala:12:15)

    case Left(error)  => __left
Walter Chang
@weihsiu
Nice!
Jimin Hsieh
@jiminhsieh
@jirijakes 😎 Your talk at Scala Matsuri
https://www.youtube.com/watch?v=KG1XvPH-8rw
Jimin Hsieh
@jiminhsieh
@weihsiu 😎 Your talk at Scala Matsuri as well
https://www.youtube.com/watch?v=p9pn5Blfg04
Wilber Chao
@cecol
does anyone has idea for this?
it finally comes out Martin’s insight in the discuss
TzeKei Lee
@chikei
the original justifications are indeed pretty lame...
Wilber Chao
@cecol
only Martin can have Martin’s insight!
TzeKei Lee
@chikei
like, using markdown and yaml as supporting examples only shows he probably never write serious stuffs in these two format :smirk:
Walter Chang
@weihsiu
i like this one though lampepfl/dotty#7024
Vito Jeng
@vitojeng
as an experimental feature, I'm +1 :smile: