Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 09 04:00
    notyy commented #222
  • Oct 09 03:59
    notyy closed #222
  • Oct 09 03:59
    notyy commented #222
  • Oct 08 20:28
    Atry commented #223
  • Oct 08 20:28

    Atry on master

    docs: fix typo Merge pull request #223 from Ja… (compare)

  • Oct 08 20:28
    Atry closed #223
  • Oct 08 20:20
    Jason-Cooke opened #223
  • Oct 07 03:30
    glmars commented #222
  • Oct 06 04:05
    notyy opened #222
  • Oct 04 11:29
    datalchemist commented #217
  • Oct 04 11:02
    datalchemist commented #217
  • Oct 04 06:58

    Atry on scalafmt

    (compare)

  • Oct 04 06:46

    Atry on master

    Run scalafmt Merge branch 'master' into scal… Merge pull request #221 from Th… (compare)

  • Oct 04 06:46
    Atry closed #221
  • Oct 04 06:46
    Atry synchronize #221
  • Oct 04 06:46

    Atry on scalafmt

    Update scalafmt to 2.0.1 Update sbt to 1.3.2 Merge pull request #215 from sc… and 2 more (compare)

  • Oct 04 06:06
    Atry commented #217
  • Oct 04 05:30
    glmars commented #217
  • Oct 04 05:09
    Atry closed #191
  • Oct 04 05:09

    Atry on master

    Update scalafmt to 2.0.1 Merge pull request #203 from sc… (compare)

杨博 (Yang Bo)
@Atry
It's due to IntelliJ not tracking AST rewritten by macros, AFAIK
Adam Hibble
@Algomancer
DeepDarkFantasy looks brilliant. I am a deep learning engineer - so scala + neural nets is like my thing. Internally at Haitch Labs I use a torch7 wrapper with a lot of similar ideas. Thinking of switching it over to mxnet or tensorflow but I like lua and twitter has a bunch of torch+scala precedence to mirror.
雾雨魔理沙
@MarisaKirisame
Hi, developer of DeepDarkFantasy here. Feel free to PM me!
杨博 (Yang Bo)
@Atry
@Algomancer IMHO, creating neural networks in an untyped language makes little sense.
雾雨魔理沙
@MarisaKirisame
deontologic
@deontologic
Hmm. I'm also having problems with IDE support. I tried using scalatags, but can't get a simple example to complete
```<div>
  <input oninput={e: Event => name := e.currentTarget.asInstanceOf[Input].value} />
  Your input is: {name.bind}
</div>```
works fine, but removing the @dom annotation and changing the template to
div(
  input(oninput := {e: Event => name := e.currentTarget.asInstanceOf[Input].value}),
  p("Your value is: " + {name.bind})
).render
no longer works
Brandon Elam Barker
@bbarker
I have given up on Intel
Intellij for certain advanced scala features for now. Is that what you use?
deontologic
@deontologic
Yup. I investigated writing a scala plugin, but they only seem to support injecting functions and inner classes-objects into traits/classes/objects
I filed a question, but there are other macro-related questions from over a week ago that haven't received a response :(
What do you use instead? Eclipse or ensime?
Brandon Elam Barker
@bbarker
I am just starting, but am in the process of trying Eclipse since both Yang Bo and Miles Sabin seem to use it, iirc (quite unfortunate as I'm not a big fan of Eclipse's UI, but what can you do :))
And yeah, part of my reason was for finding a related sort of bug for the IDEA Scala plugin that has been open for some years...
Am off to a rough start trying to get remotely proper emacs key bindings, somehow incremental search isn't working with Ctrl-S =p But an online suggestion from 2006 had the same issue and noted that turning it off and on again (meaning the computer) worked...
deontologic
@deontologic
I ended up using spacemacs + ensime, and it's working pretty well.
I'm good with vim so it saved me a lot of config time
deontologic
@deontologic
Question: I notice that the documentation frequently uses both def and val to handle events, like onchange. My expectation is that val handler = (e: Event) => ... is more performant than def handler = (e: Event) => ..., as only one js.Function is created.
Is this assumption correct?
杨博 (Yang Bo)
@Atry
Yes. Though it is too trivial to affect performance.
杨博 (Yang Bo)
@Atry
You may also notice that handler is a scala.Function1, which requires a js.Function1 wrapper in order to assign it to onchange
val handler: js.Function1[Event, Unit] = { (e: Event) => 
  ...
}
If SAM type is enabled, explicitly marking handler a js.Function1 would avoid the wrapper.
deontologic
@deontologic
One more question :)
React has the dangerouslySetInnerHTML property, which lets one set inner html directly.
How would one accomplish similar with this library?
For example, I'm using katex to render math. They only expose two methods: render(latex, element), and renderToString(latex).
杨博 (Yang Bo)
@Atry
<div innerHTML={renderToString(latex)}></div>
Or
val div = <div></div>
render(latex, div)
div
deontologic
@deontologic
Thanks! I feel like a noob.
Didn't think the innerHTML attribute even existed
杨博 (Yang Bo)
@Atry
:smirk:
Milad Khajavi
@khajavi

Hi @Atry
Here I have:

case class Todo(name: Var[String], score: Var[Int])

and inputTableRow like this:

  @dom
  def inputTableRow(todo: Todo): Binding[TableRow] = {
    tr(
      td(
        input(value := todo.name.bind,
          onkeyup := { e: Event => todo.name := e.srcElement.asInstanceOf[Input].value })
      ),
      td(
        input(value := todo.score.bind.toString,
          onkeyup := { e: Event => todo.score := e.srcElement.asInstanceOf[Input].value.toInt })
      )
    ).asInstanceOf[TableRow]
  }

when I open rendered file in browser, my browser show me these errors:

blob

What is the problem?!

Milad Khajavi
@khajavi
I'm using Binding 10.0.0-M6 and Scalatags 0.6.1
杨博 (Yang Bo)
@Atry
Try tr(...).render instead of asInstanceOf
Milad Khajavi
@khajavi
thanks, my problem solved. but another one!
I want to convert this code to scalatag
<table>
  <tbody>
    {for (todo <- todos) yield {
    inputTableRow(todo).bind
  }}
  </tbody>
</table>.asInstanceOf[Table]
but scala tag version doesn't work:
  @dom
  def bindingTable(todos: BindingSeq[Todo]): Binding[Table] = {
    table(
      tbody(
        todos.map(inputTableRow(_)).bind.map(_.bind)
      )
    ).render
  }
blob
Milad Khajavi
@khajavi
here is the definition of inputTableRow:
  @dom
  def inputTableRow(todo: Todo): Binding[TableRow] = {
    tr(
      td(
        input(value := todo.name.bind,
          onkeyup := { e: Event => todo.name := e.srcElement.asInstanceOf[Input].value })
      ),
      td(
        input(value := todo.score.bind.toString,
          onkeyup := { e: Event => todo.score := e.srcElement.asInstanceOf[Input].value.toInt })
      )
    ).render
  }
杨博 (Yang Bo)
@Atry
See FAQ
Milad Khajavi
@khajavi
Thank you @Atry
I've another problem, I don't know whether it's related to scalatags or Binding.scala:
When I write simple binding for input, input tag loose focus when I type in it.
here is my code:
  @dom
  def myview: Binding[Div] = {
    val data: Var[String] = Var("Hello, World!")
    div(
      h1(data.bind),
      input(data.bind,
        onkeyup := { e: Event =>
          data := e.srcElement.asInstanceOf[Input].value
        }
      )
    ).render
  }