text:
Pattern matching follow-up PR. Don't merge yet

Misc documentation and implementation changes for pattern matching.

Typo on line 53 "mathc" should be match.

If you can add more examples that would be great IMHO. :)

If you can add more examples that would be great IMHO. :)

@juancarlospaco you mean more examples in documentation specifically (e.g. just copying some of them from tests), or coming up with more additional usage scenarios and putting them to documentation?

@juancarlospaco you mean more examples in documentation specifically (e.g. just copying some of them from tests), or coming up with more additional usage scenarios and putting them to documentation?

Whatever you feel like doing, but just more actual code examples that you can copy-paste and they work, like the one I suggested.
The explanations, descriptions and pseudo-code are more than enough,
but just 1 example thats actual code that you can copy-paste and play with.

Whatever you feel like doing, but just more actual code examples that you can copy-paste and they work, like the one I suggested.
The explanations, descriptions and pseudo-code are more than enough,
but just 1 example thats actual code that you can copy-paste and play with.

You're probably aware, but the footnotes are broken (i.e. they don't link), but this seems to be an issue in the RST generator.

You're probably aware, but the footnotes are broken (i.e. they don't link), but this seems to be an issue in the RST generator.

I think it should be clarified that ref objects can be matched just like normal object (at least it seems to work), the current documentation makes it sound like you need to use of to match ref objects.

I think it should be clarified that ref objects can be matched just like normal object (at least it seems to work), the current documentation makes it sound like you need to use of to match ref objects.

@konsumlamm to organize list of different implementation details that we've discussed (on discord, other issues etc)

[ ] Allow pattern matching on recursive Options in form of Some(Some(<pattern>)) as opposed to just Some(@variable) (as it is done now). <pattern> can be a single variable capture - @variable.
[ ] Make sure than (field: <pattern>) is supported and has the same behavior as (field: is <pattern>)
[ ] Make injected expr and pos gensymed
[ ] Fix documentation on

[ ] Pattern matching of ref objects when/if it is necessary to use of
[ ] Footnotes (I was aware that footnotes are not working properly, but I guess it is better to link things manually)
[ ] Implementing custom unpackers - they are supported but not properly documented

Additional pattern match guards in form of [@a, .._] if a == 1: as opposed to [@a == 1, .._] - using if as infix operator is not possible, so it would have to be something like [@a, .._] and a == 1: which might be supported, but I suppose it could be confusing (additional way of doing the same), and it doesn't play well with sequence operations, because [all @start < 10] requires single iteration and fails earlier as opposed to [all @start] and allOfIt(start, it < 10) or something like that.
If some of your points are missing - I probably forgot to add something, it wasn't intentional.
If you have any code snippets that you would like to work (like Some(Some()) that you wrote when testing pattern matching (or any other things that you would like to see working) - feel free to just drop them in as a comment in this discussion, I would put them in unit test.

@konsumlamm to organize list of different implementation details that we've discussed (on discord, other issues etc)

[ ] Allow pattern matching on recursive Options in form of Some(Some(<pattern>)) as opposed to just Some(@variable) (as it is done now). <pattern> can be a single variable capture - @variable.
[ ] Make sure than (field: <pattern>) is supported and has the same behavior as (field: is <pattern>)
[ ] Make injected expr and pos gensymed
[ ] Fix documentation on

[ ] Pattern matching of ref objects when/if it is necessary to use of
[ ] Footnotes (I was aware that footnotes are not working properly, but I guess it is better to link things manually)
[ ] Implementing custom unpackers - they are supported but not properly documented

Additional pattern match guards in form of [@a, .._] if a == 1: as opposed to [@a == 1, .._] - using if as infix operator is not possible, so it would have to be something like [@a, .._] and a == 1: which might be supported, but I suppose it could be confusing (additional way of doing the same), and it doesn't play well with sequence operations, because [all @start < 10] requires single iteration and fails earlier as opposed to [all @start] and allOfIt(start, it < 10) or something like that.
If some of your points are missing - I probably forgot to add something, it wasn't intentional.
If you have any code snippets that you would like to work (like Some(Some()) that you wrote when testing pattern matching (or any other things that you would like to see working) - feel free to just drop them in as a comment in this discussion, I would put them in unit test.

Some(Some(<pattern>)) Some(<pattern>)

FTFY.

Make sure that (field: <pattern>) is supported and has the same behavior as (field: is <pattern>). You edited this out to your comment on #245, but I guess it is better to have more intuitive syntax work too.

This seems to work, however I don't see the point of supporting is <pattern> in the first place. Or is it because @a is <pattern> works, to complement == 42?

Implementing custom unpackers - they are supported but not properly documented

Do you mean defining a proc and then matching (unpacker: <pattern>)? That is nice, but I still think we can do better.

Additional pattern match guards in form of [@a, .._] if a == 1: as opposed to [@a == 1, .._] - using if as infix operator is not possible, so it would have to be something like [@a, .._] and a == 1: which might be supported, but I suppose it could be confusing (additional way of doing the same), and it doesn't play well with sequence operations, because [all @start < 10] requires single iteration and fails earlier as opposed to [all @start] and allOfIt(start, it < 10) or something like that.

Hmm, I see, perhaps we could at least replace @a(<it expression>) with a custom template that gets exported from the module (to reuse the @a.predicate() mechanism). My biggest problem here is introducing a magic it variable.

Some(Some(<pattern>)) Some(<pattern>)

FTFY.

Make sure that (field: <pattern>) is supported and has the same behavior as (field: is <pattern>). You edited this out to your comment on #245, but I guess it is better to have more intuitive syntax work too.

This seems to work, however I don't see the point of supporting is <pattern> in the first place. Or is it because @a is <pattern> works, to complement == 42?

Implementing custom unpackers - they are supported but not properly documented

Do you mean defining a proc and then matching (unpacker: <pattern>)? That is nice, but I still think we can do better.

Additional pattern match guards in form of [@a, .._] if a == 1: as opposed to [@a == 1, .._] - using if as infix operator is not possible, so it would have to be something like [@a, .._] and a == 1: which might be supported, but I suppose it could be confusing (additional way of doing the same), and it doesn't play well with sequence operations, because [all @start < 10] requires single iteration and fails earlier as opposed to [all @start] and allOfIt(start, it < 10) or something like that.

Hmm, I see, perhaps we could at least replace @a(<it expression>) with a custom template that gets exported from the module (to reuse the @a.predicate() mechanism). My biggest problem here is introducing a magic it variable.

Do you mean defining a proc and then matching (unpacker: )? That is nice, but I still think we can do better.

I mean
    type
      UserType1 = object
        fld1: float
        fld2: string
        case isDefault: bool
          of true: fld3: float
          of false: fld4: string

      UserType2 = object
        userFld: UserType1
        fld4: float

    proc `[]`(obj: UserType1, idx: static[FieldIndex]): any =
      when idx == 0:
        obj.fld1

      elif idx == 1:
        obj.fld2

      elif idx == 2:
        if obj.isDefault:
          obj.fld3

        else:
          obj.fld4

      else:
        static:
          error("Indvalid index for `UserType1` field " &
            "- expected value in range[0..2], but got " & $idx
          )

    proc `[]`(obj: UserType2, idx: static[FieldIndex]): any =
      when idx == 0:
        obj.userFld

      elif idx == 1:
        obj.fld4

      else:
        static:
          error("Indvalid index for `UserType2` field " &
            "- expected value in range[0..1], but got " & $idx
          )

    block:
      (@fld1, @fld2, _) := UserType1(fld1: 0.1, fld2: "hello")

      doAssert fld1 == 0.1
      doAssert fld2 == "hello"

    block:
      (fld1: @fld1, fld2: @fld2) := UserType1(fld1: 0.1, fld2: "hello")

      doAssert fld1 == 0.1
      doAssert fld2 == "hello"

    block:
      ((@fld1, @fld2, _), _) := UserType2(userFld: UserType1(fld1: 0.1, fld2: "hello"))

      doAssert fld1 == 0.1
      doAssert fld2 == "hello"

And https://github.com/nim-lang/fusion/blob/ea18f8559c514b227b148300a2900b3e2a282b0d/tests/tmatching.nim#L1326 - overload [] for static[FieldIndex]

FTFY.  Some(Some(<pattern>)) Some(<pattern>)

We talked about nested optional patterns too, and they should be supported.

I don't see the point of supporting is  in the first place. Or is it because @a is <pattern> works, to complement == 42?

The following patterns are identical because both 42 and == 42 are 'final expressions' - (integer/string/float literals) - they won't be parsed further, and pasted as-is. Any expressions in the form of <prefix-operator> <something-else> is a final expression, unless <prefix-operator> is any of the following: is, of. is was added only because it didn't make sense to me to make it a hard error. of is used for derived object matching.
These matches are identical wrt. to generated code
    (a: 42) := (a: 42) # Final expression without prefix operator, compared for equality
    (a: is 42) := (a: 42) # `is <pattern>` with pattern being `42` (integer literal, final expression).
    (a: == 42) := (a: 42) # Final expression with prefix operator, pasted as-is

These generate different code
    (a: (@a, @b)) := (a: (1, 2)) # `(@a, @b)` is not a final expression, it will be decomposed further
    (a: (1, 2)) := (a: (1, 2)) # `(1, 2)` not a final expression, each element will be matched separately
    (a: == (1, 2)) := (a: (1, 2)) # Final expression, `.a` will be matched using `== (1, 2)`

let expr_38315001 = (a: (1, 2),)
let ok`gensym9350 =
  var b: typeof((
    let tmp`gensym9345 = expr_38315001.a[1]
    tmp`gensym9345))
  var a: typeof((
    let tmp`gensym9347 = expr_38315001.a[0]
    tmp`gensym9347))
  (
    a = expr_38315001.a[0]
    true or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m@a\e[24m. ")
    false) and
      (
    b = expr_38315001.a[1]
    true or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m@b\e[24m. ")
    false) or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m(@a, @b)\e[24m. ")
    false or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m(a: (@a, @b))\e[24m. ")
    false
discard ok`gensym9350
let expr_38345001 = (a: (1, 2),)
let ok`gensym9361 =
  (expr_38345001.a[0] == 1 or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m1\e[24m. ")
    false) and
      (expr_38345001.a[1] == 2 or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m2\e[24m. ")
    false) or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m(1, 2)\e[24m. ")
    false or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m(a: (1, 2))\e[24m. ")
    false
discard ok`gensym9361
let expr_38365001 = (a: (1, 2),)
let ok`gensym9368 =
  expr_38365001.a == (1, 2) or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m==(1, 2)\e[24m. ")
    false or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m(a: ==(1, 2))\e[24m. ")
    false
discard ok`gensym9368

But I understand your point about is being confusing - to be hones I was just stuck with this idea of using is explicitly, but it doesn't make much sense in the end, so I will update documentation/examples to just use (fld: <pattern>) when possible.

My biggest problem here is introducing a magic it variable.

Sequence matching was modeled after std/sequtils and it is a common idiom in other templates/macros. Explicit is better than implicit and variable injection should be used with care, but I think this case is justified.

Do you mean defining a proc and then matching (unpacker: )? That is nice, but I still think we can do better.

I mean
    type
      UserType1 = object
        fld1: float
        fld2: string
        case isDefault: bool
          of true: fld3: float
          of false: fld4: string

      UserType2 = object
        userFld: UserType1
        fld4: float

    proc `[]`(obj: UserType1, idx: static[FieldIndex]): any =
      when idx == 0:
        obj.fld1

      elif idx == 1:
        obj.fld2

      elif idx == 2:
        if obj.isDefault:
          obj.fld3

        else:
          obj.fld4

      else:
        static:
          error("Indvalid index for `UserType1` field " &
            "- expected value in range[0..2], but got " & $idx
          )

    proc `[]`(obj: UserType2, idx: static[FieldIndex]): any =
      when idx == 0:
        obj.userFld

      elif idx == 1:
        obj.fld4

      else:
        static:
          error("Indvalid index for `UserType2` field " &
            "- expected value in range[0..1], but got " & $idx
          )

    block:
      (@fld1, @fld2, _) := UserType1(fld1: 0.1, fld2: "hello")

      doAssert fld1 == 0.1
      doAssert fld2 == "hello"

    block:
      (fld1: @fld1, fld2: @fld2) := UserType1(fld1: 0.1, fld2: "hello")

      doAssert fld1 == 0.1
      doAssert fld2 == "hello"

    block:
      ((@fld1, @fld2, _), _) := UserType2(userFld: UserType1(fld1: 0.1, fld2: "hello"))

      doAssert fld1 == 0.1
      doAssert fld2 == "hello"

And https://github.com/nim-lang/fusion/blob/ea18f8559c514b227b148300a2900b3e2a282b0d/tests/tmatching.nim#L1326 - overload [] for static[FieldIndex]

FTFY.  Some(Some(<pattern>)) Some(<pattern>)

We talked about nested optional patterns too, and they should be supported.

I don't see the point of supporting is  in the first place. Or is it because @a is <pattern> works, to complement == 42?

The following patterns are identical because both 42 and == 42 are 'final expressions' - (integer/string/float literals) - they won't be parsed further, and pasted as-is. Any expressions in the form of <prefix-operator> <something-else> is a final expression, unless <prefix-operator> is any of the following: is, of. is was added only because it didn't make sense to me to make it a hard error. of is used for derived object matching.
These matches are identical wrt. to generated code
    (a: 42) := (a: 42) # Final expression without prefix operator, compared for equality
    (a: is 42) := (a: 42) # `is <pattern>` with pattern being `42` (integer literal, final expression).
    (a: == 42) := (a: 42) # Final expression with prefix operator, pasted as-is

These generate different code
    (a: (@a, @b)) := (a: (1, 2)) # `(@a, @b)` is not a final expression, it will be decomposed further
    (a: (1, 2)) := (a: (1, 2)) # `(1, 2)` not a final expression, each element will be matched separately
    (a: == (1, 2)) := (a: (1, 2)) # Final expression, `.a` will be matched using `== (1, 2)`

let expr_38315001 = (a: (1, 2),)
let ok`gensym9350 =
  var b: typeof((
    let tmp`gensym9345 = expr_38315001.a[1]
    tmp`gensym9345))
  var a: typeof((
    let tmp`gensym9347 = expr_38315001.a[0]
    tmp`gensym9347))
  (
    a = expr_38315001.a[0]
    true or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m@a\e[24m. ")
    false) and
      (
    b = expr_38315001.a[1]
    true or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m@b\e[24m. ")
    false) or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m(@a, @b)\e[24m. ")
    false or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m(a: (@a, @b))\e[24m. ")
    false
discard ok`gensym9350
let expr_38345001 = (a: (1, 2),)
let ok`gensym9361 =
  (expr_38345001.a[0] == 1 or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m1\e[24m. ")
    false) and
      (expr_38345001.a[1] == 2 or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m2\e[24m. ")
    false) or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m(1, 2)\e[24m. ")
    false or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m(a: (1, 2))\e[24m. ")
    false
discard ok`gensym9361
let expr_38365001 = (a: (1, 2),)
let ok`gensym9368 =
  expr_38365001.a == (1, 2) or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m==(1, 2)\e[24m. ")
    false or
    block:
      raise MatchError(msg: "Pattern match failed: element does not match \e[4m(a: ==(1, 2))\e[24m. ")
    false
discard ok`gensym9368

But I understand your point about is being confusing - to be hones I was just stuck with this idea of using is explicitly, but it doesn't make much sense in the end, so I will update documentation/examples to just use (fld: <pattern>) when possible.

My biggest problem here is introducing a magic it variable.

Sequence matching was modeled after std/sequtils and it is a common idiom in other templates/macros. Explicit is better than implicit and variable injection should be used with care, but I think this case is justified.

This PR is ready to be merged as I haven't found anything else that needs change

The first example in the documentation is still broken afaict (see review at the top).

Given that https://github.com/nim-lang/Nim/pull/16923 was merged, will you add a `case` alias to match?

With new release candidate near - https://forum.nim-lang.org/t/7494 - I think this can be merged now

I also added some patterns from https://www.python.org/dev/peps/pep-0636/, just to test how similar they are overall.

CI failure seems to be completely unrelated: Error: Archive 'windows_x32.zip' could not be found and/or downloaded. Maybe your OS/architecture does not have any prebuilt available?

authors: haxscramper hlaaftana juancarlospaco konsumlamm

repo: nim-lang/fusion


text:
Added shaname.

Please add shaname to packages.json.

@dom96 Perhaps your nim.cfg is missing the path to the sha1 library? or do I need to add Nim standard libraries as dependencies to the .nimble? Please let me know how to proceed.
In Gentoo I had to append path="$lib/std" manually to nim.cfg; cooking up a bug and a patch for this as we speak.

Ahh.  import shame/sha1
On 16 May 2018 08:55, "Torro" notifications@github.com wrote:
@dom96 https://github.com/dom96 Perhaps your nim.cfg is missing the path
to the sha1 library? or do I need to add Nim standard libraries as
dependencies to the .nimble? Please let me know how to proceed.
In Gentoo I had to append path="$lib/std" manually to nim.cfg; cooking up a
bug and a patch for this as we speak.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/nim-lang/packages/pull/739#issuecomment-389429210, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAPDe3ej8jN6PIhBWLL85qENwiaD2Hbeks5ty9uAgaJpZM4T_Imc
.

@dom96 come again?

*std/sha1
Sorry. I'm writing on my phone. That module is inside the std package.
IMO it should be importable without that prefix, but that's a bug report
for another time.
On Wed, 16 May 2018, 09:58 Torro, notifications@github.com wrote:

@dom96 https://github.com/dom96 come again?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/nim-lang/packages/pull/739#issuecomment-389446942,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPDe9RCovji-Xmy1V4xeWWStNqcNFODks5ty-obgaJpZM4T_Imc
.

No problem. Should be fixed now. Thanks :)

Brilliant, thanks!

@dom96 Sure thing. Happy to contribute :)

source: gharchive/pull-request

repo: nim-lang/packages

license_type: permissive

license_source: github-api


text:
QUIC support?

Is there any plan to add QUIC support to Cowboy? Would it make sense (probably would require sidestepping ranch as it's UDP based?)? Is it in the roadmap?

There is no plans until it looks like there will be users or someone wants to sponsor the work.
At this point though, it doesn't look like it would be a very good idea to start implementing as they are working heavily on the spec and it's not even been submitted to IETF yet. Basically everything can change at any time.
We can start implementing when it looks closer to becoming something real and not just a Google-only protocol.

Thanks for a prompt response! I'll close the issue for now.

Hi! Exists changes in the status of QUIC? The features looks interesting, but I don't know the status as standar or if Cowboy is waiting it will be more mature, etc. Or if finally QUIC only was abandoned.

QUIC is slowly being defined and will eventually become a standard. We're still quite a way to go from getting there I believe. See https://quicwg.github.io/
I would be surprised if it was ready before 2019 personally.

In case it might be useful to someone, I've worked on it for a while but eventually gave up due to the sheer instability and impact of changes on every release.

RFC 9000

See https://github.com/emqx/quic for what is probably the most mature library for this. I have no plans to do QUIC but will probably use this library to finish up the HTTP/3 support.

source: gharchive/issue

authors: erszcz essen g-andrade jhg-tgu lavrin peerst

repo: ninenines/cowboy

license: isc

license_source: bigquery


text:
Crash in cowboy_rest when accept header is missing?

Not sure if it really happened but I had a crash after removing the accept header in a request today. Investigate later.

Might also be a problem when the client has "/" and the server has content-types only with parameters.

Not sure if related, but I'm experiencing a unavoidable 406 if I try to override the content_types_provided.
Although it works with the default, so that is a clue that is my mistake instead of a bug.

I don't know Elixir, sorry.

No problem. The mystery is not in the code, really. I'm receiving 406 even though my request has no headers, which is impossible according to the flowcharts in the docs (since those checks are going to be skipped). With a little debugging, I've seen that in this case the accept header is set as "/", which may be triggering those checks inevitably.

You need the accept header regardless of what you define. A lack of accept header means that you accept nothing. accept: */* means that you accept everything.

I don't know Elixir, sorry.

@essen It is the same as erlang, just a different syntax, straight conversion though of this Elixir:
defmodule App do
    use Application

    def start(_type, _args) do
        dispatch = :cowboy_router.compile([{:_, [
            {"/thing", IndexHandler, []},
        ]}])
        {:ok, _} = :cowboy.start_clear(
            :http, 100, [{:port, 8080}],
            %{:env => %{:dispatch => dispatch}}
        )
    end
end

defmodule IndexHandler do
    def init(req, state) do
        {:cowboy_rest, req, state}
    end

...

    def content_types_provided(req, state) do
        {[{{"application", "json", '*'}, &to_json/2}], req, state}
    end
    def to_json(req, state) do
        {"{json: here}", req, state}
    end
end

To this Erlang (please excuse any mis-types, the above Elixir becomes two modules in Erlang):
-module('App').

-behaviour(application).

-export(start/2).

start(_type, _args) ->
  Dispatch = cowboy_router:compile([{'_', [
    {<<"/thing">>, 'IndexHandler', []}
  ]}]),
  {ok, _} = cowboy:start_clear(
    http, 100, [{port, 8080}],
    #{env => #{dispatch => Dispatch}}
    )

-module('IndexHandler').

-export(init/2, content_types_provided/2, to_json/2).

init(Req, State) ->
  {cowboy_rest, Req, State}.

% ...

content_types_provided(Req, State) ->
  {[{{<"application">, <"json">, "*"}, fun to_json/2}], Req, State}.

to_json(Req, State) ->
  {<"{json: here}">, Req, State}.

/me is a helper to convert Elixir -> Erlang  ^.^

You can't return a fun there, only a function name.

You can't return a fun there, only a function name.

That might indeed be his bug then.  :-)

Hoh, well. That is certainly going to bite later, but it can't be the cause since the 406 is returned before that argument can be relevant.

You'll have to show what requests you do if you want more help.

I think I solved it changing {[{{"application", "json", '*'} to {[{{"application", "json", []}. I didn't fully understand the role of the Param in the third element and followed the default value, so I just copied the '*' from the documented default.
Then after changing that fun to an atom makes a smooth 200 OK. So as I suspected, not a bug. :~) thanks for the Accept explanation anyway.

Closing because original ticket was vague and it got hijacked into something else. Thanks!

authors: OvermindDL1 essen villasv


text:
Add favicon for mac

It has to have 512px width and height

@MadejaMaciej It seems that you have made this 512x512 icon yourself. Keep in mind that we have all the assets prepared for all the platforms, based on what Electron guide specifies.
Make sure that you have it working, as you have used .png file where Electron guide requires you to use .icns file instead.
Reopening. Close again after you verify that this truly works on MacOS. Thanks.

It works, it doesn't matter from a long time, compiler just where playing tricks on me and would not compile as for windows and linux I had to use 256px one, and for mac 512px.

authors: MadejaMaciej mrfatguy

repo: niner-games/lost-dutchman-mine


text:
Issue with re2c

I am getting this issue with re2c. The build was okay sometime ago. Please help resolve this!
C:\ninja>python configure.py --bootstrap
bootstrapping ninja...
warning: A compatible version of re2c (>= 0.15.3) was not found; changes to src/*.in.cc will not affect your build.
depfile_parser.cc
c:\ninja\src\depfile_parser.h(18): fatal error C1083: Cannot open include file: 'string': No such file or directory
when running:  cl  /nologo /Zi /W4 /WX /wd4530 /wd4100 /wd4706 /wd4244 /wd4512 /wd4800 /wd4702 /wd4819 /wd4127 /wd4355 /wd4091 /GR- /Zc:__cplusplus /wd4267 /DNOMINMAX /D_CRT_SECURE_NO_WARNINGS /D_HAS_EXCEPTIONS=0 /DNINJA_PYTHON="python.exe" /FS /Ox /DNDEBUG /GL -I. -c .\src\depfile_parser.cc /Fobuild\depfile_parser.obj /Fdbuild\ninja.pdb
Traceback (most recent call last):
File "C:\ninja\configure.py", line 509, in
re2c_objs += cxx(name, variables=cxxvariables)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ninja\configure.py", line 284, in cxx
return n.build(built(name + objext), 'cxx', src(name + '.cc'), **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ninja\configure.py", line 166, in build
self._run_command(self._expand(cmd, local_vars))
File "C:\ninja\configure.py", line 191, in _run_command
subprocess.check_call(cmdline, shell=True)
File "C:\Users\syedsheh\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'cl  /nologo /Zi /W4 /WX /wd4530 /wd4100 /wd4706 /wd4244 /wd4512 /wd4800 /wd4702 /wd4819 /wd4127 /wd4355 /wd4091 /GR- /Zc:__cplusplus /wd4267 /DNOMINMAX /D_CRT_SECURE_NO_WARNINGS /D_HAS_EXCEPTIONS=0 /DNINJA_PYTHON="python.exe" /FS /Ox /DNDEBUG /GL -I. -c .\src\depfile_parser.cc /Fobuild\depfile_parser.obj /Fdbuild\ninja.pdb' returned non-zero exit status 2.

The error message Cannot open include file: 'string': No such file or directory means that your C++ compiler is not properly configured. This is failing to compile an #include <string> statement, which loads a header from the C++ standard library. The compiler cannot find it for some reason.

Most likely you need to run in a Visual Studio command prompt.

authors: SSHUSSAIN-86 digit-google jhasse

repo: ninja-build/ninja


text:
Avoid reallocs in EvalString::Evaluate

Concatenating strings often requires repeated reallocations as the
string grows, plus the cost of copying. These costs are not huge but
they are easily avoidable when, as in this case, we usually know the
final size.
This saves about 50 ms on a NOP-build of Chromium (not as much as I
had hoped).

This is a recreation of a previous pull requests. Now it is properly isolated on its own branch with no other changes.
I noticed after I created the PR that the commit message had two of its lines truncated. I can always recreate the PR if that needs fixing.
The gains for this change are not large, so maybe it's not worth it. I was really hoping for more, but the main cost of this function is creating ~6 million strings. Unless we can std::move from the parsed_ list this function probably can't be made much faster.

50 ms on a NOP-build of Chromium

How long is the whole NOP-build?

authors: jhasse randomascii


text:
[RESOLVED] S100-Primario has been restarted (uptime < 10m)

Problem started at 19:00:59 on 2023.05.21
Problem name: S100-Primario has been restarted (uptime < 10m)
Host: S100-Primario
Severity: Warning
Operational data: 00:06:37
Original problem ID: 20991
Event details in Zabbix: http://192.168.232.99/tr_events.php?triggerid=23452&eventid=20991

Problem has been resolved in 3m 30s at 19:04:29 on 2023.05.21
Problem name: S100-Primario has been restarted (uptime < 10m)
Host: S100-Primario
Severity: Warning
Original problem ID: 20991

license: MIT


text:
NINSUO Symfony Collection Crashes after 100 Records

I'm doing an asset management system and during the testing phase, the tester reported that she couldn't add any assets to a person anymore once the asset count reaches 100. I tried raising the max to 1000 to no avail. Upon closer look, it seems that the javascript itself crash causing the control buttons to not appear. These include the add and delete button.
Uncaught RangeError: Maximum call stack size exceeded     at r.fn.init.push (<anonymous>)     at ga.select (jQuery.js:2)     at Function.ga [as find] (jQuery.js:2)     at r.fn.init.find (jQuery.js:2)     at HTMLDivElement.<anonymous> (jquery.collection.js:735)     at Function.each (jQuery.js:2)     at r.fn.init.each (jQuery.js:2)     at String.<anonymous> (jquery.collection.js:730)     at Function.each (jQuery.js:2)     at setRightPrefix (jquery.collection.js:728)

Hey there,
Set max: 999 so the maximum elements won't be reached, there must be a bug with max option.
Cheers,
Alain

Nope still won't work, maybe I'm doing something wrong here:
        $('.asset_collection').collection({ allow_duplicate: false,
                                            allow_up: false,
                                            allow_down: false,
                                            max: 999,
                                            add_at_the_end: true,
                                            up: '',
                                            down: '',
                                            add: '',
                                            remove: '',
                                            duplicate: ''
        });

Okey, there may be an issue with recursions when there are too many children.
You can eventually use a hidden position field in your entity instead, because much less code is executed.
See the example here: https://symfony-collection.fuz.org/symfony3/basic/positionField
A

@Horzta Please make sure it is not PHP issue - I have not tried symfony-collection yet, but I've dealt with similar issue in the past.
If your FORM is broken you should probably check max-input-vars INI setting.
http://php.net/manual/en/info.configuration.php#ini.max-input-vars

authors: Horzta jkabat ninsuo

repo: ninsuo/symfony-collection

license: mit


text:
fMRIPrep v23.2.0a1 cannot find my T1s  "no attribute 'T1w_preproc'"

What happened?
I've run about 35 subjects from a different site through the 23.2.0a1 pipeline without issues, but the first subject from our site fails to find the T1w images regardless of the bids-filter-file
231219-10:42:18,443 nipype.workflow IMPORTANT:
         fMRIPrep started!
231219-10:42:19,440 nipype.workflow CRITICAL:
         fMRIPrep failed: 'DynamicTraitedSpec' object has no attribute 'T1w_preproc'

This subject's tree:
(myenv) [cmp12@blade25 code]$ tree ../sub-01667
../sub-01667
└── ses-01
    ├── anat
    │   ├── sub-01667_ses-01_T1w.json
    │   ├── sub-01667_ses-01_T1w.nii
    │   ├── sub-01667_ses-01_T2w.json
    │   └── sub-01667_ses-01_T2w.nii
    ├── fmap
    │   ├── sub-01667_ses-01_dir-AP_epi.json
    │   ├── sub-01667_ses-01_dir-AP_epi.nii
    │   ├── sub-01667_ses-01_dir-PA_epi.json
    │   └── sub-01667_ses-01_dir-PA_epi.nii
    ├── func
    │   ├── sub-01667_ses-01_task-rest_bold.json
    │   └── sub-01667_ses-01_task-rest_bold.nii
    └── perf
        ├── sub-01667_ses-01_asla.json
        ├── sub-01667_ses-01_asla.nii
        ├── sub-01667_ses-01_asl.json
        ├── sub-01667_ses-01_asl.nii
        ├── sub-01667_ses-01_cbf.json
        └── sub-01667_ses-01_cbf.nii

5 directories, 16 files

My bids filter file:
{
	"t1w": {
		"datatype": "anat",
		"suffix": "T1w",
        "session": "01"
	},
	"t2w": {
		"datatype": "anat",
		"suffix": "T2w",
        "session": "01"
	},
    "bold": {
		"datatype": "func",
        "session": "01",
		"suffix": "bold"
	},
	"fmap": {
		"datatype": "fmap",
        "session": "01"
	}
}

My execution of fmriprep via singularity.  Removing the filter file didn't matter:
singularity run --cleanenv -B $PACKDIR:/mnt/packages -B ${SINGULARITYENV_TEMPLATEFLOW_HOME}:/opt/templateflow \
 ${PACKDIR}/singularity/images/fmriprep-v23.2.1.sif \
 ${EXPERIMENT}/BIDS \
 ${EXPERIMENT}/BIDS/derivatives/fmriprep \
 participant --participant-label ${SUBJ} \
 --nthreads 12 --omp-nthreads 12 --skip_bids_validation \
 --work-dir ${EXPERIMENT}/work \
 --fs-subjects-dir  ${EXPERIMENT}/BIDS/derivatives/fs-ses-${SESS} \
 --bids-filter-file ${EXPERIMENT}/BIDS/code/bids_filter_ses-${SESS}.json \

My query of pybids layout outside of fmriprep works without issue:
In [14]: layout.get(subject='01667',suffix='T1w',session='01',datatype="anat")
Out[14]:
[<BIDSJSONFile filename='/mnt/munin2/Hasan/NIA_SCORE.01/Analysis/BIDS/sub-01667/ses-01/anat/sub-01667_ses-01_T1w.json'>,
 <BIDSImageFile filename='/mnt/munin2/Hasan/NIA_SCORE.01/Analysis/BIDS/sub-01667/ses-01/anat/sub-01667_ses-01_T1w.nii'>]

I reverted back to a v23.0.1 singularity image and its running without issue, using all the above inputs, filters, BIDS, etc.
Diff between a processed subject's T1 metadata and this current one that is failing.  Besides the site difference and a few scanner parameters, the only thing i can think of is the difference between dcm2bids versions.
(myenv) [cmp12@blade25 code]$ diff ../sub-01667/ses-01/anat/sub-01667_ses-01_T1w.json ../sub-0033/ses-01/anat/sub-0033_ses-01_T1w.json
4c4
<     "ImagingFrequency": 127.754886,
---
>     "ImagingFrequency": 127.753966,
6,9c6,9
<     "ManufacturersModelName": "SIGNA UHP",
<     "InstitutionName": "Duke University Hospital",
<     "DeviceSerialNumber": "0000000919684MR5",
<     "StationName": "bia5",
---
>     "ManufacturersModelName": "SIGNA Premier",
>     "InstitutionName": "Iowa MRRF",
>     "DeviceSerialNumber": "0000000319335MR2",
>     "StationName": "Iowa3T",
12,13c12,13
<     "ProcedureStepDescription": "nia_score.01",
<     "SoftwareVersions": "28\\LX\\MR Software release:RX28.0_R04_UHP3T_2122.a",
---
>     "ProcedureStepDescription": "DH_COICA",
>     "SoftwareVersions": "28\\LX\\MR Software release:RX28.0_R05_2035.a",
27c27
<     "AcquisitionTime": "11:12:55.000000",
---
>     "AcquisitionTime": "11:10:19.000000",
31,33c31,33
<     "SAR": 0.0821994,
<     "EchoTime": 0.0039,
<     "RepetitionTime": 2.41505,
---
>     "SAR": 0.0679135,
>     "EchoTime": 0.003624,
>     "RepetitionTime": 2.38357,
37,39c37,39
<         -4,
<         -28,
<         -132
---
>         36,
>         -11,
>         -199
41c41
<     "PrescanReuseString": "RN/s1,Coil/s1",
---
>     "PrescanReuseString": "TG/s1,CF/s1,AS/s1,RN/s1,Coil/s1",
61c61
**<     "Dcm2bidsVersion": "3.1.1"**
---
>     "Dcm2bidsVersion": "2.1.7"
` ``

### What command did you use?

```shell
231219-10:41:32,341 nipype.workflow IMPORTANT:
         Running fMRIPrep version 23.2.0a1

         License NOTICE ##################################################
         fMRIPrep 23.2.0a1
         Copyright 2023 The NiPreps Developers.

What version of fMRIPrep are you running?
23.2.0a1
How are you running fMRIPrep?
Singularity
Is your data BIDS valid?
Yes
Are you reusing any previously computed results?
No
Please copy and paste any relevant log output.
No response
Additional information / screenshots
231219-10:41:37,206 nipype.workflow INFO:
         ANAT Stage 8: Creating GIFTI surfaces for ['white', 'pial', 'midthickness', 'sphere_reg', 'sphere']
231219-10:41:37,229 nipype.workflow INFO:
         ANAT Stage 8: Creating GIFTI metrics for ['thickness', 'sulc']
231219-10:41:37,239 nipype.workflow INFO:
         ANAT Stage 8a: Creating cortical ribbon mask
231219-10:41:37,244 nipype.workflow INFO:
         ANAT Stage 9: Creating fsLR registration sphere
231219-10:41:37,250 nipype.workflow INFO:
         ANAT Stage 10: Creating MSM-Sulc registration sphere
231219-10:41:42,560 nipype.workflow INFO:
         B0 field inhomogeneity map will be estimated with the following 1 estimator(s): [<EstimatorType.PEPOLAR: 2>].
231219-10:41:43,104 nipype.workflow INFO:
         Setting-up fieldmap "pepolar1" (EstimatorType.PEPOLAR) with <sub-01667_ses-01_dir-AP_epi.nii, sub-01667_ses-01_dir-PA_epi.nii>
231219-10:41:48,183 nipype.workflow INFO:
         Stage 1: Adding HMC boldref workflow
231219-10:41:48,192 nipype.workflow INFO:
         Stage 2: Adding motion correction workflow
231219-10:41:48,203 nipype.workflow INFO:
         Stage 3: Adding coregistration boldref workflow
231219-10:41:48,318 nipype.workflow IMPORTANT:
         BOLD series will be slice-timing corrected to an offset of 0.326s.
231219-10:41:57,20 nipype.workflow INFO:
         fMRIPrep workflow graph with 484 nodes built successfully.
231219-10:42:18,443 nipype.workflow IMPORTANT:
         fMRIPrep started!
231219-10:42:19,440 nipype.workflow CRITICAL:
         fMRIPrep failed: 'DynamicTraitedSpec' object has no attribute 'T1w_preproc'

This has been fixed, please try 23.2.0a3 - thank you for piloting the alpha!

will do, thanks.

authors: cmpetty mgxd

repo: nipreps/fmriprep