text:
解决横向轮播图，实现缩放功能时，轮播器水平方向偏移和页数不对的问题，以及大小变化过程中页码闪烁问题

问题图：

解决后：

测试未发现此类问题，如果你发现了请说下重现步骤我测试下

您好，将您仓库中的ViewController.m与这个压缩的ViewController.m替换即可看到问题图中的现象
ViewController.m.zip

source: gharchive/pull-request

authors: gsdios ocarol

repo: gsdios/SDCycleScrollView

license: mit

license_type: permissive

license_source: bigquery


text:
修复自定义cell中的index不准确的bug

修复- (void)setupCustomCell:(UICollectionViewCell *)cell forIndex:(NSInteger)index cycleScrollView:(SDCycleScrollView *)view中的index不准确的bug;

修复- (void)setupCustomCell:(UICollectionViewCell *)cell forIndex:(NSInteger)index cycleScrollView:(SDCycleScrollView *)view中的index不准确的bug;
你好，遇到了同样的问题，请问你怎么解决的，下载的他最新的demo也还有这个问题

修复- (void)setupCustomCell:(UICollectionViewCell *)cell forIndex:(NSInteger)index cycleScrollView:(SDCycleScrollView *)view中的index不准确的bug;
你好，遇到了同样的问题，请问你怎么解决的，下载的他最新的demo也还有这个问题

你看下我提交那个分支的代码

现在他最新的代理里面没有willDisplayCell这个方法，还用去实现你在这个方法中写打代码吗
------------------ 原始邮件 ------------------
发件人:                                                                                "gsdios/SDCycleScrollView"                                                                                @.>;
发送时间: 2021年6月3日(星期四) 上午9:26
@.>;
@.@.>;
主题: Re: [gsdios/SDCycleScrollView] 修复自定义cell中的index不准确的bug (#665)
修复- (void)setupCustomCell:(UICollectionViewCell *)cell forIndex:(NSInteger)index cycleScrollView:(SDCycleScrollView *)view中的index不准确的bug;
你好，遇到了同样的问题，请问你怎么解决的，下载的他最新的demo也还有这个问题
你看下我提交那个分支的代码
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.

没有willDisplayCell这个方法，还用去实现你在这个
我是这样解决的，在willDisplayCell处理响应的业务

好的，那我明白了，谢谢
------------------ 原始邮件 ------------------
发件人:                                                                                "gsdios/SDCycleScrollView"                                                                                @.>;
发送时间: 2021年6月3日(星期四) 上午10:06
@.>;
@.@.>;
主题: Re: [gsdios/SDCycleScrollView] 修复自定义cell中的index不准确的bug (#665)
没有willDisplayCell这个方法，还用去实现你在这个
我是这样解决的，在willDisplayCell处理响应的业务
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.

authors: Liyongcong flyOfYW


text:
Suddenly getting AttributeError?

The 2.0 release of this library introduced a number of breaking changes in the API. We've written a migration guide here: https://pyairtable.readthedocs.io/en/2.0.0/migrations.html
If you see errors like this:

'Table' object has no attribute 'table_url'
'Table' object has no attribute 'table_name'
'Table' object has no attribute 'base_id'

...or something like it, then you probably have an unpinned dependency in your project. You should update your project's dependencies to be pinned to version 1.x until you have a chance to upgrade. Whether you use setuptools, pipenv, poetry, or just requirements.txt, a version specifier like pyairtable~=1.5 or pyairtable>=1.5,<2.0 should ensure you stay on a compatible version until you're ready to upgrade.
(This issue should remain open and pinned to the top of the issues list for some time after the 2.0 release.)

It's been a while. I'm going to unpin and close this issue.

source: gharchive/issue

repo: gtalarico/pyairtable

license: MIT

license_source: github-api


text:
Depend on gdk-pixbuf and use Duration

Closes #54

Seems linked to wrong Issue

AFAIR that PR used to replace deprecated sleep_ms in a slightly different way but it's hard to tell now and it had been opened against the wrong branch anyway.

authors: EPashkin gkoz

repo: gtk-rs/examples


text:
Add bindings for GTask

This addresses https://github.com/gtk-rs/gtk-rs/issues/73

This branch has conflicts that must be resolved

In case you missed that :)

This branch has conflicts that must be resolved

In case you missed that :)

Thanks @sdroege for your time on this, much appreciated :)

Thanks @sdroege for your time on this, much appreciated :)

authors: mbiggio sdroege

repo: gtk-rs/gtk-rs


text:
Support to send custom HTTP headers

Currently the ScanamoAsync functions does not provide any option to set custom HTTP headers. It would be nice to support an equivalent function putCustomRequestHeader from aws-java-sdk-dynamodb.

My use case is to pass an tracing information via the headers to the underlying repository.

The best solution at the moment would be to use your own interpreter based on https://github.com/guardian/scanamo/blob/master/src/main/scala/com/gu/scanamo/ops/ScanamoInterpreters.scala#L67. You could then modify the JavaRequests object in that file to add the custom headers.
I do see that that's rather clunky though.

Thanks for our suggestions.

repo: guardian/scanamo


text:
UndoManager Improvements (Firefox Freezing Fix)

Second attempt of #346.
This PR only address the failing test by avoiding passing options to scribe in the test file undo-manager.spec.js. Passing options in the tests is known to cause freezing, then a timeout, which end up failing the test. Now, the interval is not passed as an option. Instead, it is changed before starting the tests. It was successfully tested on Firefox 31 on Mac OS X (10.10).
Hopefully it will pass all other browsers/platforms this time around.
Edit: I've just tested it on Firefox 32, and I think there is still freezing issue. I'll try to identify the source of the issue. Actually not only aaalsaleh/scribe:master freezes, but also guardian/scribe:master freezes on Firefox 32 on Mac OS X (10.10)!

@rrees Firefox 31 problem is fixed, and it was due to the helpers as mentioned. With the last commit it can be considered fixed. However, Firefox 32 on Mac OS X 10.10 freezes with both guardian/scribe and aaalsaleh/scribe. I made fresh clones of both of them and verified that just now.
I tried the new version in #347 just to see, and both guardian/scribe and aaalsaleh/scribe went through successfully. To double check, I down graded back, and the same issue came back.
If this is a problem with the master branch, then I think it is a problem in the testing suite with this particular browser version. Can someone else confirm this manually for guardian/scribe and aaalsaleh/scribe with Firefox 32 (possibly on Mac OS X)?

@aaalsaleh I'll try and merge with master but I think we can live with disabling FF32 if that is the only problematic browser for now

@rress, technically it is most probably a problem with the tests suite, not the browser. The test freeze right from the beginning, and you can tell by the browser not even loading the local server URL to start the tests. I don't know what is the problem, but the tests run fine with #347. I've also made quick manual tests yesterday with both branches (before merge), and I didn't see any problems with FF32.

@rrees you merged both PR, but for some reason you kept the undo options (or was kept due to the separate two PRs?). Please remove the options, it is the cause of the freezing/failing that I fixed with this PR.

Yes, the order of the merges was to blame, I created a branch to make it a bit easier for me to try and keep the change in sync with master.

authors: aaalsaleh rrees

repo: guardian/scribe


text:
pekko support?

Any interest in supporting pekko-http. This is a FOSS fork of akka-http.
pekko-http 1.0.0 should be released this week. Snapshots are available already.
https://pekko.apache.org/docs/pekko-http

Pardon the delay, I'm on vacation for the next two weeks.
Is the only change the package namespace? If so it may be possible to have a module based on the akka modules that translates the package names in the AST during generation.
I've been pushing for explicit package names to avoid namespace collisions with terms that come from OpenAPI files, so this may be all that's required until the libraries diverge significantly.

Thanks @blast-hardcheese for your response.
The Pekko code uses different package names - org.apache.pekko instead of akka. The config names are prefixed with pekko instead of akka.
I've migrated a few libs to use Pekko and it is quite straightforward.

The Pekko code uses different package names - org.apache.pekko instead of akka. The config names are prefixed with pekko instead of akka.

:+1:

I've migrated a few libs to use Pekko and it is quite straightforward.

:+1:

There is no urgency is this issue but it would be nice to get around to it in a few months.

indeed. I'm heartened that there's a push in this direction, happy to lend support when I can.

OK, I've started on this -- Initial module work is in progress and should be published to maven central in a few days, though the ABI will only be compatible with the most recent SNAPSHOT release.

For those who see this, something that would be very much appreciated is adding your organization name to the Adopters list in README.md.
Additionally, especially if you use guardrail internals, please join the matrix server, there have been some significant structural changes to make it easier to develop new modules.

Alright, thank you all for the interest!
Since this has been an ask from a few organizations at this point, feel free to reach out to devon@guardrail.dev or over Matrix if you determine you need more personalized solutions for your environment.
For the DIY-ers, here's what you need to get guardrail generating Apache Pekko:
guardrail-cli usage:
cs launch -r https://s01.oss.sonatype.org/content/repositories/snapshots \
  dev.guardrail::guardrail-cli:0.71.0 dev.guardrail::guardrail-scala-pekko-http:0.1.0 \
  -- --defaults --specPath .../petstore.json --outputPath /tmp/example/src/main/scala --packageName example \
     --module pekko-http --module circe \
     --client --server

sbt-guardrail usage:
diff --git a/build.sbt b/build.sbt
index 213d979..ec765f2 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,5 +1,5 @@
 Compile / guardrailTasks := List(
-  ScalaServer(file("petstore.yaml"), pkg="foo"),
+  ScalaServer(file("petstore.yaml"), pkg="foo", modules=List("pekko-http", "circe")),
 )

diff --git a/project/guardrail.sbt b/project/guardrail.sbt
index c146a2d..bd14acc 100644
--- a/project/guardrail.sbt
+++ b/project/guardrail.sbt
@@ -1 +1,10 @@
-addSbtPlugin("com.twilio" % "sbt-guardrail" % "0.64.0")
+addSbtPlugin("dev.guardrail" % "sbt-guardrail" % "0.75.2")
+
+libraryDependencies ++= Seq(
+  "dev.guardrail" %% "guardrail-scala-pekko-http" % "0.1.0",
+  "dev.guardrail" %% "guardrail-core" % "0.76.0-SNAPSHOT",
+  "dev.guardrail" %% "guardrail-scala-support" % "0.76.0-SNAPSHOT",
+  "dev.guardrail" %% "guardrail-scala-akka-http" % "0.77.0-SNAPSHOT",
+)
+
+resolvers += "Sonatype OSS Snapshots" at "https://s01.oss.sonatype.org/content/repositories/snapshots"

Note: For build tooling, you'll have to provide a snapshot release of akka-http as well to avoid ABI classloader exceptions.
Since this appers to work, I'll close this issue. As we continue to build towards the next major release, this module will get updates.

@blast-hardcheese Thank you, this is great!
Though I'm experiencing some difficulties due to SPI/loading conflicts, basically what I had previously is a custom pekko module with a dependency on "dev.guardrail" %% "guardrail-scala-akka-http" % "0.75.0", with the replaced imports and some amount of code duplication and custom functionality. Replacing the dependency to "dev.guardrail" %% "guardrail-scala-pekko-http" % "0.1.0", caused messages like  Failed to run cli: dev.guardrail.generators.spi.ClientGeneratorLoader: Provider dev.guardrail.generators.scala.pekkoHttp.PekkoHttpClientGeneratorLoader could not be instantiated to appear, I tried experimenting with the content of resources/META-INF/services/dev.guardrail.generators.spi.ClientGeneratorLoader in my repository adding dev.guardrail.generators.scala.pekkoHttp.PekkoHttpClientGeneratorLoader and also changing the CLI arguments adding pekko-http as an additional argument to --module but no effect. I remember SPI loading this was kind of difficult to troubleshoot, I remember that there has to be no ambiguity and maybe I have to do it some other way, I'd appreciate some guidance on this.

tried a hack of creating a dummy declaration for dev.guardrail.generators.scala.pekkoHttp.PekkoHttpClientGeneratorLoader so it gets picked up - now I'm getting java.lang.AbstractMethodError: Receiver class dev.guardrail.generators.scala.pekkoHttp.PekkoHttpClientGenerator does not define or inherit an implementation of the resolved method 'abstract cats.Monad MonadF()' of abstract class dev.guardrail.terms.client.ClientTerms. looks like the structure of dev.guardrail.terms.client.ClientTerms has changed between what is in 0.75.3 and in https://github.com/guardrail-dev/guardrail/blob/master/modules/core/src/main/scala/dev/guardrail/terms/client/ClientTerms.scala

I've changed guardrail-core and guardrail-scala-support versions to "0.75.3-SNAPSHOT" and will be trying to adjust everything to the changes in the api

repo: guardrail-dev/guardrail


text:
Issue-572 akka-http response headers

implementation of https://github.com/guardrail-dev/guardrail/issues/572
Contributing to Twilio

All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.

[x]  I acknowledge that all my contributions will be made under the project's license.

/bar:
    get:
      operationId: getBar
      responses:
        '204':
          headers:
            X-Required-Header:
              type: string
              required: true
            X-Optional-Header:
              type: string

According to: https://swagger.io/docs/specification/describing-responses/
headers:
            X-RateLimit-Limit:
              schema:
                type: integer
              description: Request limit per hour.
            X-RateLimit-Remaining:
              schema:
                type: integer
              description: The number of requests left for the time window.
            X-RateLimit-Reset:
              schema:
                type: string
                format: date-time
              description: The UTC date/time at which the current rate limit window resets.

it seems like the spec expects the type to be nested under schema. Why was the implementation here made against the spec?

We are using the official OpenAPI parser, walking their domain objects, to ensure we're as close to the spec as we can be. Perhaps this is a bug upstream?
Alternately, we may be relying on a deprecated property and not realizing it, I suppose.

authors: Peppi-Ressler Veske blast-hardcheese


text:
Minimal PowerShell Sample

using namespace Terminal.Gui

# Load the Terminal.Gui assembly and its dependencies (assumed to be in the
# the same directory).
# NOTE: `using assmembly <path>` seemingly only works with full, literal paths
# as of PowerShell Core 7.1.0-preview.7.
# The assumption here is that all relevant DLLs are stored in subfolder
# assemblies/bin/Release/*/publish of the script directory, as shown in
#   https://stackoverflow.com/a/50004706/45375
#Add-Type -Path $PSScriptRoot/assemblies/bin/Release/*/publish/Terminal.Gui.dll

# Initialize the "GUI".
# Note: This must come before creating windows and controls.
[Application]::Init()

$win = [Window] @{
  Title = 'Hello World'
}

$edt = [TextField] @{
    X = [Pos]::Center()
    Y = [Pos]::Center()
    Width = 20
    Text = 'This text will be returned'
}
$win.Add($edt)

$btn = [Button] @{
  X = [Pos]::Center()
  Y = [Pos]::Center() + 1
  Text = 'Quit'
}
$win.Add($btn)
[Application]::Top.Add($win)

# Attach an event handler to the button.
# Note: Register-ObjectEvent -Action is NOT an option, because
# the [Application]::Run() method used to display the window is blocking.
$btn.add_Clicked({
  # Close the modal window.
  # This call is also necessary to stop printing garbage in response to mouse
  # movements later.
  [Application]::RequestStop()
})

# Show the window (takes over the whole screen).
# Note: This is a blocking call.
[Application]::Run()

# As of 1.0.0-pre.4, at least on macOS, the following two statements
# are necessary on in order for the terminal to behave properly again.
[Application]::Shutdown() # Clears the screen too; required for being able to rerun the application in the same session.
#tput reset # To make PSReadLine work properly again, notably up- and down-arrow.
$edt.Text.ToString()

See this: https://stackoverflow.com/questions/64178641/how-to-add-an-event-action-handler-in-powershell/64232782#64232782

@mklement0,
tput reset # To make PSReadLine work properly again, notably up- and down-arrow.

What's up with this? What does tput reset do? Shouldn't terminal.gui do this?

I hope that could fix the #931 issue.

@tig:

tput reset resets the terminal to its default state.

Yes, such a call shouldn't be necessary - Terminal.Gui should restore the previous state - though I'm not 100% certain if PowerShell, specifically its PSReadLine module, is completely blameless here, as I've seen other strange behaviors after running programs that don't seem to surface in other shell.

Actually, resetting the terminal with tput init is better, because it doesn't clear the screen.(It is POSIX-mandated,  though what it actually does is left to the implementation).
It is effective in preventing subsequent command-line editing problems on both macOS and Ubuntu, so it might indeed help in WSL too.
The problem only occurs in-process in PowerShell and is not related to the PSReadLine module, as it turns out (running Remove-Module PSReadLine first still exhibits the same up/down-arrow problems after).
Possibly related: there's a longstanding bug report that describes the opposite problem (up/down-arrow keys not working in a utility that displays an alternate screen): https://github.com/PowerShell/PowerShell/issues/7375
If you call the code via PowerShell's CLI - pwsh -noprofile -file script.ps1 - it works fine even without tput init, including when calling from, say, bash.

@mklement0 Do you know where I can find the source to tput?
I have a feeling this is relevant:
https://github.com/PowerShell/GraphicalTools/blob/6e8fb2f7f7bb2aec746e67225de2675132c8c601/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs#L327
I thought I had removed this and moved it into gui.cs already.
        Console.Write("\u001b[?1h");

I can confirm that replacing tput init with "$([char] 0x1b)[?1h" (simpler PS Core alternative: "`e[?1h") in the sample code enough is sufficient.
Examining what escape sequences tput init emits in practice is elusive, because trying to capture them seems to change what is being emitted:
PS> (tput init) -replace '\e', '\u001b'
\u001b[!p\u001b[?3;4l\u001b[4l\u001b>

Even executing (tput init) (wrapping in parentheses) makes the command no longer effective; not only that, it actively triggers the symptom, even if the arrow keys worked fine at the time.
I don't think the implementation of tput itself will tell us much, because it looks up the specific escape sequences to use in the terminfo "database" (a 2-level file hierarchy at /usr/share/terminfo/*/*) based on the predefined TERM environment variable, which indicate the terminal type being emulated. On macOS, that variable contains xterm-256, which results in file /usr/share/terminfo/78/xterm-256color getting consulted.
Based on man tput and man terminfo, tput init does the following:
init   If  the terminfo database is present and an entry for the user's
      terminal exists (see -Ttype, above), the following will occur:

      (1)    if present, the terminal's initialization strings will be
	     output as detailed in the terminfo(5) section on Tabs and
	     Initialization,

      (2)    any delays (e.g., newline) specified in the entry will be
	     set in the tty driver,

      (3)    tabs  expansion will be turned on or off according to the
	     specification in the entry, and

      (4)    if tabs are not  expanded,  standard  tabs  will  be  set
	     (every 8 spaces).

      If  an  entry does not contain the information needed for any of
      the four	above  activities,  that  activity  will  silently  be
      skipped.

where terminfo(5) (man terminfo) states (identifiers such as is1, ... are terminal capabilities, listed in the same page):
      output is1 is2

      set the margins using
	     mgc, smgl and smgr

      set tabs using
	     tbc and hts

      print the file
	     if

      and finally
	     output is3.

The only sequence escape which worked to me, after testing many of them, was as shown in my PR #953.
On enter \x1b[?1049l
On exit \x1b[?1049h

The portable equivalent of  VT100 escape sequence \x1b[?1h (which does work for macOS and Ubuntu terminals, however) appears to be tput rmkx; that is, the keypad_local aka rmkx TermInfo capability ("leave 'keyboard_transmit' mode") - the inverse is keypad_xmit aka smkx("enter 'keyboard_transmit' mode").
@BDisp, I get similar escape sequences via tput, though the caveat is that I don't fully trust the captured versions:
PS> (tput rmkx) -replace '\e', '\x1b'; (tput smkx) -replace '\e', '\x1b'
\x1b[?1l\x1b>
\x1b[?1h\x1b=

@mklement0 that great, thanks. Work better than the other because the prompt is maintained sequential instead pushing to the bottom of the terminal. With the Mac I don't have this hang on the terminal. It's only happens with the Linux.
What the difference in the end of the sequences?
>
=

@BDisp, for maximum robustness we shouldn't hard-code these sequences, as they may vary by terminal emulation. - though perhaps, pragmatically speaking, that is fine nonetheless (I don't know).
If we do have to make this terminal-agnostic: While we don't want to have to create an expensive tput child process, the question is whether ncurses allows us to query and submit the rmkx escape sequence in-process.
As for what > and = mean:
At the moment I'm not aware of a reverse Terminfo lookup, but the table of VT100 escape sequences at http://ascii-table.com/ansi-escape-sequences-vt-100.php - whose identifiers do NOT respond to the TermInfo capability names - suggest the following:

Esc=  ... Set alternate keypad mode | DECKPAM
Esc> ... Set numeric keypad mode | DECKPNM

That is, they seem to act on the keys of the numeric keypad.

@mklement0 I ended up to use like https://github.com/migueldeicaza/gui.cs/issues/418#issuecomment-707648746
\x1b[?1h
\x1b[?1l

as documented at http://ascii-table.com/ansi-escape-sequences-vt-100.php

@mklement0 I'm experiencing another strange behavior with both escapes sequences on screen resizing as it's not refreshing well letting the screen all messed up. Do you know why this happens?

@BDisp, I think that problem is unrelated to the escape sequences we've discussed: it also happens the very first time you run a PowerShell script that uses Terminal.Gui.
Unfortunately, I have no idea what the problem is.

@BDisp, I think that problem is not related to the escape sequences we've discussed per se:
Even without these sequences, I see the following behavior:
macOS:

compiled executable:

Terminal.app: OK

iTerm2.app: mostly OK while the app is running (there are aritifacts while resizing, but on releasing the mouse it redraws fine), but leaves remnants of the alternate screen after exiting

PowerShell script: broken in both Terminal.app and iTerm.app, though with different symptoms:

Terminal.app: broken (doesn't seem to be aware of the resizing)
iTerm.app: broken (doesn't seem to be aware of the resizing, artifacts while resizing)

Linux (Ubuntu 18.04):

compiled executable: OK

PowerShell script: broken (doesn't seem to be aware of the resizing)

So it seems that PowerShell is at least part of the problem - are you saying that with compiled executables you only started seeing the problem after emitting the escape sequence on shutdown and therefore only in subsequent runs?

Also, I've noticed that both terminal apps on macOS apparently don't draw the application on the alternate screen: you can actually scroll up while the application is running (using the terminal app's scroll bars) and see the previous terminal output.
Is this a known limitation?
Furthermore, the radio buttons and checkboxes in the example application aren't drawing, in both terminal apps.

iTerm2.app: mostly OK while the app is running (there are aritifacts while resizing, but on releasing the mouse it redraws fine), but leaves remnants of the alternate screen after exiting

I've noticed too. It's annoying.

So it seems that PowerShell is at least part of the problem - are you saying that with compiled executables you only started seeing the problem after emitting the escape sequence on shutdown and therefore only in subsequent runs?

I run with dotnet ./app.dll and I seeing the problem while the app is open and resizing the screen. I can exit and reopen again but the messed screen on resizing is worse than the terminal hang.

Also, I've noticed that both terminal apps on macOS apparently don't draw the application on the alternate screen: you can actually scroll up while the application is running (using the terminal app's scroll bars) and see the previous terminal output.
Is this a known limitation?

I noticed that too and is very annoying too on both Terminal and iTerm2.

Furthermore, the radio buttons and checkboxes in the example application aren't drawing, in both terminal apps.

Yes that true unfortunately. Mac does not handle very well with unicode. I tested with many configurations without success. I debugged into the code and the keys are sending correct but both the Terminal and iTerm2 don't process them. I think Mac is causing that.

I'm still a bit unclear: did emitting the escape sequence on shutdown make the resizing problem worse in your dotnet application on rerunning it in the same session?

Mac does not handle very well with unicode.

Ah, yes, it hadn't occurred to me that this was also the lack of Unicode support - I'll provide more feedback in #949.

The escape sequence works perfectly on shutdown but while running the app on the same session the screen does not redraws well. In WSL it's a messy screen and in linux the app does not resize as the screen size changes.

Perhaps if we take a step back and try to let ncurses handle restoring the previous terminal state - which is preferable anyway - the problem would go away:
On macOS, man curs_kernel covers ncurses functions related to saving and restoring the terminal state.
However, it suggests that pairing initscr() and endwin() performs that automatically, and I don't understand the relationship between def_prog_mode /  def_shell_mode and reset_prog_mode / reset_shell_mode on the one hand, and savetty / resettty on the other:
   The following routines give low-level access to various curses capabilities.
   Theses routines typically are used inside library routines.

   The def_prog_mode and def_shell_mode routines save the current terminal
   modes as the "program" (in curses) or "shell" (not in curses) state for
   use by the reset_prog_mode and reset_shell_mode routines.  This is done
   automatically  by initscr.  There is one such save area for each screen
   context allocated by newterm().

   The reset_prog_mode and reset_shell_mode routines restore the  terminal
   to  "program"  (in curses) or "shell" (out of curses) state.  These are
   done automatically by endwin and, after an endwin, by doupdate, so they
   normally are not called.

   The resetty and savetty routines save and restore the state of the ter-
   minal modes.  savetty saves the current state in a buffer  and  resetty
   restores the state to what it was at the last call to savetty.

I think that will be the way in the future to manage properly ncurses (save and restore previous state).
The strange is the GUI works with no problems before. I suspect about Net5.0 not working perfectly yet and also I'm using the preview 7 because I'm not using the preview version of Visual Studio.

To shed some more light on the original problem:

What breaks PowerShell is that the so-called application-cursor mode is not set (which tput rmkx would do) when an in-session Terminal.Gui application exits.

By contrast, running a Terminal.Gui-based .NET application, invariably in a child process:

When run either with dotnet <DLL> or as a self-contained executable (dotnet publish -p:PublishSingleFile=true ...), application-cursor mode apparently is properly restored to the pre-application-startup state on exit, presumably thanks to ncurses, because an application that just uses Console calls does not restore the the mode.

So the question is: does ncurses only do this restoring when the process exits? This would explain the in-session problem.

The restoring that ncurses provides is apparently overridden when running during development with dotnet run <project>.

In other words: the .NET Core runtime itself has a problem in that it unconditionally leaves application-cursor mode ON on exiting:

See https://github.com/dotnet/runtime/issues/27626

PowerShell exhibits the same problematic behavior:

See https://github.com/PowerShell/PowerShell/issues/12268

This dotnet / PowerShell misbehavior rarely surfaces as a problem, at least in single-platform use, however, because bash and zsh handle cursor keys correctly whether or not application-cursor mode is turned on or off.
By contrast, ksh only works when application-cursor mode is OFF, so it surfaces there.

Unfortunately, I misspoke - please see the updated previous comment; in short: irrespective of whether the Terminal.Gui application is run in-process as PowerShell code or via an external executable, the application-cursor mode is unconditionally turned off. However, that is only problematic for PowerShell in the in-process case, because when it runs external applications it always turns that mode back on for itself.

Started thinking about this again.
'tis a bummer this is not fixed: https://github.com/PowerShell/PowerShell/issues/6724

Thanks for a really nice example! There are others out there, but I like how cleanly this one is implemented.

I wrote a slight modification of your example which installs the ConsoleGuiTools module to help make life easier.
using namespace Terminal.Gui

if (!$(Get-Module Microsoft.PowerShell.ConsoleGuiTools)) {
  Install-Module Microsoft.PowerShell.ConsoleGuiTools
}

Import-Module Microsoft.PowerShell.ConsoleGuiTools
$module = (Get-Module Microsoft.PowerShell.ConsoleGuiTools -List).ModuleBase
Add-Type -Path (Join-path $module Terminal.Gui.dll)

[Application]::Init()

$window = [Window]@{ Title = 'Hello World' }

$dialog = [Dialog]@{
  X = [Pos]::Center()
  Y = [Pos]::Center()
  Title = 'Dialog'
}

$text = [TextField]@{
  X = [Pos]::Center()
  Y = [Pos]::Center()
  Width = 20
  Text = 'Howdy!'
}
$dialog.Add($text)

$quit = [Button]@{
  X = [Pos]::Center()
  Y = [Pos]::Center() + 1
  Text = 'Quit'
}
$quit.add_Clicked({ [Application]::RequestStop() })
$dialog.Add($quit)

$window.Add($dialog)

[Application]::Run($window)
[Application]::Shutdown()

Write-Output "Got ""$($text.Text.ToString())"" from user input"

Thanks, @ca0abinary - that's the definitely the simplest option in v7.2+.
I took the liberty of integrating your Microsoft.PowerShell.ConsoleGuiTools workaround into this StackOverflow answer (which is where the code in the initial post came from), and I've streamlined it a bit (no need to actually import the module) - though your sample code here has more features.
I've also updated the answer, which was written pre-v1, to reflect the status quo.


text:
Fixes #2008 - Shift+key denied by text field as "control character" on remote systems

Fixes #2008 - When using some remoting technologies some keyboard input is supplied as ConsoleKey.Packet.
Pull Request checklist:

[x] I've named my PR in the form of "Fixes #issue. Terse description."
[ ] My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
[x] My code follows the Terminal.Gui library design guidelines
[x] I ran dotnet test before commit
[x] I have made corresponding changes to the API documentation (using /// style comments)
[x] My changes generate no new warnings
[ x I have checked my code and corrected any poor grammar or misspellings
[ ] I conducted basic QA to assure all features are working

@heinrich-ulbricht please are you able to test my PR to see if this has any effect on your Shift+char issue with TextView / TextField etc.
I have gone to the point where the keystrokes first appear in WindowsDriver and made a conservative edit that tries to remap the Packet virtual key so the virtual input keystrokes should now look identical to regular keystrokes from then on.
Since I don't have a machine that sends these PACKET entries I can't test it myself.  But I have written a couple of unit tests and if successful I can write some more to make sure nothing goes wrong when trying to remap wierd characters e.g. 'newline' or 'escape' etc.
I've left it as draft for now since I want to see that

It definitely fixes your problem
There are no corner cases where the remapping will map to an invalid/different Enum.

For the remapping I followed this thread on StackOverflow.  But adjusted it to correctly handle lower case too.
Test is written to use InlineData so its easy to expand for the strange symbols etc

Thank you, will do this weekend!

@tznind Looks promising. It works for A, B etc. But not for : and other non-alphabet characters. For those the Enum.TryParse fails.

@tznind Looks promising. It works for A, B etc. But not for : and other non-alphabet characters. For those the Enum.TryParse fails.

May be for them is not necessary to be mapped and come with the correct key code? So only try parse from A to Z?

Had a look at NetDriver and what the ConsoleKeyInfo there looks like after pressing Shift+'.' (== ':'). The KeyChar there is set, no modifier:
-		consoleKeyInfo	{System.ConsoleKeyInfo}	System.ConsoleKeyInfo
		Key	0	System.ConsoleKey
		KeyChar	58 ':'	char
		Modifiers	0	System.ConsoleModifiers

The NetDriver works in a different way. It read all the keys come from a virtual terminal and also read characters sequences. The Shift key is irrelevant from A to Z, because we want to receive the letters from A to Z or from a to z and we don't need to check if it has the shift modifier or not. Also for others keys that are return by pressing the shift+char the keyboard driver also send the right key. We only need to check for the shift key if it's used with more keys, like Ctrl and Alt, or it's used with another char that isn't modified with the shift key, like Shift+CursorLeft and so on.
But this keys come encoded with the PACKET key and need to be decode, but perhaps for the keys from A to Z and not for others that depend of the keyboard language specific.

Some tests:
Ctrl
-		original	{System.ConsoleKeyInfo}	System.ConsoleKeyInfo
		Key	17	System.ConsoleKey
		KeyChar	0 '\0'	char
		Modifiers	Control	System.ConsoleModifiers

Ctrl+Shift
-		original	{System.ConsoleKeyInfo}	System.ConsoleKeyInfo
		Key	16	System.ConsoleKey
		KeyChar	0 '\0'	char
		Modifiers	Shift | Control	System.ConsoleModifiers

Ctrl+Shift+A
-		original	{System.ConsoleKeyInfo}	System.ConsoleKeyInfo
		Key	A	System.ConsoleKey
		KeyChar	1 '\u0001'	char
		Modifiers	Shift | Control	System.ConsoleModifiers

@tznind Looks promising. It works for A, B etc. But not for : and other non-alphabet characters. For those the Enum.TryParse fails.

That's great @heinrich-ulbricht thanks for testing.  I suspected that TryParse was a bit hacky.  I'll just write a switch statement for the whole ConsoleKey Enum (at least where theres a compatible letter key and skip A-Z since they work with TryParse).  There are only ~100 entries so shouldn't be to onerous.
I suspect for the foreign language keys there might still be issues.  But since you can now type the US letters, this approach seems sensible to start with.
Your comment is very helpful where it shows what is and isn't working, I can add those to the unit test I created.

@tznind I have URL input fields so as long as one can type URLs it's fine for me :zany_face:

@heinrich-ulbricht  please can you see how it is behaving now.
I have mapped every key on my US layout keyboard and added the novel characters that appear in UK keyboard (since I also have one of those to test with).
I'm not sure what to do with characters that appear in different keys on different keyboard layouts (e.g. " and @ are on different keys depending on layout).
I didn't seem to see all the Oem keys so there might be some additional mappings that could be added.  And there are clearly some keys that produce the same symbol e.g. . which appears on both the > key and the numerical keypad.  I think we get a flag for that though so maybe that could be looked into (or it may not really matter which is used).
It seems that some of the code I am writting is similar to public Key MapKey (WindowsConsole.ConsoleKeyInfoEx keyInfoEx) so I will probably also dig deeper to make sure I'm not rewritting duplicate code.

@tznind It works better now, I can input URLs ^^ Pressed a few more keys, single and double quotes are missing:
-		original	{System.ConsoleKeyInfo}	System.ConsoleKeyInfo
		Key	Packet	System.ConsoleKey
		KeyChar	34 '"'	char
		Modifiers	Shift	System.ConsoleModifiers

-		original	{System.ConsoleKeyInfo}	System.ConsoleKeyInfo
		Key	Packet	System.ConsoleKey
		KeyChar	39 '\''	char
		Modifiers	Shift	System.ConsoleModifiers

Somehow this approach doesn't feel right, though. I read that the packet key type was introduced to not have to deal with different keyboard layouts when sending remote key presses around. To "just pass the actual key through" without going through multiple transformations. It would be nice if we could do that. But this again somehow feels like it might require a bigger architectural change.
As an immediate workaround it definitely solves the (my) problem.

Somehow this approach doesn't feel right, though. I read that the packet key type was introduced to not have to deal with different keyboard layouts when sending remote key presses around.
heinrich-ulbricht

I agree this definetly feels a bit sketchy.  I'm very much open to talking more about this though!
Terminal.Gui keyboard events
All the View in Terminal.Gui deal with KeyEvent which is a wrapper for Key and KeyModifiers
The Key Enum
Key is an Enum declared and defined in Terminal.Gui

The Key enumeration contains special encoding for some keys, but can also encode all the unicode values that can be passed.

This means that any char can be stored in references to Key even if they don't have an explicit declared entry.  There is a ticket already open in discussion to add many of the missing values.
Because Key is using the Unicode/ASCII numbers for entries it doesn't care about keyboard layout
https://github.com/gui-cs/Terminal.Gui/blob/558b2b793f700dec5672536b934300b86148bfe7/Terminal.Gui/Core/Event.cs#L139-L147
The KeyEvent class is explicitly set up with the expectation that unmapped Key values are used e.g.:
https://github.com/gui-cs/Terminal.Gui/blob/558b2b793f700dec5672536b934300b86148bfe7/Terminal.Gui/Core/Event.cs#L487-L492
ConsoleKey
ConsoleKeyInfo only appears in the implementations of ConsoleDriver (i.e. NetDriver and WindowsDriver) and not in the rest of the Terminal.Gui codebase which is good!
Summary
So the goal here is to correctly convert ConsoleKeyInfo.Packet + char (unicode) into the correct Key enum entry.  This involves 2 things

If the char is \b or \t or \u001b (escape)  or \r then we should turn it into the correct Key entry (unless those already match on uint value).
If the char is any printable character we should just cast it to Key and not worry that it doesn't have an explicit entry

I think my going via ConsoleKeyInfo was a mistake since it seems tied to keyboard layouts and probably over complicating things.  Especially since 99% of keystrokes should just be castable to Key as uint.

@tznind Well. This just works :D
I can type anything in combination with Shift now. No exceptions.
Home, End, Cursors, Escape, Tab, Backspace also work and don't use the Packet type.
Here are some key events taken from ToConsoleKeyInfoEx, just say if you need more:
Home
-		keyEvent	{Terminal.Gui.WindowsConsole.KeyEventRecord}	Terminal.Gui.WindowsConsole.KeyEventRecord
		UnicodeChar	0 '\0'	char
		bKeyDown	true	bool
		dwControlKeyState	EnhancedKey	Terminal.Gui.WindowsConsole.ControlKeyState
		wRepeatCount	1	ushort
		wVirtualKeyCode	36	ushort
		wVirtualScanCode	71	ushort

End
-		keyEvent	{Terminal.Gui.WindowsConsole.KeyEventRecord}	Terminal.Gui.WindowsConsole.KeyEventRecord
		UnicodeChar	0 '\0'	char
		bKeyDown	true	bool
		dwControlKeyState	EnhancedKey	Terminal.Gui.WindowsConsole.ControlKeyState
		wRepeatCount	1	ushort
		wVirtualKeyCode	35	ushort
		wVirtualScanCode	79	ushort

Right arrow
-		keyEvent	{Terminal.Gui.WindowsConsole.KeyEventRecord}	Terminal.Gui.WindowsConsole.KeyEventRecord
		UnicodeChar	0 '\0'	char
		bKeyDown	true	bool
		dwControlKeyState	EnhancedKey	Terminal.Gui.WindowsConsole.ControlKeyState
		wRepeatCount	1	ushort
		wVirtualKeyCode	39	ushort
		wVirtualScanCode	77	ushort

ESC
-		keyEvent	{Terminal.Gui.WindowsConsole.KeyEventRecord}	Terminal.Gui.WindowsConsole.KeyEventRecord
		UnicodeChar	27 '\u001b'	char
		bKeyDown	true	bool
		dwControlKeyState	0	Terminal.Gui.WindowsConsole.ControlKeyState
		wRepeatCount	1	ushort
		wVirtualKeyCode	27	ushort
		wVirtualScanCode	1	ushort

Shift
-		keyEvent	{Terminal.Gui.WindowsConsole.KeyEventRecord}	Terminal.Gui.WindowsConsole.KeyEventRecord
		UnicodeChar	0 '\0'	char
		bKeyDown	true	bool
		dwControlKeyState	ShiftPressed	Terminal.Gui.WindowsConsole.ControlKeyState
		wRepeatCount	1	ushort
		wVirtualKeyCode	16	ushort
		wVirtualScanCode	42	ushort

Shift + a pressed
-		keyEvent	{Terminal.Gui.WindowsConsole.KeyEventRecord}	Terminal.Gui.WindowsConsole.KeyEventRecord
		UnicodeChar	65 'A'	char
		bKeyDown	true	bool
		dwControlKeyState	ShiftPressed	Terminal.Gui.WindowsConsole.ControlKeyState
		wRepeatCount	1	ushort
		wVirtualKeyCode	231	ushort
		wVirtualScanCode	0	ushort

Shift + Tab pressed
-		keyEvent	{Terminal.Gui.WindowsConsole.KeyEventRecord}	Terminal.Gui.WindowsConsole.KeyEventRecord
		UnicodeChar	9 '\t'	char
		bKeyDown	true	bool
		dwControlKeyState	ShiftPressed	Terminal.Gui.WindowsConsole.ControlKeyState
		wRepeatCount	1	ushort
		wVirtualKeyCode	9	ushort
		wVirtualScanCode	15	ushort

Return
-		keyEvent	{Terminal.Gui.WindowsConsole.KeyEventRecord}	Terminal.Gui.WindowsConsole.KeyEventRecord
		UnicodeChar	13 '\r'	char
		bKeyDown	true	bool
		dwControlKeyState	0	Terminal.Gui.WindowsConsole.ControlKeyState
		wRepeatCount	1	ushort
		wVirtualKeyCode	13	ushort
		wVirtualScanCode	28	ushort

Ctrl + Home pressed
-		keyEvent	{Terminal.Gui.WindowsConsole.KeyEventRecord}	Terminal.Gui.WindowsConsole.KeyEventRecord
		UnicodeChar	0 '\0'	char
		bKeyDown	true	bool
		dwControlKeyState	LeftControlPressed | EnhancedKey	Terminal.Gui.WindowsConsole.ControlKeyState
		wRepeatCount	1	ushort
		wVirtualKeyCode	36	ushort
		wVirtualScanCode	71	ushort

Ctrl + a pressed
-		keyEvent	{Terminal.Gui.WindowsConsole.KeyEventRecord}	Terminal.Gui.WindowsConsole.KeyEventRecord
		UnicodeChar	1 '\u0001'	char
		bKeyDown	true	bool
		dwControlKeyState	LeftControlPressed	Terminal.Gui.WindowsConsole.ControlKeyState
		wRepeatCount	1	ushort
		wVirtualKeyCode	65	ushort
		wVirtualScanCode	30	ushort

By the way - is Ctrl+A (to select all text) supposed to work in input fields? Because it doesn't. Just something I noticed a while back, not sure if this is connected to our current issue. Just want to mention it just in case.
Thanks for diving into this. This solution feels a lot better.

By the way - is Ctrl+A (to select all text) supposed to work in input fields? Because it doesn't. Just something I noticed a while back, not sure if this is connected to our current issue. Just want to mention it just in case. Shift+Home and Shift+End do work.
(Note: Is this a unicode character there for Ctrl+a that needs special handling?)

On TextField and TextView to select all text is by pressing Ctrl+T.

@BDisp You are fast. Just this moment I pressed the right mouse key and the context menu told me this :) Strange combo, my Windows background strongly expects Ctrl+A ^^

Ctrl+A is for Command.LeftHome on TextField and for Command.StartOfLine on TextView.

So it looks like the packet key is not used in any of these cases (below) for you.  So the following code I have in this PR will probably never be hit so could be removed in your case.  But I don't know if other software or environments might use PACKET for any of these.  @tig let me know if you want me to remove this code or leave it in (or anyone else who has a view!).
case '\t':
	result = original.Modifiers == ConsoleModifiers.Shift ? Key.BackTab : Key.Tab;
	return true;
case '\u001b':
	result = Key.Esc;
	return true;
case '\b':
	result = Key.Backspace;
	return true;
case '\n':
case '\r':
	result = Key.Enter;
	return true;

@heinrich-ulbricht  one last thing I thought I'd mention incase you hadn't seen -  You can change the keybinding for SelectAll with:
TextField tv = new TextField ();
tv.AddKeyBinding (Key.A | Key.CtrlMask, Command.SelectAll);

@tig let me know if you want me to remove this code or leave it in (or anyone else who has a view!).

Nuke it. ;-)

Ok I have nuked the switch.  @heinrich-ulbricht if you have the time please to do a final check that I haven't missed something (i.e. that it still works for all teh typing).

Somehow this approach doesn't feel right, though. I read that the packet key type was introduced to not have to deal with different keyboard layouts when sending remote key presses around. To "just pass the actual key through" without going through multiple transformations. It would be nice if we could do that. But this again somehow feels like it might require a bigger architectural change. Edit: Thought about that. If the final console output IS dependent on those enums then there is no choice.
As an immediate workaround it definitely solves the (my) problem.

This justification intrigued me and reflected if they created this Packet Key was precisely so there was no conflict with any keyboard layout. As this situation only happened to WindowsDriver so I thought the problem was just like this driver handles Shift Key.
So I  thinking commenting this two lines on the WindowsDriver fix that problem because the Shift key doesn't need to the Key at this moment but only int the modifiers.
https://github.com/gui-cs/Terminal.Gui/blob/deef59e877b7889c59b317eb0dccc03465e0f8ad/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs#L1377-L1378
I also commented on these two on the FakeDriver and all the current unit tests passed.
https://github.com/gui-cs/Terminal.Gui/blob/deef59e877b7889c59b317eb0dccc03465e0f8ad/Terminal.Gui/ConsoleDrivers/FakeDriver/FakeDriver.cs#L363-L364
@heinrich-ulbricht since only you are using that remote tool can you do this changes to the develop branch and test if the Shift key is processed well in all situations, please? Thanks.

I change the unit to this and it passed.

public void TestVKPacket (char unicodeCharacter, Key expectedRemapping)
{
	var before = new ConsoleKeyInfo (unicodeCharacter, ConsoleKey.Packet, false, false, false);
	var top = Application.Top;

	top.KeyPress += (e) => {
		var after = e.KeyEvent.Key;
		Assert.Equal (before.KeyChar, (char)after);
		Assert.Equal (expectedRemapping, after);
	};

	Application.Begin (top);

	Application.Driver.SendKeys (unicodeCharacter, ConsoleKey.Packet, false, false, false);
}

I'm pretty sure the culprit of the issue was as demonstrated in the previous comment.

So you mean changong the Shift handling could be alternative solution?
And for the record my test setting:

Fedora + Remmina for RDP
any Windows VM on Azure to RDP to
UICatalog from the current repo running on the Windows machine

That's it, not sooo esoteric. But yes, I seem to be the only one doing this with Terminal.Gui :D
I'll check.

So you mean changing the Shift handling could be alternative solution?

Yes. In Windows Froms normally we check for a KeyChar with the keys modifiers, but Terminal.Gui is very tied with the shifted keys, like Key.A | Key.CtrlMask, instead of KeyChar == 'A' && Modifiers.Control. I tried to change that behavior before but I'm started having many conflicts and errors and I gave up.

And for the record my test setting:
* Fedora + Remmina for RDP

* any Windows VM on Azure to RDP to

* UICatalog from the current repo running on the Windows machine

That's it, not sooo esoteric. But yes, I seem to be the only one doing this with Terminal.Gui :D

Yes i think you are the only one doing that :-) I don't have Azure and have no idea how to setup something like that.

I'll check.

Thanks.

Instead of commenting the lines related above is better do the follow:
Changing this:
https://github.com/gui-cs/Terminal.Gui/blob/deef59e877b7889c59b317eb0dccc03465e0f8ad/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs#L1367-L1369
To this:
	if (keyInfo.KeyChar != 0) {
		if (keyInfo.Key == ConsoleKey.Packet) {
			return (Key)((uint)keyInfo.KeyChar);
		} else {
			return MapKeyModifiers (keyInfo, (Key)((uint)keyInfo.KeyChar));
		}
	}

and changing this:
https://github.com/gui-cs/Terminal.Gui/blob/deef59e877b7889c59b317eb0dccc03465e0f8ad/Terminal.Gui/ConsoleDrivers/FakeDriver/FakeDriver.cs#L351-L353
to this:
	if (keyInfo.KeyChar != 0) {
		if (keyInfo.Key == ConsoleKey.Packet) {
			return (Key)((uint)keyInfo.KeyChar);
		} else {
			return MapKeyModifiers (keyInfo, (Key)((uint)keyInfo.KeyChar));
		}
	}

Another better solution and as this issue only affect the Packet key used with the Shift key it's more accurate only not shifted the Shift key with the ConsoleKeyInfo.KeyChar if the ConsoleKeyInfo.Key is the ConsoleKey.Packet.
So, in this lines:
https://github.com/gui-cs/Terminal.Gui/blob/deef59e877b7889c59b317eb0dccc03465e0f8ad/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs#L1377-L1378
Change to this:
	if (keyInfo.Key != ConsoleKey.Packet && (keyInfo.Modifiers & ConsoleModifiers.Shift) != 0)
		keyMod = Key.ShiftMask;

In this lines:
https://github.com/gui-cs/Terminal.Gui/blob/deef59e877b7889c59b317eb0dccc03465e0f8ad/Terminal.Gui/ConsoleDrivers/FakeDriver/FakeDriver.cs#L363-L364
Change to this:
	if (keyInfo.Key != ConsoleKey.Packet && (keyInfo.Modifiers & ConsoleModifiers.Shift) != 0)
		keyMod = Key.ShiftMask;

Sounds like you have a simpler solution than this PR @BDisp.  It looks good but I'm sort of loosing track of all the edits your suggesting.
Do you want to create a new PR with your changes? I'm happy to go with adjusting the existing logic instead of my additional logic if that is more correct.

But we have to be sure if my solution is more accurate. Please, change your unit test to this and confirm if it must pass.
[Theory]
[InlineData ('A', false, false, false, Key.A)]
[InlineData ('A', true, false, false, Key.A)]
[InlineData ('A', true, true, false, Key.A | Key.AltMask)]
[InlineData ('A', true, true, true, Key.A | Key.AltMask | Key.CtrlMask)]
[InlineData ('z', false, false, false, Key.z)]
[InlineData ('z', true, false, false, Key.z)]
[InlineData ('z', true, true, false, Key.z | Key.AltMask)]
[InlineData ('z', true, true, true, Key.z | Key.AltMask | Key.CtrlMask)]
[InlineData ('=', false, false, false, (Key)'=')]
[InlineData ('=', true, false, false, (Key)'=')]
[InlineData ('=', true, true, false, (Key)'=' | Key.AltMask)]
[InlineData ('=', true, true, true, (Key)'=' | Key.AltMask | Key.CtrlMask)]
[InlineData ('英', false, false, false, (Key)'英')]
[InlineData ('英', true, false, false, (Key)'英')]
[InlineData ('英', true, true, false, (Key)'英' | Key.AltMask)]
[InlineData ('英', true, true, true, (Key)'英' | Key.AltMask | Key.CtrlMask)]
[InlineData ('+', false, false, false, (Key)'+')]
[InlineData ('+', true, false, false, (Key)'+')]
[InlineData ('+', true, true, false, (Key)'+' | Key.AltMask)]
[InlineData ('+', true, true, true, (Key)'+' | Key.AltMask | Key.CtrlMask)]
[InlineData ('\0', false, false, false, (Key)'\0')]
[InlineData ('\0', true, false, false, (Key)'\0')]
[InlineData ('\0', true, true, false, (Key)'\0' | Key.AltMask)]
[InlineData ('\0', true, true, true, (Key)'\0' | Key.AltMask | Key.CtrlMask)]
public void TestVKPacket (char unicodeCharacter, bool shift, bool alt, bool control, Key expectedRemapping)
{
	var before = new ConsoleKeyInfo (unicodeCharacter, ConsoleKey.Packet, shift, alt, control);
	Assert.True (WindowsDriver.TryRemapPacketKey (before, out var after));

	// The thing we are really interested in, did we correctly convert
	// the input ConsoleKey.Packet to the correct physical key
	Assert.Equal (expectedRemapping, after);
}

The WindowsDriver is the only driver that really processes the key down and the key up events, by check the bKeyDown field. The others drivers processes that by simulation. Only on WindowsDriver is possible to get the modifiers keys directly by the library, the others drivers are dependent of the result from the Terminal.Gui.Key. So the modifiers keys in the WindowsDriver are very reliable.

I added static Key ApplyModifiers (Key c, ConsoleModifiers modifiers) which applies the Alt and Shift masks to the Key but it looked a lot like the existing method Key MapKeyModifiers (ConsoleKeyInfo keyInfo, Key key).  However if I use MapKeyModifiers instead of the method I added the new tests fail.

I've updated my code and added the test cases you provided. But I'm a little confused:
[InlineData ('z', true, true, true, Key.z | Key.AltMask | Key.CtrlMask)]

Why is this expecting CtrlMask and AltMask but not ShiftMask? I get that shift is already modelled with Key.A vs Key.a but then it seems confusing why there is a Key.ShiftMask at all?

Thanks, for point me this. I was forget that. The below code doesn't process the MapKeyModifiers method at all. But if you use the lower cases the MapKeyModifiers is processed. You can ask, but a Shift+'lower case' always return a upper case. Yes, it's right. that why there is a ShortcutHelper.GetModifiersKey method which allows getting a shortcut like AddKeyBinding ((Key)((int)'B' + Key.ShiftMask | Key.AltMask), Command.WordLeftExtend); to execute the Command.WordLeftExtend on the TextField.. So, in the lower cases the Shift key shouldn't be added on the Terminal.Gui.Key and be managed like a upper case.
https://github.com/gui-cs/Terminal.Gui/blob/deef59e877b7889c59b317eb0dccc03465e0f8ad/Terminal.Gui/ConsoleDrivers/FakeDriver/FakeDriver.cs#L313-L329
So, my code, which is using the develop branch and not this PR, to make the things more cleared, will be the same for the WindowsDriver and the FakeDriver. Although they are duplicate is better maintain each one separated.
private Key MapKeyModifiers (ConsoleKeyInfo keyInfo, Key key)
{
	Key keyMod = new Key ();
	if (CanShiftBeAdded (keyInfo))
		keyMod = Key.ShiftMask;
	if ((keyInfo.Modifiers & ConsoleModifiers.Control) != 0)
		keyMod |= Key.CtrlMask;
	if ((keyInfo.Modifiers & ConsoleModifiers.Alt) != 0)
		keyMod |= Key.AltMask;

	return keyMod != Key.Null ? keyMod | key : key;
}

private bool CanShiftBeAdded (ConsoleKeyInfo keyInfo)
{
	if ((keyInfo.Modifiers & ConsoleModifiers.Shift) == 0) {
		return false;
	}
	if (keyInfo.Key == ConsoleKey.Packet) {
		var ckiChar = keyInfo.KeyChar;
		if (char.IsLetter (ckiChar)) {
			return false;
		}
	}
	return true;
}

In the ConsoleDriverTests:
[Theory, AutoInitShutdown]
[InlineData ('A', false, false, false, Key.A)]
[InlineData ('A', true, false, false, Key.A)]
[InlineData ('A', true, true, false, Key.A | Key.AltMask)]
[InlineData ('A', true, true, true, Key.A | Key.AltMask | Key.CtrlMask)]
[InlineData ('z', false, false, false, Key.z)]
[InlineData ('z', true, false, false, Key.z)]
[InlineData ('z', true, true, false, Key.z | Key.AltMask)]
[InlineData ('z', true, true, true, Key.z | Key.AltMask | Key.CtrlMask)]
[InlineData ('=', false, false, false, (Key)'=')]
[InlineData ('=', true, false, false, (Key)'=' | Key.ShiftMask)]
[InlineData ('=', true, true, false, (Key)'=' | Key.ShiftMask | Key.AltMask)]
[InlineData ('=', true, true, true, (Key)'=' | Key.ShiftMask | Key.AltMask | Key.CtrlMask)]
[InlineData ('英', false, false, false, (Key)'英')]
[InlineData ('英', true, false, false, (Key)'英')]
[InlineData ('英', true, true, false, (Key)'英' | Key.AltMask)]
[InlineData ('英', true, true, true, (Key)'英' | Key.AltMask | Key.CtrlMask)]
[InlineData ('+', false, false, false, (Key)'+')]
[InlineData ('+', true, false, false, (Key)'+' | Key.ShiftMask)]
[InlineData ('+', true, true, false, (Key)'+' | Key.ShiftMask | Key.AltMask)]
[InlineData ('+', true, true, true, (Key)'+' | Key.ShiftMask | Key.AltMask | Key.CtrlMask)]
[InlineData ('0', false, false, false, Key.D0)]
[InlineData ('0', true, false, false, Key.D0 | Key.ShiftMask)]
[InlineData ('0', true, true, false, Key.D0 | Key.ShiftMask | Key.AltMask)]
[InlineData ('0', true, true, true, Key.D0 | Key.ShiftMask | Key.AltMask | Key.CtrlMask)]
[InlineData ('\0', false, false, false, (Key)'\0')]
[InlineData ('\0', true, false, false, (Key)'\0' | Key.ShiftMask)]
[InlineData ('\0', true, true, false, (Key)'\0' | Key.ShiftMask | Key.AltMask)]
[InlineData ('\0', true, true, true, (Key)'\0' | Key.ShiftMask | Key.AltMask | Key.CtrlMask)]
public void TestVKPacket (char unicodeCharacter, bool shift, bool alt, bool control, Key expectedRemapping)
{
	var before = new ConsoleKeyInfo (unicodeCharacter, ConsoleKey.Packet, shift, alt, control);
	var top = Application.Top;

	top.KeyPress += (e) => {
		var after = e.KeyEvent.Key;
		Assert.Equal (before.KeyChar, (char)after);
		Assert.Equal (expectedRemapping, after);
	};

	Application.Begin (top);

	Application.Driver.SendKeys (unicodeCharacter, ConsoleKey.Packet, shift, alt, control);
}

Sounds like you have a simpler solution than this PR @BDisp. It looks good but I'm sort of loosing track of all the edits your suggesting.
Do you want to create a new PR with your changes? I'm happy to go with adjusting the existing logic instead of my additional logic if that is more correct.

@tznind do you still want I submit a PR to your branch? I only do it if you agree that mine follow the current logic and is more accurate. If you have doubt about my solution I prefer you go forward. Thanks.

[...]
@tznind do you still want I submit a PR to your branch? I only do it if you agree that mine follow the current logic and is more accurate. If you have doubt about my solution I prefer you go forward. Thanks.

Yes please! I think you know this area of the library better than me and I'm happy to follow your lead on this :)

Yes please! I think you know this area of the library better than me and I'm happy to follow your lead on this :) Or if it is easier I can close this PR and you can open a new one.

Thanks. I'll try to change this PR and submit to your branch.

Done. It really good if @heinrich-ulbricht test first with others chars than letters where using the shift also change the output char.

I'll check the next day or two. I hope to not confuse any versions when testing ^^

I'll check the next day or two. I hope to not confuse any versions when testing ^^

You only need to checkout this PR :-) Thanks.

@BDisp I checked out the pull request. The uppercase characters (Shift+a == A) still work, but the special characters (e.g. Shift+1 == !) do not work anymore.

@BDisp I checked out the pull request. The uppercase characters (Shift+a == A) still work, but the special characters (e.g. Shift+1 == !) do not work anymore.

Thanks for reporting. I'll check.

@heinrich-ulbricht I submited the PR https://github.com/tznind/gui.cs/pull/126 where I excluded the shift key when IsLetterOrDigit, IsSymbol and IsPunctuation. I don't know if the unit test will fail with others keyboard layouts. Maybe it's necessary to exclude some more but I haven't a way to test it. If it's not very difficult and is free can you explain as clear as possible how setup one, please.

@BDisp Sorry, what should I describe? My setup?

Yes, if possible,of course.

Submitted the PR https://github.com/tznind/gui.cs/pull/128.
Shortcuts keys are to be used with a physical keyboard and one like Ctrl+Shift+'a' will never be achieve because the driver will always return the uppercase 'A', so only this will work Ctrl+Shift+A. The same for the symbols e.g. Ctrl+Shift+'!' will also never be achieved because the driver will return always Ctrl+Shift+1.
I'm trying to create a Packet simulator scenario on the UICatalog which will use the SendInput function.

Ah here my setup:

Source maching: Fedora Linux, current version
Remote machine: Windows 11, Azure VM
RDP software: Remmina
German Keyboard
Both the local and remote machine use the German keyboard layout

That's it.

Once the merge conflicts are resolved, is this PR ready to be merged?

I'm doing big changes to this and I ask to @tznind if he can be wait untill I finish it. The decoded key must be provide they're mapped to key and not after.

@tznind I submitted the PR https://github.com/tznind/gui.cs/pull/128 to your branch. I already merged the develop branch because of the resulting conflicts. All drivers, except the CursesDriver are prepared to receive Packet keys. The CursesDriver only simulate through the SendKeys method. The reason is the keys are only caught in the ProcessInput method with the Curses.get_wch method, while the others drivers the keys are passed on the parameter. I really don't know if ncurses can handle the virtial packet keys.
I also created a VkeyPacketSimulator scenario which supports all the drivers. Typing in the firstTextView will write in the second TextView.

This is awesome work thanks!  I have merged the PR and will get to testing it / looking in depth asap.
Do you consider this now as good to go? shall I mark it no longer Draft?

This is awesome work thanks! I have merged the PR and will get to testing it / looking in depth asap.

Thanks.

Do you consider this now as good to go? shall I mark it no longer Draft?

I forgot to delete the CanShiftBeAdded from the FakeDriver. I'll submit a new PR to fix it. After you merge you can mark as ready, please.

Done. Thanks for your waiting.

authors: BDisp heinrich-ulbricht tig tznind


text:
🛑 Sefaz - Rio Grande do Sul is down

In 7a58a43, Sefaz - Rio Grande do Sul (https://onboardapi.guichepass.com.br/sefaz?code=2) was down:

HTTP code: 500
Response time: 225 ms

Resolved: Sefaz - Rio Grande do Sul is back up in 79e15b9 after 16 minutes.

repo: guichevirtual/statuspage


text:
chore: update TypeScript

Updates TypeScript to v4.3.4 and enables the --noImplicitOverride flag in tsconfig.json.
Blocked by https://github.com/guidojw/arora-api/pull/272

not blocked anymore

repo: guidojw/arora-api


text:
Too much magic, not enough explanation

Hi folks,
First off, I really like the project, but how it works is completely mysterious.
While I like the approach guild takes to the ML logging problem, you need clearer documentation/ more extensive examples if you are to achieve wisespread adoption.
How it finds hyper-parameters seems discoverable, but how it knows to capture things like loss, and val_acc in the image classifier example is entirely unclear.
Is it making use of some tf.keras magic? Who knows?
Is it making assumptions about how functions/classes are structured and what they return?
If so, what are these assumptions?
My use case is of similar complexity to the image classifier, albeit implemented in plain Tensorflow rather than tf.keras. The model class definition contains a .train() method, which is called in a train_model function within the script I use to pre-process data and then train the model with.
These methods return, at the end of the training run, the best validation accuracy which guild fails to capture, and despite consulting the documentation at length I am at a loss (no pun intended) on how to fix this.
If you please could answer/provide:

What form the scripts should be in, in order for guild to capture values of interest
More transparent explanation of how guild infers what to capture.
More complex/varied examples of training set-ups and how guild can be configured to work across different set-ups.

Many thanks

I agree on the black magic and need for more examples. @gar1t  has been working on new docs for a while now and I expect this is one of the things that will be improved on.

All points taken to heart! As @samedii mentioned, the docs are undergoing a revamp to address these gaps. In response to this issue, I'll port some of these more important topics over to the active docs.
The custom scalar example is a decent reference on how to configure Guild for logging scalars from your script.
Guild's interface to scalar output (or metrics) is via TensorFlow event logs. Guild is independent of TensorFlow and so you don't need to use TensorFlow in any way.
You have two options for logging scalars:

Write values to standard output using some well-defined pattern. Guild defaults to the pattern ^NAME: VAL. You can define whatever you want for your operation. See the example link above for examples.

Log the values directly using either a TensorFlow summary writer or tensorboardX.

The rationale for this approach is that Guild doesn't want to introduce Guild-specific APIs that tie your project code to Guild as a build tool. The cost is that the configuration for these topics is moved outside your project code - or that you have to follow a convention for logging (in this case writing to TF event logs). The upside is that you can layer Guild on top of projects without modifying them. This all gets frustrating when there are gaps in the docs and for that I apologize!
I'll update here when useful docs land.
In the meantime - and I realize this is not a replacement for the need for documentation - if you have specific questions about project configuration, please feel free to post a question to Slack. There are a number of examples that cover a variety of use cases and we can help point you in the right direction.

We might keep this issue open forever as I feel it could always apply to Guild! Still waiting on 0.7 to land, but a lot of progress has been made on this front. It's taken WAY too long to get this out but the release is definitely approaching! It's an old fashioned expression, but Real Soon Now.

Finally coming back to this. Thanks @higginrp again for the constructive and fair criticism!
The new docs at my.guild.ai cover these topics in a great deal more detail. There are a number of cheatsheets that provide sample code and command. Guild now has a number of examples some of which are annotated.
The new support site is geared for improved content generation and transparency. If you run into something that you think is too opaque, it would be terrific if you could bring that up. Feel free to update here or open a new issue.
I'll keep this open a while longer in case anyone wants to weigh in. At some point we should close it and address new topics as they come up.

authors: gar1t higginrp samedii

repo: guildai/guildai


text:
Support clickhouse db

Implementation to support clickhouse db throw clickhouse-driver. Tested manually with remote clickhouse db.

Hi @eskomorokhov would be pretty good to have tests to your code. Can you do that?
And take a look in the way we initiate/import the driver for the other databases.
The way you did it will require me to have the driver installed no matter if I will use it or not.

authors: eskomorokhov wandenberg

repo: guilhermechapiewski/simple-db-migrate


text:
analysis server stalls if the same view is opened in multiple panes

ST has a bug where the .on_modified(view) event handler will be passed the wrong view if:

the same file is opened in multiple views (using multiple panes)
one of those views is active
the active view isn't the first one that was opened

In this scenario, the analysis server doesn't get notified about changes to the view being edited.

This seems to be fixed now, but let's keep this open until we can verify the fix.

repo: guillermooo/dart-sublime-bundle


text:
Adding gulp-pug-frontmatter-support to the "Also see" section

Hello,
Just wanted to share a variation of this plugin I created called "gulp-pug-frontmatter-support"
Using this plugin, this Pug code...
---
title: My Site
---

h1 Welcome!

...Will turn into this:
---
title: My Site
---

Welcome!

This is useful for anyone who has a Gulp + Pug setup for a statically generated site. For example, I am using this in my Jekyll-Bliss project.
I thought it might be useful to add this to the "Also see" list in your readme.

The linked plugin goes against the gulpplugin ethos.  Instead of creating a fork and adding functionality, you should be thinking what sort of plugin you could create that would work in tandem with gulp-pug.
Example (this probably isn't the best API):
gulp.src(...)
  .pipe(frontmatter.extract())
  .pipe(pug())
  .pipe(frontmatter.insert())
  .pipe(gulp.dest(...))

Gotcha. Will consider that.

Thanks for the feedback! I ended up taking your advice and creating a separate plugin: https://github.com/DougBeney/gulp-frontmatter-wrangler

@DougBeney awesome!  Feel free to submit a PR to the "Also see" section with your new module!

authors: DougBeney phated

repo: gulp-community/gulp-pug


text:
chore!: Normalize repository, dropping node <10.13 support

This PR updates this project:

Updates dependency versions
Introduces GitHub Actions
Adds, changes and deletes some project files

@sttk Did you see #5? I think I'm going to deprecate and archive this project because I don't like the API. Is that good?

@phated I'm OK. Please go ahead.

Closing in favor of deprecating as per #5

authors: phated sttk

repo: gulpjs/evented-require


text:
Sync version numbers

Thank you for providing this excellent tool via npm!
It would be really helpful if the version numbers were in sync thought. Right now I download shellcheck@0.4.4 from npm, which actually gives me
ShellCheck - shell script analysis tool
version: 0.7.1

Hi @memark,
Thanks mate! Your words are appreciated.
As for your suggestion, I don't see how it'd work. There are two problems:

The downloader code might need to change
Say I bump the current version to 0.7.1 right now, which would mean it's in sync with the latest shellcheck version. Then let's say a bug comes up, how would I publish the bug-fixed version, given that the tag 0.7.1 is already on npm?
The current script always downloads the latest version of shellcheck
This is doable. I actually wouldn't be opposed to hard-coding version to keep things more stable.

I'm going to close this mainly because of (1). Happy to reopen it if there's something I'm missing and a proposal comes along that solves the problem.
Thanks again for your kind words and for your suggestion.
Cheers,
Gunar

Oh, now I see! (I think.)
This npm package always downloads and installs the latest version of shellcheck, right? So I can use version 0.4.4 to install future versions of shellcheck as well? Then it's no longer a problem!
Maybe we can mention this fact a bit more clearly in the docs?

Done! Thank you for the feedback.

authors: gunar memark

repo: gunar/shellcheck


text:
Add PUT support to DetailUpdateAPI

I mean, I guess it should support it, right? It only supports PATCH currently, I was trying to PUT for 5 minutes before I checked the worf source to work out why I was getting a 405... yay for the 405's working though 🎉

We can add put along side patch, I've read the spec a few times and still cannot reliably remember what the difference is. I suppose PUT is not supposed to do a partial update, it's a full replace? So PATCH should allow a sub-set of attributes to be updated, where PUT would technically require all of them? Does that sound right?

Yes

I added support, it does the same things as PATCH, you'd probably want to use a serializer that makes all fields as required=True, which is a concept marshmallow supports.

authors: stevelacey wadewilliams

repo: gundotio/worf


text:
Made the dataset from vaksanskrit.com

Curated the Sanskrit Text Data from the Sanskrit news website vaksanskrit.com, made appropriate file structure and stored that data.

Not needed


text:
Start with existing init image?

Hi, is it possible to start with an existing image instead of generating from scratch?

Yes, see fork https://github.com/talesofai/AnimateDiff   , that one has an example of an initial image being used on example 10.

According to the 10-InitImageYoimiya.yaml and tutorial, I got the following results. Unlike the given yoimiya example, it seems that the generated contents are not very consistent with the initial image. May I make some mistakes?

Oh, I know the mistake! There are some differences in animated.py of two repositories. The updated results are consistent with the tutorials.

When trying to run the provided example as-is, I'm getting an error:
  File "/content/animatediff_image/scripts/animate.py", line 100, in main
    pipeline.text_encoder = convert_ldm_clip_checkpoint(base_state_dict)
  File "/content/animatediff_image/animatediff/utils/convert_from_ckpt.py", line 726, in convert_ldm_clip_checkpoint
    text_model.load_state_dict(text_model_dict)
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 2041, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for CLIPTextModel:
	Unexpected key(s) in state_dict: "text_model.embeddings.position_ids".

Are there specific library / checkpoint versions I should be using?

despite the recent help from LLM models it seems like many of these issues are still outstanding. I wish I had time to put towards fixing even just this one,

repo: guoyww/AnimateDiff


text:
Windows --executable launch_elden_ring_seamlesscoop.exe

Trying to launch elden ring with ultrawide and seamless coop not working it seems to successfully launch the exe but then immediately crashes I tried python 3.8 through 3.11 with no luck I had it working fine in steam os but in windows it just doesn't work

I have the same issue. Only workaround I found was to start the normal Elden Ring game with er-patcher, then minimize the game with ALT-TAB and then copy the patched eldenring.exe from C:\Program Files (x86)\Steam\steamapps\common\ELDEN RING\Game\er-patcher-tmp and replacing the original one in C:\Program Files (x86)\Steam\steamapps\common\ELDEN RING\Game. In my case I used these launch parameters: python er-patcher --rate 144 --all -- %command%. This will make the changes permament which might result in a ban if you use it online with the original game.

I'm having the same issue, and I'm hesitant to make the changes permanent as suggested.

authors: KandBM metinc surealbus

repo: gurrgur/er-patcher


text:
Close #11 - Remove unnecessary files

Closes #11
The welcome controller is unnecessary now, it was from CodeIgniter.

Thanks. :)

authors: gurrrung tadeubarbosa

repo: gurrrung/FoodShala


text:
Deploying feature-creature

As a feature-creature developer
I do not want my local machine to double as a production server
So I want a more appropriate environment to deploy the application

heroku?
AWS?
somewhere else?

Removed all references to local resources preferring environment configuration.
Code-wise, we're ready to deploy.

repo: gust/feature-creature


text:
Testando linguagem Markdown

Negrito e Negrito
Itálico e Itálico
~Riscado~
Título
Título
Título

misturar
Lista Numerada:

Teste1
Teste2
ii. Teste2.1
Teste3
Teste4

Lista demarcada:

Teste
Teste
Teste

Teste

Teste

Lista de Tarefas:

[X] Criar pág. principal
[X] Criar pág. da loja
[ ] Finalizar a reunião com o cliente
[ ] Receber pagamento

Links: Acesse meu GitHub
Tabela:

Num
Nome
Nota

1
Davi
10

2
Maiane
10

Fim da tabela
Comandos: document.getElementById('id')
num = int(input('Digite um valor'))
if(num%2==0):
   print(f'O valor é par')
else:
   print(f'O valor é impar')

ou:
num = int(input('Digite um valor'))
if(num%2==0):
   print(f'O valor é par')
else:
   print(f'O valor é impar')

Negrito e Negrito Itálico e Itálico ~Riscado~
Título
Título
Título
misturar
Lista Numerada:

Teste1
Teste2
ii. Teste2.1
Teste3
Teste4

Lista demarcada:

Teste

Teste

Teste

Teste

Teste

Lista de Tarefas:

[x]  Criar pág. principal
[x]  Criar pág. da loja
[ ]  Finalizar a reunião com o cliente
[ ]  Receber pagamento

Links: Acesse meu GitHub
Tabela:
Num	Nome	Nota
1	Davi	10
2	Maiane	10
Fim da tabela
Comandos: document.getElementById('id')
num = int(input('Digite um valor'))
if(num%2==0):
   print(f'O valor é par')
else:
   print(f'O valor é impar')

ou:
num = int(input('Digite um valor'))
if(num%2==0):
   print(f'O valor é par')
else:
   print(f'O valor é impar')

Teste de reply.

repo: gustavoguanabara/git-github


text:
Functionality Redesign

Removed lots of code; instead, it creates a class and whenever you pull an attribute from it, the class looks at the answers file and responds accordingly.
from .answers import answers

import random

class Best:
    def __getattribute__(self, name):
        # Return random value in list
        if type(answers[name]) != list:
            return answers[name]
        else:
            return random.choice(answers[name])

A new file structure is also in order and can be seen here: https://github.com/SuperMaZingCoder/bestpy/tree/feature/functionality-redesign/bestpy. Refer to how each file is laid out, as well. Most of them have parts removed.

@SuperMaZingCoder Thanks for the PR. After the newly merged PR to add pre-commit and reformat some of the code, this can't currently be merged. Would you like to have a look at how the conflicts could be resolved?

I'd be happy to. I'm currently not available, but I will look at it once I am :D

Alright! Thanks a lot.

@gustavwilliam All conflicts are resolved. Let me know if I need to do anything else with the PR, otherwise, merge it and let me know (here or in discord).

authors: SuperMaZingCoder gustavwilliam

repo: gustavwilliam/bestpy


text:
Upgrade VHF omni on TKiS-1

Ok, it's over a year since the TKiS-1 station became operational. It's time for some upgrades. The station seems to be stable, but the reception is of reasonably poor quality. There's a lot of interference. Here's couple things we could try:

[ ] upgrade RTL-SDR v3 to a better SDR.
[x] choose, buy and install pre-amplifier, some form of LNA
[x] choose, buy and install band-pass filter

The airspy mini I ordered some time ago on eBay UK has arrived. Compared to RTL-SDR v3, it has the following parameters better:

sampling resolution: 12 bits vs 7 bits of RTL-SDR v3 (technically 8, but effective quantization levels are 7)
sampling rate 3MSPS

Just found a potentially good solution for both the LNA and a filter here: Sawbird+ NOAA.

I've tweaked the setup a bit. The Sawbird+ NOAA finally arrived. This is how the setup looks like right now.

I've also added velcro straps for easy attachment. The Sawbird filter requires power supply. One way to provide it is to use bias-Tee. We need to tweak the SDR-RTL configuration a bit and see if there's any difference.

Another change is that the omni TA-1 antenna has been moved to the other corner of the terrace. The downside is that it's now connected via 25m cable, but on the flipside we now have LNA and a filter. Also, the sky visibility there is a bit better. The roof obscures line of sight in the S-E direction. N, W, and S are all clear!

The AirSpy has arrived, but it's being used for experiments with the X-Quad, see #3.

The setup is now connected to the AirSpy. The RTL-SDR v3 has been retired. May be still useful as a backup...

repo: gut-space/svarog


text:
Inference

Hello,
I find your work very interesting and would very much like to experiment with it, however i have some difficulty figuring out how to use the model for inference. I would like to use an ALT system to transcribe my singing from audio files and thought this model might be a really good solution. Would it be possible to get some guidelines for how to do so?
Thanks

In case anyone is wondering, i simply transcribe my own audio files by commenting out brain.fit in the training script such that i directly generate a wer.txt. There are obviously no ground truth labels for my own recordings, but i am not interrested in the wer, only the generated transcript. I achieve this by assigning a random ground truth label and then simply read the predictions from the wer.txt. There are probably better ways to do this by making an inference class or deataching the WER estimation, but this is just a quick and dirty approach i though i would share.


text:
flask-restaction相对于flask-restful有什么优势，或是什么特性?

很多朋友问我这个问题，在此做一个答复。
首先，restaction 更灵活。restaction 和 restful 都是用来创建 reslful api 的，而且都是基于类的，写的代码看上去都差不多，但是 reslful 的方法只能是 http method，就是 get, post, put, delete 那几个，而 restaction 的方法除了 http method，还可以是任何以 http method 加下划线开头的方法。
其次是输入校验，restaction 是声明式的，简单明确：
    name = "safestr&required", "world", "you name"
    schema_inputs = {
        "get": schema("name")
    }

在 reslful  中叫做 Request Parsing：
from flask_restful import reqparse

parser = reqparse.RequestParser()
parser.add_argument('rate', type=int, help='Rate cannot be converted')
parser.add_argument('name')
args = parser.parse_args()

这种方式很繁琐，他们准备 Rip out Request Parser and marshalling system and replace them with Marshmallow https://github.com/flask-restful/flask-restful/issues/335
但 Marshmallow  是 simplified object serialization，并不是用来校验数据的。
restaction  的输出校验和输入校验差不多，不同的是可以校验自定义的 python 对象。
https://github.com/guyskk/validater#proxydict-validate-custome-type
自动生成 res.js 和 自动生成 documents
用 res.js 可以方便的调用 api，不用记 url，还可以直接上传文件。
这两个是 restful 没有的。
最后是身份验证及权限控制，restaction 的身份验证基于 jwt( json web token), 用一个 json 文件配置各个角色的权限。Flask 文档中就提到做网络开发时要谨慎 http://dormousehole.readthedocs.org/en/latest/advanced_foreword.html#id2 ，我相信这个模块有它的价值并且足够灵活。

写过很多个 RESTful API 并且拜读过 Dr.Roy 的博士论文大作。
在 API 定义过程中中，声明式远优于过程，实现逻辑应只暴露出一些接口给 API 定义。。。你的框架是否能充分践行这一点？

定义输入输出是声明式的，我列一段kkblog中的代码：
class User(Resource):

    """docstring for User"""

    id = "int&required"
    username = "email&required"
    password = "password&required"
    new_password = "password&required"
    role = "role_user&required", "user.normal"
    email = "email&required"
    date_modify = "iso_datetime&required"
    token = "unicode&required"
    remember_me = "bool", False
    message = "unicode"

    schema_inputs = {
        "get": schema("id"),
        "get_me": None,
        "post_register": schema("email", "password"),
        "post_admin_register": schema("email", "password", "role"),
        "post_login": schema("username", "password", "remember_me"),
        "post_forgot_password": schema("username"),
        "post_reset_password": schema("token", "password"),
        "put_password": schema("password", "new_password"),
        "delete": None,
    }
    out = schema("id", "username", "role", "date_modify")
    schema_outputs = {
        "get": out,
        "get_me": out,
        "post_register": out,
        "post_admin_register": out,
        "post_login": out,
        "post_forgot_password": schema("message"),
        "post_reset_password": out,
        "put_password": out,
        "delete": schema("message"),
    }

设置权限也是声明式的：
{
    "*": {
        "comment": ["get", "get_list", "get_list_by3"],
        "githooks": ["post"],
        "bloguser": ["get"],
        "tag": ["get_list"],
        "user": ["get", "post_login", "post_register",
            "post_forgot_password", "post_reset_password"
        ],
        "article*": [],
        "captcha*": [],
        "userinfo": ["get"]
    },
    "user.admin": {
        "*": []
    },
    "user.normal": {
        "comment": ["post", "post_by3", "put", "get_list_of_me", "get_list_to_me"],
        "user": ["get_me", "delete", "put_password"],
        "bloguser": ["post", "put", "get_me"],
        "userinfo": ["get_me", "put"]
    },
    "bloguser.admin": {
        "*": []
    },
    "bloguser.normal": {
        "githooks": ["post", "post_update"]
    }
}

v0.19.3 添加 api.test_client，可以方便测试 API。
同时因为测试的时候没有请求环境，只有应用环境，不能访问 flask.request，所以 flask.request.resource, flask.request.action, flask.request.me都改成了
flask.g.resource, flask.g.action, flask.g.me。

http://flask-restaction.readthedocs.org/zh/latest/quickstart.html#id8

文档做得太简单了，建议参考drf的tutorial ,让大家跟着做一遍，就大概知道你这个插件，大概可以做什么。

authors: Feiox guyskk laopang2018

repo: guyskk/flask-restaction


text:
Supersnappy can raise an unlisted exception

Using supersnappy with Nim 1.6.0 devel :
/home/rcaillaud/.nimble/pkgs/supersnappy-2.1.1/supersnappy.nim(323, 56) template/generic instantiation from here
/home/rcaillaud/.nimble/pkgs/supersnappy-2.1.1/supersnappy.nim(341, 35) Error: newSeq(16384) can raise an unlisted exception: Exception

I am not seeing this with Nim 1.6.0 myself. What is your nim command and do you possibly have any flags / features enabled possibly changing behavior? For example, does a simple nimble test run?

It only happens if you compile with --gc:orc.

Hm, interesting. Thanks for the info. It seems odd to me --gc:orc makes newSeq raise a generic "Exception". I wonder why that is. Will need to take a look.

I added a bunch more test runs to Github Actions and am still not seeing any issues with --gc:orc and Nim 1.6 (or any other version). See this commit: https://github.com/guzba/supersnappy/commit/8deba1f26c6259cf4d97ae04e6f1edd0ec3ac1bc and these runs: https://github.com/guzba/supersnappy/runs/4305537686?check_suite_focus=true
Are you certain you're on stable 1.6? What OS are you seeing this on?

Supersnappy is at commit 62a7e2cea977e51b60005c64741e15ef91cdf542 (I pulled your latest, but I had the same behaviour with tag v2.1.1).
OS is Ubuntu; Nim compiler is devel (v1.6.0 seems to work)
Nim Compiler Version 1.7.1 [Linux: amd64]
Compiled at 2021-11-15
Copyright (c) 2006-2021 by Andreas Rumpf

git hash: 6976d18519d102c9cc857a84a4b10b009c1e1a38

Their CI doesn't use 1.6.1.

Closing this. It's old and was a devel issue. Reopen if still relevant.

authors: Clonkk disruptek guzba

repo: guzba/supersnappy


text:
Still maintained?

I see no more PRs merged since 2018. Is this very nice project still maintained or looking for a new maintainer?

Note isodate will stop working in Python 3.10 due to a DeprecationWarning introduced in Python 3.8 becoming a TypeError in Python 3.10.
Please see https://github.com/gweis/isodate/pull/68 for a fix.
Python 3.10 is due out in just three weeks, so I recommend a release before then.
@gweis If you need a hand with a release, I'd be happy to help out.

I've moved my fork to an organisation, it's now at https://github.com/isodate/isodate/.
I've modernised things: dropped EOL Python, added automated release notes and deploys, converted all the tests to pytest, formatted with Black and isort, added pre-commit and linters.
If anyone else is interested in joining the team, please open an issue over there, and also PRs welcome over there!
It's also worth mentioning https://github.com/bolsote/isoduration by @bolsote as doing something similar to isodate. isoduration looks well maintained and switching to isoduration may be a better long term aim rather than continuing with isodate[2].
I'll also check the existing PRs/issues here and see what else can go to https://github.com/isodate/isodate/. Thanks!

And I should mention, I think the aim of the fork should to be conservative in what it accepts, especially given the existence of https://github.com/bolsote/isoduration.
See also https://github.com/bolsote/isoduration/issues/9#issuecomment-864257454 which reviews the open issues here and shows which are already fixed/improved/planned/irrelevant in isoduration or should not be fixed if incompatible with the standard.

The good news is @gweis is back and has made a new release! 🚀
So the fork is no longer needed and I'll archive the repo.
Can this issue be closed?

repo: gweis/isodate


text:
support eslint:recommand rules

all project support eslint:recommand rules

all project support eslint:standard rules

repo: gxchain/gxb-explorer


text:
单Activity内多个Fragment不同状态问题

AFragment白底黑字状态栏 , BFragment头部为图片沉浸式。
我在切换AFragment设置为
ImmersionBar.with(this)
.statusBarDarkFont(true, 0.2f)
.fitsSystemWindows(true)
.init();
我在切换BFragment设置为
ImmersionBar.with(activity).transparentStatusBar().fitsSystemWindows(false).init();
在页面跳转时状态栏要闪一下

别使用fitsSystemWindows，使用titleBar方法

authors: gyf-dev lzjin

repo: gyf-dev/ImmersionBar


text:
Support the new long-distance matcher

zstd 1.3.2 added a long-distance matcher
(https://github.com/facebook/zstd/releases/tag/v1.3.2); add a function
to set that parameter.

I'd love to use this as part of compressing Rust's own dist tarballs.

Looks great, thanks for the PR!

Thanks for the merge! Would you mind publishing a new version of the zstd crate with this change?

0.8.0 should be out

authors: gyscos joshtriplett

repo: gyscos/zstd-rs


text:
Code runs twice on first load: "flash of non-COI code"

Why this is bad. a lot of this is UX-based which is very subjective.

Big error screen from "SharedArrayBuffer not defined" shocks user since javascript runs on first page load, only to immediately be replaced by a working site. The user is left wondering "why did it not work, but then work? is this site prone to random errors?"
websites can queue up many assets via js on load only to be canceled by the reload. all of which takes time
there's a flash of content that the user wants to interact with but as soon as they move their mouse towards the button or scroll down the blog post; BOOM it reloads. they start to think "what did i do to cause that??? is this site broken? did i touch it wrong?"

Why this is good and should stay as-is

javascript that doesn't care about COI runs ASAP to do things like change BG color to match the user's theme preference from localStorage and such
user has full responsibility to manage content hiding; they can do it however they want
user is free to add their OWN loader icon instead of whatever the coi-serviceworker lib does

it seems like the general "feel" of things is that "flash of ____ content" (like "flash of unstyled content") is generally discouraged as bad UX.
if this is actually intentional and the way that you want this library to be used, I think that adding a blurb about this double-execution in the readme would be good. 😊

To continue from #16...

Could you help me understand why a top level await that blocks forever is better than
if (!window.crossOriginIsolated) {
  throw new Error("Oh no!")
}

The core reason is so that you don't get a flash of errored content. That's the whole reason 🤣 Take a game for instance that uses SharedArrayBuffer as a core WASM Unity Unreal Engine whatever backend. If there's no SharedArrayBuffer on load, it errors. Thus, to hide said error, you want the page to only load if there's SharedArrayBuffer and otherwise whiteout with a blank page or a loading symbol.
The "throw an error" technique is basically what the app already does, my suggestion is that there be some kind of way to make it so that you avoid those errors potentially making false UI flashes of "oh no there's an err- oh now it refreshed and there's no error"
Basically just a AiO toolkit idea to take that UI/UX burden of managing a <div id=loading> off the end-user and putting it in the .js file.

strictly speaking, the code doesn't run twice, it looks like you have persistent logs in your devtools so you see there 2 different page loads.
installing Service Workers is inevitably asynchronous and you can easily bootstrap anything you like once with little extra code:
const COI = Promise[crossOriginIsolated ? 'resolve' : 'reject']();

Now you can await that COI anywhere/anyhow you like and make your logic run only when that resolves instead of rejecting.
The same orchestration can be used to land any other script on the page to avoid counting visits twice, as example ... but the gist is: it's pretty trivial to avoid duplicated code execution and in the worst case scenario, the very first run will already cache some network request so that the reload will be faster once the Service Worker is up and running.

authors: WebReflection jcbhmr

repo: gzuidhof/coi-serviceworker


text:
Allow Safari / WebKit to have SharedBuffer too

This MR enables CORP implicitly for non Chrome/Firefox based browsers and, when that's the case, it also set the CORP policy.
Tested via coincident GitHub pages successfully on both GNOME Web and Epiphany TP.

Perfect, thank you for this contribution!

@gzuidhof it was a one-off contribution from GitHub site directly ... could you maybe do this after merge? Otherwise I'll apply your requested changes.

Yeah I'm happy to do it :) It might be a while before I get around to it.. But I guess that's ok

The changes are now merged and published in version 0.1.7

authors: WebReflection gzuidhof


text:
Expose delete() or clean() method on widget

I'm using the widget on a Next.js powered website. And I noticed that the widget re-creates a worker each time the page containing the form is visited. It would be nice to be able to clean up or delete the widget instance whenever the page is destroyed. Something like;
import { useEffect, useRef } from "react"
import { WidgetInstance } from 'friendly-challenge'

const FriendlyCaptcha = ({ className, puzzleEndpoint, startMode = 'focus', ...rest }) => {
  const container = useRef()
  const widget = useRef()

  useEffect(() => {
    if (!widget.current && container.current) {
      widget.current = new WidgetInstance(container.current, { puzzleEndpoint, startMode })
    }

    return () => {
      // Destroy the widget as the component is unmounting...
	  widget.current.destroy()
      widget.current = null
    }
  }, [container])

  return <div ref={container} className="frc-captcha" {...rest} />
}

export default FriendlyCaptcha

I agree, it makes sense to have that. I'll put it on the backlog, thank you!
I remember when implementing some very old browsers would actually crash if I deleted the webworker right after it was done, but I'm sure a workaround is possible for that. Relevant line https://github.com/gzuidhof/friendly-challenge/blob/master/src/captcha.ts#L201

Come to think of it.. I would expect that the worker gets cleaned up after there is no more reference to it, I guess I was wrong
Until there is some sort of dispose method, you can call widget.worker.terminate() manually.

In version 0.6.0 a destroy() method is now present that cleans up the widget entirely :). Also, it now explicitly terminates workers after the work is done. Let me know if you run into any issues!

authors: gzuidhof robinvdvleuten

repo: gzuidhof/friendly-challenge


text:
findDOMNode is deprecated in StrictMode

Hi there!
I've noticed this warning in the console while using react-detectable-overflow:

Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of ChildWrapper which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node

This is actually a warning shown from the package react-resize-detector that this library uses. As stated in the README, a ref is needed to not use the deprecated findDOMNode.
I believe that a ref is needed in the children that is received and then passed using targetRef to the ReactResizeDetector component over here:
https://github.com/h-kanazawa/react-detectable-overflow/blob/e68f73978bdf7ca24b58468192fa2ee699fcd4bc/src/DetectableOverflow.tsx#L73-L78
Am I right? I'm fine with submitting a PR with this fix.
By the way, thank you for this great library!

Also joining this thread,
@dalbitresb12 I would love to see a PR on this matter
This lib is great and this error shouldn't be a factor whether to chose it or not .

I actually believe this one could be a breaking change, because the children should be a function so that it can return an element with the ref created. This would break existing React apps using this library because they would be passing an element instead of a function as the children. What do you think, @h-kanazawa?

Thanks for reporting. I'll check this issue soon.

I released 0.5.0 fixing the warnings.
@dalbitresb12 I tried to avoid breaking change. If this change breaks your apps or warnings are still logged, please let me know.

I'll try it out and check if anything breaks 😄

Hi @h-kanazawa.
I've updated react-detectable-overflow in my app, but I think the fix isn't working correctly. I'm still getting the error on the console.

@dalbitresb12 Thanks for testing.
Can you attach your environment information for replication? e.g the versions of node, react, your browser, and a code snippet if possible.

@h-kanazawa Sure!
OS: Ubuntu 18.04 under WSL2 on Windows 10 2004
Node: v12.18.3
Yarn: v1.22.5
NPM: v6.14.6
React & React-DOM: v17.0.1
React Scripts: v4.0.0
Browser: Microsoft Edge 86.0.622.51 (Stable Channel)
I've setup a quick demo repository here. You can run it on your environment and test if the error still shows up or not.

Hi @h-kanazawa! I previously added another comment with a test repo, but then I realized it was that I was missing a ref in another ReactResizeDetector that was a parent of the DetectableOverflow component I had. Thanks for fixing this error quickly! Now it is working correctly and without errors.

Code Snippet of my error
I was missing targetRef on the first ReactResizeDetector and didn't notice:
<ReactResizeDetector targetRef={elemRef} handleWidth handleHeight={false} onResize={() => setOverflowed(false)}>
  <DetectableOverflow onChange={handleOverflow}>
    {text}
  </DetectableOverflow>
</ReactResizeDetector>

Previous comment that I deleted
Sure!
OS: Ubuntu 18.04 under WSL2 on Windows 10 2004
Node: v12.18.3
Yarn: v1.22.5
NPM: v6.14.6
React & React-DOM: v17.0.1
React Scripts: v4.0.0
Browser: Microsoft Edge 86.0.622.51 (Stable Channel)
I've setup a quick demo repository here. You can run it on your environment and test if the error still shows up or not.

Note: I'll probably be deleting the repository in a few days.

repo: h-kanazawa/react-detectable-overflow


text:
主题

师傅这是哪个可视化框架，还能换主题颜色，格式

Swing flatlaf


text:
Inheritance output fails when module file name contains additional dots e.g. my.class.js

Follow the tutorial here: https://esdoc.org/tutorial.html
Instead of naming the files MySuperClass.js and MyClass.js, name them my.super.class.js and my.class.js, respectively,
Review the output HTML for MyClass e.g. my.class.js~MyClass.html
See that the Inheritance summary and override methods are missing

All in all, additional dots '.' in the filename break the inheritance functionality.

@cdimascio Thanks issue!
I will fix this issue in future version.

@cdimascio If you write the below code, you must also change also import path.
import MySuperClass from './MySuperClass.js';

export default class MyClass extends MySuperClass {
...
}

to
import MySuperClass from './my.super.class.js';

export default class MyClass extends MySuperClass {
...
}


text:
*args, **kwargs, Python 2.7 syntax?

Have I misunderstood PEP-484?  It seems to imply that the correct syntax for type checking should be:
@typed(scope=Any, *args=Any, **kwargs=Any)
def method(scope, *args, **kwargs):
   pass

However this doesn't seem to work and I have to use
typed(scope=Any, *args=Any, **kwargs=Any)
...

Umm, I did wonder whether it should actually be this
@typed(scope=Any, args=*Any, **kwargs=Any)

but that doesn't seem to work either.