text:
Add SslProtocol Support to WebCmdlets

closes #2662
This feature adds the ability to restrict the SSL/TLS protocol used when making the web request. In 5.1 the user could make use of .NET API's to enforce this on the Web Cmdlets. With the move to HttpClient in PowerShell Core, those APIs have no impact. The user still has requirements to ensure specific protocols are used.
The public enum WebSslProtocol is added as a wrapper to the underlying SslProtocols enum. Neither it nor  SecurityProtocolType can be used because Ssl3 and Ssl2 are not supported by HttpClientHandler.SslProtocols. While it may not be intuitive to a PowerShell user to use -bor or "Tls, Tls11" to set multiple options, the general use case for this will be a single protocol.

Adds -SslProtocol parameter to Web Cmdlets
Adds WebSslProtocol Enum to support limited subset of SslProtocol enum supported by HttpClientHandler
Adds TLS 1.1 and TLS 1.0 listening ports to WebListener
Adds 100% test coverage for new feature

I spoke with @SteveL-MSFT about getting this approved before RC release.

@TravisEz13 It looks like macOS does not support multiple protocols being set at once. This is not surprising as the entire SSL/TLS/Certificate implementation in CoreFX is flakey on macOS where some things work sometimes, not at all, or only partially.
I'm going to logic gate the multi-protocol test cases so they don't run on macOS.
$handler = [System.Net.Http.HttpClientHandler]::new()
$handler.SslProtocols = [System.Security.Authentication.SslProtocols]::Tls -bor [System.Security.Authentication.SslProtocols]::Tls11
$HttpClient = [System.Net.Http.HttpClient]::New($handler)
$Response = $HttpClient.GetAsync("https://httpbin.org/user-agent").GetAwaiter().GetResult()

result
Exception calling "GetResult" with "0" argument(s): "The requested security protocol is not supported."
At line:1 char:1
+ $Response = $HttpClient.GetAsync("https://httpbin.org/user-agent").Ge ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : NotSupportedException

ErrorRecord                 : Exception calling "GetResult" with "0" argument(s): "The requested security protocol is not supported."
WasThrownFromThrowStatement : False
Message                     : Exception calling "GetResult" with "0" argument(s): "The requested security protocol is not supported."
Data                        : {System.Management.Automation.Interpreter.InterpretedFrameInfo}
InnerException              : System.NotSupportedException: The requested security protocol is not supported.
                                 at System.Net.Http.CurlHandler.SslProvider.SetSslVersion(EasyRequest easy)
                                 at System.Net.Http.CurlHandler.SslProvider.SetSslOptions(EasyRequest easy, ClientCertificateOption clientCertOption)
                                 at System.Net.Http.CurlHandler.EasyRequest.InitializeCurl()
                                 at System.Net.Http.CurlHandler.MultiAgent.ActivateNewRequest(EasyRequest easy)
                              --- End of stack trace from previous location where exception was thrown ---
                                 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                                 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                                 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
                                 at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
                              --- End of stack trace from previous location where exception was thrown ---
                                 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                                 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                                 at CallSite.Target(Closure , CallSite , Object )
TargetSite                  : Void ConvertToMethodInvocationException(System.Exception, System.Type, System.String, Int32, System.Reflection.MemberInfo)
StackTrace                  :    at System.Management.Automation.ExceptionHandlingOps.ConvertToMethodInvocationException(Exception exception, Type typeToThrow, String meth
                              odName, Int32 numArgs, MemberInfo memberInfo)
                                 at CallSite.Target(Closure , CallSite , Object )
                                 at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
                                 at System.Management.Automation.Interpreter.DynamicInstruction`2.Run(InterpretedFrame frame)
                                 at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
HelpLink                    :
Source                      : System.Management.Automation
HResult                     : -2146233087

Hmm. It looks like the 'Tls, Tls12' failure on Linux is a possible CoreFX bug. It appears it doesn't honor the Tls12 property when it is supplied with Tls and instead tries to use Tls only. All the other combinations work, including 'Tls, Tls11, Tls12', 'Tls11, Tls12', and 'Tls12'.
$url = Get-WebListenerUrl -Test Get -Https -SslProtocol Tls12
$handler = [System.Net.Http.HttpClientHandler]::new()
$handler.ServerCertificateCustomValidationCallback = [System.Net.Http.HttpClientHandler]::DangerousAcceptAnyServerCertificateValidator
$handler.SslProtocols = [System.Security.Authentication.SslProtocols]::Tls -bor [System.Security.Authentication.SslProtocols]::Tls12
$HttpClient = [System.Net.Http.HttpClient]::New($handler)
$Response = $HttpClient.GetAsync("$url").GetAwaiter().GetResult()

Message        : An error occurred while sending the request.
Data           : {}
InnerException : System.Net.Http.CurlException: SSL connect error
                    at System.Net.Http.CurlHandler.ThrowIfCURLEError(CURLcode error)
                    at System.Net.Http.CurlHandler.MultiAgent.FinishRequest(StrongToWeakReference`1 easyWrapper, CURLcode messageResult)
TargetSite     : Void Throw()
StackTrace     :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                    at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
                    at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
                 --- End of stack trace from previous location where exception was thrown ---
                    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                    at CallSite.Target(Closure , CallSite , Object )
HelpLink       :
Source         : System.Private.CoreLib
HResult        : 35

I'll logic this one out of being run on both linux and macOS. When I get some time I will open an issue with CoreFX.

In previous years, we had a simple logic when we started with a highest protocol and fallback at a lower.
After it has been recognized as a security hole, I guess the setting of several protocols is irrelevant and we should block it.

@iSazonov Your recommendation is to switch it to a Non-Flags Enum?
My plan was to not document the possibility of multiple protocols and leave as an exercise for advanced users.  They don't show up in intellisense and unless someone advanced enough in the l;language took a good look at the Enum, they wouldn't really know.
Multiple protocols work 100% on windows , 99% on linux and 0% on macOS. The linux one is a bug and macOS curl is a known trouble spot in CoreFX that they have been steadily improving.
I'd rather leave it in and let advanced users give it a try than take the option away.
If there is a concern, it could be documented that "setting multiple protocols is possible, though not supported on all platforms".

Thinking about security I believe we lost nothing if remove Flags. @PaulHigin Could you please comment?

@iSazonov you are right in that there is no security loss. But, lets say a user has a contractual agreement to use TLS 1.1 at minimum, they could supply 'Tls11, Tls12' and ensure the endpoint isn't using TLS 1.0. That works perfect on Windows and Linux. Now we take the Flags away the user must now call first with TLS 1.1 and then try again with TLS 1.2.
So no, security loss, but, we do make it harder for the user.

Since POODLE attacks TLS fallbacks was disabled. Currently only client moderated fallbacks is allowed by means of TLS_FALLBACK_SCSV fake cipher suite.
I'm sure this is a lower level API than PowerShell. I don't know if CoreFX support this. If no so there's no point in specifying multiple protocols.
If CoreFX could support this, we could indicate Tls12,Tls11, which would mean: try to connect with Tls12, if server reply with TLS_FALLBACK_SCSV then use Tls11.

@iSazonov I'm not exactly sure what is being done, but I know for a fact from the tests in This PR, that if you supply Tls12, Tls11 to a Tls12 endpoint it works, to a Tls11 endpoints it works, to a Tls endpoint it fails. So at the very least it is allow for only Tls12 and Tls11 endpoints.

This design is similar to most browsers.  I don't think we need to remove fallback.

The design - yes, most of browsers has check boxes to select some protocols. But its behavior is secure - all of browsers disable fallback since POODLE discovered. Currently client and server must support TLS_FALLBACK_SCSV to do moderated fallback. If PowerShell and .Net Core allow to select some protocols and don't support TLS_FALLBACK_SCSV - it is security hole, an user using PowerShell can be redirected to a fake (Azure) server.

@iSazonov I do not follow your logic.
User has a requirement to NOT use TLS 1.0.  The user supplies -SslProtocol 'Tls11, Tls12'. Here are the conditions of the endpoint:
| End Point Protocol | Result  |
| TLS 1.0            | FAILED  |
| TLS 1.1            | Success |
| TLS 1.2            | Success |
I'm not sure how POODLE is even a problem since SSL 3.0 is not even supported in CoreFX by the HttpClient.
When HttpClientHandler is either supplied None or Tls, Tls11, Tls12 they act exactly the same except for the logic tho determine which Flags were supplied. So if this is insecure, for some reason, it is already insecure and supplying multiple Flags doesn't change that. At the very least, it offers enhanced security because at least the user can disallow a specific protocol.

@markekraus Currently not only TLS->SSL fallback is security hole, TLS high level -> TLS low level also is security hole and is under the prohibition. If PowerShell is trying to connect with TLS 1.2 and server reject the connection, PowerShell shouldn't fallback to TLS 1.1 in classic way (only by supporting TLS_FALLBACK_SCSV).
So main question is - do underline system (CoreFX) implement the fallback on TLS_FALLBACK_SCSV? If yes I am fine with setting many protocols, if no I believe we shouldn't violate security and the modern standard for the TLS_FALLBACK_SCSV fallback.
Also if today CoreFX don't implement the same behavior for all platforms it is better for script portability to be limited to one protocol.

@iSazonov I doesn't matter. if the user doesn't want TLS 1.0, or TLS 1,1, they specify -SslProtocol 'Tls12' The connection will not work on anything other than TLS 1.2. The test in this PR prove that.

Also if today CoreFX don't implement the same behavior for all platforms it is better for script portability to be limited to one protocol.

Then we should rip out all of our security features for macOS since they are all partially or not supported or only work under the right circumstances. or, we should completely rip out these cmdlets from macOS because the entire CoreFX HttpClient implementation on macOS is riddled with issues. When we go RTM I am expecting macOS users to flood with web cmdlets issue. CoreFX is just weak there.
This kind of thing just needs to be documented and to a degree it will be expected by users. Python, PHP, and other cross-platform languages have plenty of their own cross-platform implementation quirks. Something being either not supported on one platform or partially supported on another never stops other languages from implementing enhancements for a majority of platforms.
Again, multiple protocols works 100% on Windows, 99% on Linux (the one instance that doesn't work appears to be a bug in CoreFX) and not at all on macOS. I don't think throwing the feature out just because macOS and CoreFX have issues with libcurl is worth it, when all windows platforms, and almost all Linux platforms will support it. If we start down that path we will never get to implement anything that is an improvement for most platforms just because one platform happens to be fragile. If this only worked on Windows, then maybe I would agree it's not worth implementing.
CoreFX will have better support for these things in macOS in the future. Their issues are littered with HttpClient implementation issues on macOS. They know it's a weak point and we should acknowledge it as one for ourselves as well.

we should completely rip out these cmdlets from macOS because the entire CoreFX HttpClient implementation on macOS is riddled with issues.

If I were a user of PowerShell on MacOs, I'd feel cheated if I had cmdlets that didn't work.

If I were a user of PowerShell on MacOs, I'd feel cheated if I had cmdlets that didn't work.

I'd rather have a web cmdlets that at least works for the most part with basic web calls than none at all. Even if certain features aren't all supported on my platform, I'd still want it. The point is that partial support is better than none at all.

If we need to remove a disable the cmdlets for macOS file another issue.  For the fallback issue, I think fallback is a required feature based on past experience.  If we need a more restricted fallback, I think we would need support for .NET to support that.

I'm leaving a note here for those who view this discussion in the future and for clarity to avoid panic:
The issues I have seen with HttpClient on macOS are not reliably reproducible. I am uncertain how much of it relates to an instability of CoreFX on macOS or just consistent bad luck and phantom external issues.
For the most part, simple HTTP calls work to a high rate of success. However, they will randomly fail even in our tests in this project for macOS where they are not failing for the same tests in Windows and Linux. Some of that maybe Travis CI related. However, since I acquired a macOS machine to test with I have seen similar stability issues on my own machine. Again, I don't know how much of that is just bad luck, my lack of experience with macOS in general, or possible stability issues in CoreFX. I cannot reliably reproduce the issues I find, so it is impossible at my skill level to track down a specific root cause.
As such, I can only say, without solid evidence, that I have general distrust for the stability of HttpClient on CoreFX and thus a similar feeling about the Web Cmdlets which use HttpClient. Without being able to quantify my experience, I cannot recommend the Cmdlets be removed from macOS.
It is clear, however, that many of the features relating to security and encryption are not fully implemented CoreFX on macOS. They work at the basic level depending on how the environment is configured. Sometimes they do not work at all, again, depending on how the environment is configured. However, I do not feel it is prudent to cripple these features for all platforms simply because a single platform cannot full implement them.

@markekraus Clould you please open tracking Issue? It wouldd be usefull for documentating the limitations and tracking CoreFX.

@iSazonov #4650 is related I could just update that.  The underlying cause is the same.
I'm not sure if we should open a master issue to track all macOS limitations, or just Web Cmdlets. As I recall, there are several other cmdlets that have issues on macOS but I can't recall which ones immediately.

That would be very good if users were given this description (broken cmdlets) in the documentation (release notes). If you open the issue anyone  can complete it at any time.

@iSazonov  #5329

authors: TravisEz13 iSazonov markekraus


text:
Throw better parsing error when statements should be put in named block

PR Summary
Fix #6431
Throw better parsing error when statements should be put in named block.
Now the error looks like this:
PS:24> Function foo {
>>     [CmdletBinding()] param()
>>     DynamicParam {
>>     }
>>
>>     'hi'
At line:7 char:5
+     'hi'
+     ~~~~
unexpected token ''hi'', expected 'begin', 'process', 'end', or 'dynamicparam'.
+ CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingNamedBlocks

PR Checklist

[x] PR has a meaningful title

Use the present tense and imperative mood when describing your changes

[x] Summarized changes
[x] Change is not breaking
[x] Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
[x] This PR is ready to merge and is not Work in Progress.

If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready.

User-facing changes

[ ] Not Applicable
OR
[x] User-facing Documentation needed

[x] Issue filed - Issue link:

Testing - New and feature

[ ] Not Applicable or can only be tested interactively
OR
[x] Make sure you've added a new test if existing tests do not effectively test the code changed

[x] Add [feature] if the change is significant or affects feature tests

@lzybkr Can you please take another look at the new commits? The additional change is to make sure we eat the unexcepted token in case that lCurly == null and nextToken.Kind != EndOfInput, just as what we do today in CompleteScriptBlockBody.

@daxian-dbw Could you please add new error sample in the PR description?

@iSazonov The example in PR summary has already been updated.

LGTM

source: gharchive/pull-request

authors: daxian-dbw iSazonov

repo: PowerShell/PowerShell

license: MIT

license_type: permissive

license_source: github-api


text:
Jonagel/about topics - Adding About Tempate and About MD to Txt as part of New-ExternalHelp

Adding functionality for About Topics
@vors please review.

Overall looks good, lets address comments and it would be good to merge.

Awesome, thanks @vors - will look at the comments now.

@jongeller I noticed that commits don't have your avatar image. That mean you didn't add jon.geller@outlook.com to you email addresses in github settings. You may want to do it.

@jongeller These 2 tests are failing, now with a new error: https://ci.appveyor.com/project/PowerShell/markdown-maml/build/0.4.0.688#L605

Let's work on merging this PR

authors: jongeller vors

repo: PowerShell/platyPS

license: mit

license_source: bigquery


text:
xSQLServerAlwaysOnAvailabilityGroup/Replica: Utilize the help function Get-PrimaryReplicaServerObject

Details of the scenario you tried and the problem that is occurring:
Update the resources to use the shared function Get-PrimaryReplicaServerObject.
The DSC configuration that is using the resource (as detailed as possible):
xSQLServerAlwaysOnAvailabilityGroup/Replica
Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:
N/A
What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running:
N/A
Version of the DSC module you're using, or 'dev' if you're using current dev branch:
dev

Working this one next.

source: gharchive/issue

repo: PowerShell/xSQLServer


text:
Add timestamp to output log

Adding timestamp will help in case script is stuck or blocked and also knowing how long particular operation is running. Useful when running from a remote server since it took much longer to finish.

Thanks @surinderv - will work this in.

authors: BrianFarnhill surinderv

repo: PowerShell/xSharePoint


text:
Having trouble to edit web.config file under system.web

Hi there,
is it possible to add in web.config file the following line under system.web:
<system.web>
<httpCookies requireSSL="true" />
<system.web />

I don't think that is possible with any of to today's resources. Please look if PR #330 will solve you rproblem once merged.

i'me trying to use the xWebConfigProperty instead of xWebConfigKeyValue and getting the error: "undefined DSC resource" on powershell means that Xwebadministration Module doesn't recognize xWebConfigProperty  parameter

xWebConfigProperty is a proposed (new) resource in pull request #330. It has not been merged into the resource module yet. If you want to test it out before it is merged into the resource module (and eventually released), you can check out the working branch of the PR author.

This is now resolved by PR #330.  Please re-open if you feel this needs to be further addressed.

authors: fadimaster johlju regedit32

repo: PowerShell/xWebAdministration


text:
New Psinject always inject ps2

I dont want to annoy but i'm just writing it to let you know. For me its not a big deal.
There is a new issue with the new psinject - the injection always inject ps2 even if the computer has ps4.

hey @kokoown,
While this may occur, I can't think of why this would be an issue as injection will work regardless. Are you running into an issue as a result of injection using .NET 2 instead of 4?

No. Not at all. Im just infore you

Ahh, cool. Thanks! We will take a look at this. In the meantime, injection should work as expected.
Thanks for reporting it!

repo: PowerShellEmpire/Empire


text:
Changed DoesCommandExist function for best practices.

Changed DoesCommandExist to adhere to best practices. Changed the IF statement on line 56 as IsChocoInstalled already test's if 'choco' comanned exists.

Superseeded by #51 hence closing this PR

repo: PowerShellOrg/cChoco


text:
Нужны шаги для проверки состава командного интерфейса

	И панель разделов равна
		| 'ПунктМеню1' |
		| 'ПунктМеню1' |

	И панель разделов содержит пункты меню
		| 'ПунктМеню1' |
		| 'ПунктМеню1' |

	И панель разделов не содержит пункты меню
		| 'ПунктМеню1' |
		| 'ПунктМеню1' |

	И панель функций равна
		| 'ПунктМеню1' |
		| 'ПунктМеню1' |

	И панель функций содержит пункты меню
		| 'ПунктМеню1' |
		| 'ПунктМеню1' |

	И панель функций не содержит пункты меню
		| 'ПунктМеню1' |
		| 'ПунктМеню1' |

	И группа "ЗаголвокГруппы" в панели функций содержит пункты меню
		| 'ПунктМеню1' |
		| 'ПунктМеню1' |

	И группа "ЗаголвокГруппы" в панели функций не содержит пункты меню
		| 'ПунктМеню1' |
		| 'ПунктМеню1' |

Решено.

repo: Pr-Mex/vanessa-automation


text:
Обновление компоненты VanessaExt, версия 1.3.4.4

Добавлено поле, содержащее полный путь импортируемого файла Gherkin

run tests


text:
Изменена функция получения параметра шага из контекста

Получение параметра шага из сохраненных в контексте значений (#4)

Спасибо!

@yadimetrio
Столкнулся с проблемой. Epf лучше не из конфигуратора сохранять в xml, а через запуск батника Decompile.bat.
Тогда и версия в XML файлах встала правильно и служебный файл "filename" появился.

Я уже поправил.

authors: Pr-Mex yadimetrio


text:
Double check tower/item scripts that sleep

TriggerSleepAction(2) is translated to await get_tree().create_timer(2.0).timeout.
If tower is sold or upgraded, it's script is removed, which means that the part after await won't be executed. For towers like "CloudWarrior" this is not a problem because they just deal damage after sleeping. Some towers might do stuff like destroying an Effect after sleeping. This is bad because in Godot this would mean that if tower is sold while script is sleeping, the effect will never be destroyed and will be visible forever. Need to workaround that. Either rewrite script to avoid sleeping or schedule the effect to be destroyed before sleeping.
Example of problematic tower "Shard of Souls":
  call tomy_SoulLink.apply(tower, next, level)
        set effects[counter] = AddLightningEx("DRAL", false, GetUnitX(next.getUnit()), GetUnitY(next.getUnit()), GetUnitFlyHeight(next.getUnit()), GetUnitX(target.getUnit()), GetUnitY(target.getUnit()), GetUnitFlyHeight(target.getUnit()))
        set target = next
        set counter = counter + 1
    endloop

    call TriggerSleepAction(0.20)
    loop
        set counter = counter - 1
        exitwhen counter == -1
        call DestroyLightning(effects[counter])
        set effects[counter] = null // Not sure if this is needed
    endloop

Checked all existing scripts and they are ok. Will check new scripts as they get added.


text:
Documentation -- as a topic -- the ways we write it, where to write it etc.

### Tasks
- [ ] Function-level documentation (currently only for package functions, not module functions)
- [ ] Module-level documentation
- [ ] Meta-module-level documentation -- e.g., LandR manual
- [ ] Metadata -- what currently is pulled into Rmd template

Notes:

Show Rmd chunks that pull metadata


text:
Mac 11.1 不报错 就是转换不了

Last login: Sun Feb 21 16:15:49 on ttys001
/Users/putao/Desktop/2021/music/decoder.command ; exit;
putao@putaodeAir ~ % /Users/putao/Desktop/2021/music/decoder.command ; exit;
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[进程已完成]

新建一个文件夹 又好用了

repo: Presburger/qmc-decoder


text:
Align rating to the left on product list

Questions
Answers

Description?
The rating is not really aligned on product of product list

Type?
bug fix

BC breaks?
no

Deprecations?
no

Fixed ticket?
Fixes PrestaShop/Prestashop#27252.

How to test?
You should test this pr with https://github.com/PrestaShop/PrestaShop/pull/27387, this one is just about this element to be aligned to the left of the product

@marwachelly The problem with npm i is not linked to the PR at all
The left alignment is fixed on my side, do you've some cache issues?

@marwachelly The problem with npm i is not linked to the PR at all
The left alignment is fixed on my side, do you've some cache issues?

@NeOMakinG You are right. It seems that it was a cache issue. Thank you for the fixe!
https://watch.screencastify.com/v/axqDIA9TxLhIi3wo5j0P

Thanks @NeOMakinG & @marwachelly

authors: NeOMakinG Progi1984 marwachelly

repo: PrestaShop/productcomments


text:
Adapt ps_bestsellers for multiples versions of PrestaShop

Questions
Answers

Description?
Adapt ps_bestsellers for multiples versions of PrestaShop

Type?
refacto

BC breaks?
no

Deprecations?
no

Fixed ticket?
Relative to PrestaShop/Prestashop#28988

How to test?
Try this module in version < 1.7.4.0 and in recent version (8.0.0)

Thank you @Progi1984 & @florine2623! 🥳


text:
Translations Backoffice

Why can't I see the translations from the backoffice but if I go to the sources are they there?
Prestashop 1.7.
{l s='You will be notified when this product is available.' d='Modules.Emailalerts.Shop'}
But in Bo not see translations.

👋🏼 Hello @totti240282, it looks like you're trying to get assistance for an issue you're facing. GitHub's Pull Requests are used to introduce code (or docs) modifications to the PrestaShop Project. Please consider using one of the methods listed in the "Community Help" section of the PrestaShop Project's Support page (I would suggest Slack but you're free to use whatever method suits you the best).


text:
Crash when scrolling the feed

Crash when scrolling the feed

Can you try to reproduce it with following build:
https://drive.proton.me/urls/VAZWRH29MG#1kvPKw92Maqw
It should be fixed in this build.

I don't know how to reproduce these crashs. So I will close these issues.

authors: AleksandarIlic bitcoinuser

repo: PrimalHQ/primal-android-app


text:
Differential Highlighting

Motivation
If a sample string that is supposed to be highlighted is huge, it takes some time for the highlighter to tokenize it. By having a differential highlighting method, a small change in this string is not triggering an entire new tokenizing method.
Description
Include a range where changes are occurred in an input string and tokenize that section only instead of the entire string from scratch.
Alternatives
none

You could probably implement this yourself if you know upfront what part of the string changed and could focus on rehighlighting maybe a couple lines before and after, but I'm not sure how Prism could do this.

Yes, I know the changed boundary. The issue is I am not sure how to find the boundary that is acceptable to perform a new tokenizing on.
I was hoping to have a function that returns the minimum boundary that needs to be retokenized. This is not something I can do without knowing the language structure.
Example:
Before:

After:

To me, this is the only missing API to use Prims.js for efficient dynamic highlighting.

I was hoping to have a function that returns the minimum boundary that needs to be retokenized. This is not something I can do without knowing the language structure.

Yeah, this is probably going to be different per language. I don't think it's possible to do in a generic way.

Maybe some insight on the highlighting performance of Prism:
This actual tokenization of a string is usually quite fast (in the range of a few milliseconds for 1k lines of code). Generating the HTML code for those tokens usually takes about the same time as creating the token stream (so another few milliseconds). The browser then parsing the generated HTML code and updating the DOM, now that takes time (usually tens of milliseconds for 1k lines of code).
The actual times heavily depend on the code, its language, and the machine you're using, but the orders of magnitude generally hold.
Your issue is performance, right? In that case, you could probably get away to tokenizing the whole string, figuring what parts of the token streams changed, and then partially updating the DOM.
You still have to tokenize the whole string, but it should be quite fast.

@RunDevelopment

This actual tokenization of a string is usually quite fast

This is the only function that I was hoping to be fast. I can do the rest partially and efficiently. However, I've tried the following code on JQuery and it took around 1 second which is not acceptable for dynamic highlighting. (p.s. on the same machine, the same code gets highlighted on CodeMirror almost immediately)
<!DOCTYPE html>
<html>
<body>
  <script type="text/javascript" src="prism.js"></script>
  <script type="text/javascript">
    fetch('https://code.jquery.com/jquery-3.4.1.js').then(r => r.text()).then(string => {
      console.time();
      const tokens = Prism.tokenize(string, Prism.languages.javascript);
      console.timeEnd();
    });
  </script>
</body>
</html>

outputs:
1. default: 653.635986328125ms
2. default: 780.9658203125ms
3. default: 1258.4541015625ms

I looked at the example and found why it takes so long. The TLDR; is the JQuery source is a worst-case for Prism's array-based token stream implementation meaning that a lot of operations which normally take O(1) time, now take O(n) time (the browser optimizes a lot, it's probably closer to O(log n)).
For the kind of small files (up to 1k lines) Prism was originally intended to be used on, this usually isn't a problem but for bigger files, it can be.
In #1909, I actually already implemented a solution which guarantees O(1) time for all token stream operations, but it's kinda stuck (as I said, this isn't the usual use case).
A quick benchmark shows that it will help quite a bit for your test file.

benchmark
  https://code.jquery.com/jquery-3.4.1.js (274 kB)
  | PrismJS@master                    805.30ms ± 46%   19smp 27.04x
  | RunDevelopment@core-linked-list    29.78ms ±  0%  326smp

@mAAdhaTTah Maybe we could try to get #1909 merged? I already resolved the merge conflicts.

Looking back at #1909, my initial thought was if the issue doesn't affect most users, it's not worth the extra bytes. Highlighting the entirety of the jQuery source seems like an edge case; doing so multiple times, even more so.
If you're going to be tokenizing a large string, I almost want to suggest taking advantage of Prism's Worker functionality and doing it off-thread. It won't make it faster, but it will keep the main thread from locking up while Prism does its tokenization.

Highlighting the entirety of the jQuery source seems like an edge case; doing so multiple times, even more so.

I can agree with the multiple times part but users might highlight big files (like the jQuery source). When publishing documentation, they often provide a "jump to source" option, where the whole file is displayed.
Admittedly, it's rare compared to highlighting a few lines of code in a blog article but I still think that Prism should scale well with larger text files.
Also, doing the highlighting in the off thread will unblock the UI, but you won't get the results any faster, so your text editor is responsive but it still lags.

it's not worth the extra bytes

Right now, it adds ~700bytes which is a ~10% increase. I can probably get it down a little more but I think it's worth the 2x and up performance improvements.

Going to continue the convo over on that PR.

That said, for this issue, I'm not sure "differential highlighting" is something we can accomplish. @RunDevelopment If you agree, you can close this issue.

I actually have an idea for how to accomplish differential highlighting but it's not easy.
The main problem is that we don't know where to start highlighting because changes in one line might affect tokens which span more than one line. Patterns with lookarounds are also affected.
My idea is the following: We split the patterns of a language into two groups: greedy and non-greedy.
(The problem here is that this assumes that all greedy patterns come before all non-greedy patterns in a given language. Most languages actually are of that form (and I think that you can transform any Prism language into that form), so let's run with that assumption.)
If the language is of that form, we can think about all greedy tokens as one token. We can do this because Prism's greedy matching is really just a way to split a regex of the form /token1|token2/ into two tokens while retaining the left to right matching. So we just reverse that process here.
So let's replace all greedy tokens in the language with one non-greedy token representing all greedy tokens, let's call it $greedy. What we're left with, is a language with only non-greedy tokens. ($greedy has to be the union of all greedy tokens which might be impossible because of the limitations of Prism's lookbehinds. I will just assume, it's possible.)
To implement differential highlighting, we need the token stream of the old text, the complete changed text, and the range of the changes.
I will now, only describe the basic idea because the actual algorithm isn't easy enough to be described in only a few paragraphs.
The idea is that we go through the patterns of our language in order and try to increase the lower boundary of the text, we have to re-highlight by using the fact that Prism doesn't match tokens from left to right in a greedy fashion but in a first-come-first-served fashion. So if we find a token in the changed text which is the same as a token in the old token stream and is between the current lower boundary and the start of the changes, we can increase the lower boundary to the end position of the token. Like this, we increase the lower boundary iteratively for all patterns until either tokens always change or we reached the start of the changes.
The same idea can be applied to lower the upper boundary of the text we have to re-highlight.
I'll be honest: While possible, differential highlighting is horribly complex to implement and IMO simply out of the scope of Prism. And with that, I will close the issue.

Two questions:

Is it possible to have a function that returns the closest bounding token at a cursor position of a string?

Is it possible to a signaling method for the tokenizer to get stopped before the entire string is tokenized? Something like an each(token) {return true/false} function that can break tokenizing in the middle of the operation.

To me, these are the minimum components that can help to deploy prim.js for more complex works without altering the basic usage of the library.
btw the speed of tokenizing on RunDevelopment@core-linked-list is considerably improved. If prims.js supports worker it implies that this library is capable of doing heavy duties.

No. Prism and its plugins only traverse the full token stream, so we never needed such a search function. Plugins sometimes heavily modify the token stream, so having to maintain a data structure for quick searches would actually slow down Prism for most users.
That being said, it's not very hard to implement this function yourself (see below).

No, but you can pass a different grammar. If you know beforehand at which token you want to break, you can do this:
const newGrammar = { };
for (const name in oldGrammar) {
    if (name === breakName) break;
    newGrammar[name] = oldGrammar[name];
}
Prism.tokenize(code, newGrammar);

Get token at or before a given index
// use the below functions like this
const tokens = Prism.tokenize(code, grammar);
assignIndexes(tokens); // has to be done once

const pos = getTokenAtOrBefore(tokens, someIndex);
if (pos === -1) {
    // not found
} else {
    const token = tokens[pos] as Token;
}

I haven't tested these functions, so please use them carefully!
interface Token {
	readonly type: string;
	readonly content: string | Token | (string | Token)[];
	length: number;
	index: number; // not a real property; we will add this later
}

/**
 * A token stream is not just a simple array. It is guaranteed to not contain adjacent string values.
 * This guarantee is assumed by the below methods.
 */
type TokenStream = (string | Token)[]

/**
 * Calculates the string length of a token.
 */
function getLength(value: string | Token): number {
	if (typeof value === "string") {
		return value.length;
	} else {
		if (Array.isArray(value.content)) {
			return value.content.reduce((total, x) => total + getLength(x), 0);
		} else {
			return getLength(value.content);
		}
	}
}

/**
 * Assigns the index value of all top-level tokens and returns the total string length of the token stream.
 */
function assignIndexes(stream: (string | Token)[]): number {
	let index = 0;
	for (const value of stream) {
		const length = getLength(value);
		if (typeof value !== "string") {
			value.index = index;
			value.length = length;
		}
		index += length;
	}
	return index;
}

/**
 * Returns the index of the token with the greatest index that is <= the given index.
 *
 * If no such token exists, `-1` will be returned.
 */
function getTokenAtOrBefore(indexesStream: (string | Token)[], index: number): number {
	let low = 0, high = indexesStream.length;
	while (low < high) {
		// adjust bounds
		if (typeof indexesStream[low] === "string") {
			low++;
			continue;
		}
		if (typeof indexesStream[high - 1] === "string") {
			high--;
			continue;
		}

		let m = (low + high) >> 1;
		if (typeof indexesStream[m] === "string") {
			m--;
		}
		const mValue = indexesStream[m] as Token; // we know is has to be a Token but TS doesn't

		if (mValue.index <= index) {
			// find the next token. If that token does not contain the index and is right of it, m is the token
			// before the given index
			let next = m + 1;
			if (typeof indexesStream[next] === "string") next++; // skip string
			if (next >= indexesStream.length) {
				return m; // there is no token after this one, so m is the last token before the given index
			}
			const nextValue = indexesStream[next] as Token;
			if (index < nextValue.index) {
				return m;
			} else {
				low = next;
			}
		} else {
			high = m;
		}
	}
	return -1;
}

@belaviyo
#1909 is now merged. Prism should now be able to highlight jQuery's source about 20~30 times faster.

authors: RunDevelopment belaviyo mAAdhaTTah

repo: PrismJS/prism


text:
MAXScript Support

Language
MAXScript scripting language for 3ds Max.
Additional resources
https://help.autodesk.com/view/MAXDEV/2022/ENU/

Hello @RunDevelopment
I hope life is good. I will preface all of this by making it clear that I know you are doing much more important things. But in the situation where you have a moment to reply, I would greatly appreciate it!
First I just wanted to thank you so much for your work getting MAXScript as a supported language!  Today was my first chance to see your work in action, with the new release of Obsidian Mobile. I attached a screenshot from my vault. This app uses Prismjs for syntax highlighting. I am using blue topaz as a theme which appears to show more of the syntax highlighting than the default theme and some of the other themes. For reference, I also attached a screenshot from the documentation for MAXScript showing that same content. I noticed that many of the methods that are highlighted in the documentation are not highlighted in Obsidian. I guess my question is how can I test the MAXScript syntax highlighting out in its pure implementation so that I can figure out whether it is an issue with Obsidian, the css theme, etc.
I want to again say how much I appreciate what you have done and love the way this is working. But, if those methods are supposed to be highlighted and if there is some way I could tweak the css so that all of the syntax highlighting comes through, I will be the first to dig deep and figure it out because this means a lot to me since I am building a clone of the MAXScript documentation within Obsidian. In the meantime, thanks once more!  I can’t wait for the next release of the desktop version of Obsidian so I can hopefully see the code in all its beautiful colors! Honestly for all I know, the mobile version may just be a work in progress implementation of the updated version of Prismjs, which may explain the discrepancy.
Anyways, sorry for the long read. Keep up the great work!!!!  👍👍

Hi @I-d-as!

how can I test the MAXScript syntax highlighting out in its pure implementation

You can check the raw output of Prism here. Check the "Show tokens" box to see everything Prism produces regardless of the current theme.

I noticed that many of the methods that are highlighted in the documentation are not highlighted

Yes, that's because I couldn't find a good way to detect methods, so they aren't highlighted. The function call syntax for MAXScript is quite complex, so I didn't bother reading the reference regarding this topic.
That being said, since there is demand for better highlighting, I'll give it another go.

authors: I-d-as RunDevelopment


text:
New implementation

now a copy of minecraft-data but with some APIs to modify the data

I don't understand deleting registry.js
Maybe I'm misunderstanding what we're trying to do here. But to me, pris-reg should provide the facilities to create registries. It should not actually be creating those registries. Let mineflayer, bedrock-provider, and other consumers take that step, using the facilities provided here. This also solves this issue of having pris-reg be versioned, there's no reason for it to be versioned if its just a facility provider.
I'll PR with what I mean and we can compare notes

I think the design makes sense
the problem I see with this specific implementation is that this will mutate the cached data loaded in minecraft data package hence not possible to have 2 bots in the same process with the same version but 2 servers providing different biomes

sure, I was thinking per rom's comment that he wanted an API directly like mc-data. So I couldn't think of a better way than just patching copy+patching ontop of mc-data exported data. But I agree for the namesake it does seem a bit odd.
As for mutating, it erases the data before writing new things so that shouldn't be an issue,
    data.biomes = []
    data.biomesByName = {}
    data.biomesArray = []

Maybe I'm misunderstanding what we're trying to do here. But to me, pris-reg should provide the facilities to create registries. It should not actually be creating those registries. Let mineflayer, bedrock-provider, and other consumers take that step, using the facilities provided here. This also solves this issue of having pris-reg be versioned, there's no reason for it to be versioned if its just a facility provider.

I think prismarine-registry should be mostly drop-in to replace mcdata. Regarding where to parse data, curious to see your implementation

As for mutating, it erases the data before writing new things so that shouldn't be an issue,

ah right, perfect then

one thing to keep in mind here is that the data sent in the login dimension codec is not the same schema as the data in minecraft-data

CI is failing

fixed

let's go with that for now, see how things work
we can always migrate to another solution later on @nickelpro

authors: extremeheat nickelpro rom1504

repo: PrismarineJS/prismarine-registry


text:
tensorflow.python.framework.errors_impl.FailedPreconditionError: output/result_dir/train.tf_record; Is a directory

Traceback (most recent call last):
File "BERT_NER.py", line 621, in
tf.app.run()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 299, in run
_run_main(main, args)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 250, in _run_main
sys.exit(main(argv))
File "BERT_NER.py", line 544, in main
train_examples, label_list, FLAGS.max_seq_length, tokenizer, train_file)
File "BERT_NER.py", line 299, in filed_based_convert_examples_to_features
writer = tf.python_io.TFRecordWriter(output_file)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/lib/io/tf_record.py", line 218, in init
compat.as_bytes(path), options._as_record_writer_options(), status)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/errors_impl.py", line 548, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.FailedPreconditionError: output/result_dir/train.tf_record; Is a directory
请问这是怎么回事呢

output/result_dir/手动创建这个路径就行了

repo: ProHiryu/bert-chinese-ner


text:
Indentação

A indentação de 1 espaço é um padrão do projeto?
Por que não usar conforme a pep8 recomenda?
https://www.python.org/dev/peps/pep-0008/#indentation

Usar uma tab!
Eu prefiro tab pelo seguintes motivos:

Configuração.
Suponha que o usuário A goste de trabalha com 2 de espaçamento e o B com 6.
Não sera possível configura o espaçamento de um espaço, mas de tab sim
Tempo e Compatibilidade
Muito editores ainda não tem suporte a criação de 4 espaço com um simples click na tecla de "tab"
Organização
Tamanho
Crie dois arquivos um a.txt (usando espaços) e um b.txt (usando tab) com o mesmo código.

Arquivo
Tamanho
Formatação

a.txt
112KB
Espaço

b.txt
35KB
Tabs

Vídeo engraçado sobre isso
https://www.youtube.com/watch?v=SsoOG6ZeyUI fonte: Série Silicon Valley (Tab vs Espaço)

@TiagoDanin Porém, TAB é interpretado de forma diferente em cada editor de texto / IDE.
Já com spaces, é igual em qualquer editor.

Você pode configurar o tab para usar 4 spaces.

@Pedro-Souza Concordo, mas o @TiagoDanin disse que nem todo editor pode fazer isso.

@TiagoDanin haha boa referência Sillicon Valley é muito bom

authors: Cyr4xd3v Pedro-Souza TiagoDanin dansenpir

repo: Programeiros/TycotBot


text:
support code  Coverage Analytics

What type of PR is this?
as https://github.com/cncf/toc/issues/1413
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:

/lgtm

add test results，Everything is OK

repo: Project-HAMi/HAMi


text:
Interact with location nodes

Background
This PR enables the interaction with the direction boxes added to the scene.
Breaking Changes
The LNToucheDelegate interfaces has been modified to notify the touch event of both an AnnotationNode and a LocationNode, that's represented by the parent of the SCNBox rendered.
The PolylineNode class is enriched with a tag attribute that can be used to identify the touched element.
Meta

Tied to Version Release(s):

Checklist

[ ] Appropriate label has been added to this PR (i.e., Bug, Enhancement, etc.).
[ ] Documentation has been added to all open, and public scoped methods and properties.
[ ] Changelog has been updated
[ ] Tests have have been added to all new features. (not a requirement, but helpful)
[ ] Image/GIFs have been added for all UI related changed.

Screenshots

(Closing the PR for now to do extra local tests)

SCNnode already has a name property that appears to be designed for the very purpose of your tag property.

Hi @Pilot-Marc, I'm reusing the existing tag property of LocationNode for that. In the delegate method, to interact with the selected node, I'm doing something like this:
    func locationNodeTouched(node: LocationNode) {
        guard let name = node.tag else { return }
        guard let selectedNode = node.childNodes.first(where: { $0.geometry is SCNBox }) else { return }
...

The goal of this PR is to basically pass the identifier when generating multiple polylines.

@matsoftware I was working on the same issue, detecting what node I was tapping on, but you beat me to it.

@aaronbrethorst / @Pilot-Marc Changelog and README updated

@matsoftware - could you resolve the merge conflicts, please?

Changes pushed @intere

authors: Pilot-Marc intere matsoftware

repo: ProjectDent/ARKit-CoreLocation


text:
Codeabfrage 'ist User in einem Lernraum' Anforderung

User Story
Akzeptanzkriterien

[ ] Bestehende Anforderungen sind verlinkt

Definition of Ready

[ ] User Story ist klein genug für Sprint
[ ] User Story ist für jeden beteiligten Entwickler klar verständlich
[ ] User Story Aufwand ist geschätzt
[ ] User Story hat Akzeptanzkriterien
[ ] User Story hat einen Mehrwert für das Produkt oder die Entwicklung
[ ] User Story Ursprung ist bekannt (Stakeholder)
[ ] User Story ist Release zugewiesen

Definition of Done

[ ] Alle Akzeptanzkriterien sind erfüllt
[ ] ZenHub Tasks sind gecheckt
[ ] Wiki ist gecheckt
[ ] Anforderungen mit IDs sind erstellt
[ ] Glossar verlinkt und gegebenenfalls erweitert
[ ] Aktivitätsdiagramm (falls nötig) ist erstellt
[ ] Unit-Tests sind zugewiesen
[ ] Fehlende Unit-Tests sind dokumentiert
[ ] Review wurde durchgeführt

Hey team! Please add your planning poker estimate with Zenhub @DerKatsche @Grunick @Lizardguard @mountler @splican

authors: AdLer-Lukas Lizardguard


text:
Escape 'complex characters' characters in SurrealThing Key

This fixes keys such as Guids failing
As per documentation
https://surrealdb.com/docs/surrealql#:~:text=Alternatively complex characters within record IDs can be surrounded by the ⟨ and ⟩ characters

yeah, no problem. sounds like a plan.


text:
No changelog updates since v0.7.9

Would be great to see all changes in the changelog.

+1 was just about to type the same thing. What breaking changes happened in 1.0.0?

Ah actually I just realised it's in github releases https://github.com/ProseMirror/prosemirror-tables/releases

repo: ProseMirror/prosemirror-tables


text:
Fix finicky resize handle

The original pull request link address is https://github.com/ProseMirror/prosemirror-tables/pull/99

Didn't anyone handle it?

@ocavue Excuse me, do you have time?

@wang1xiang Thanks for your contribution!

authors: icode ocavue wang1xiang


text:
修正 errcheck

👏 解決掉的 issue / Resolved Issues

close #93

📝 相關的 issue / Related Issues

#90

⛏ 變更內容 / Details of Changes
修正 errcheck，主要分為兩大塊

ResponseWriter
Json

移除了空白

repo: Ptt-official-app/Ptt-backend


text:
Add product tour

Overview
This PR adds a product tour for new users that explains redistricting and DistrictBuilder basics.
Checklist

[x] Description of PR is in an appropriate section of CHANGELOG.md and grouped with similar changes, if possible

Demo

Notes

For some reason, having the tour start not-centered is causing issues with the map. It looks like the map canvas is accounting for a scrollbar that isn't there:

Unfortunately, even when the tour ends the spacing remains. It only goes away if you resize the browser, and I tried a bunch of different things to resolve it but the only thing that worked was centering the first step. As a result in this PR that's what I've done:

Let me know if you'd still prefer to have it in the corner.
Unless we use custom components, we don't seem to have a ton of styling options for the buttons. Most notably, the focus state is using the browser default. I got as close to our button / links styles as possible.
There is by default an X in the top-right corner of Joyride Tours, but it didn't act the way I expected (clicking the X proceeds to the next step, but I expected it to skip the tour) so I hid it.

Testing Instructions
Notes for testing:

You will need 3 user accounts, each with at least 1 project, for testing.
There are server changes as whether a tour has been seen or not is attached to a user's account, so you will need this to be up-to-date.

Instructions:

git pull
Run yarn install to get the the joyride package
Log into your 1st account.
Enter any map project. You should see the tour.
Click "Next" and go through each step of the tour.
On step 7, you'll be instructed to click on the map. Select some counties on the map -- this should be possible.
On step 7, you'll be instructed to click "Accept". Select "Accept" -- this should be possible.
When you are finished, refresh the page or enter another project. The tour should not appear.
Log into your 2nd account.
Enter a project. You should see the tour. Now click "No thanks" on the first step of the tour.
Refresh the page or enter another project. You should not see the tour.
Log into your 3rd account.
Enter a project. You should see the tour. Proceed through the tour, and at some point click "Skip tour".
Refresh the page or enter another project. You should not see the tour.
Copy/paste the map's url into an incognito browser window. You should not see the tour.

Closes #433

The sixth step is showing up below the fold for me (in Firefox on Linux):

Happens for me too on Chrome on a Mac.

So good! Here are a few bits of feedback.
For readability and accessibility, consider left-aligning blocks of text.  In my opinion, the centered text works fine on that first step with Mandy, but I'd switch to left for the other steps.
For the step about selecting a county on the map: when I wrote that, I wasn't thinking about having it be an interactive step. But I like it how you have it set up! To reinforce the interaction, I think it might be helpful to add some extra copy to make it more clear that we're hoping the user will interact with map right now, as opposed to after the tour when they're building the map. I'm thinking something like "Try it now" with a slightly different formatting, such as: Try it now: click on a county ...

For the step about the entire district sidebar, I think it might work better if the tour were anchored more towards the top of the sidebar instead of the vertical middle. On a map with fewer districts, it can look like the arrow is pointing at a blank space. I think this is minor, so if it's not an easy fix, I wouldn't worry about it.

Hey @alexelash I think I got the first step of the tour working in the bottom right corner. The trick seems to be adding a new element to the page that has a not-small width. I ended up with a 300px width transparent rectangle, which seems to work consistently on Firefox and Chrome.
https://github.com/PublicMapping/districtbuilder/tree/feature/jdf/product-tour

@kshepard & @jfrankl Step 6 should be fixed -- I checked in Firefox and Edge (I just needed to reduce the width of the step):

Jeff and I also worked together to figure out the spacing issue for the first step, so it now starts in the bottom right again. It required a combination of removing the code that initialized the tour after the map loads AND what Jeff suggested in a comment above:

I moved step 4 to appear near the top of the sidebar:

Jeff: the first three steps looked better centered to me (since the second 2 are centered on the screen), so I kept those centered and all else is left-aligned.
This is ready for another look.

Two small things:
This screen refers to the population for D1 increases, but the tour covers it up so you can't see it. I think anchoring this on the bottom or maybe middle would fix the issue.

In other circumstances I would like this "try it now" message. However, in this case, it's a little tricky in the app to make changes once you accept them. You'd either need to access the undo button or switch to the null district and re-select and accept. It's not impossible, but it's enough that I don't want to make as strong of a push to get users to press Accept at this stage. I want them to know about it, though. Suggested fix: just remove the try it now.

@kshepard Makes sense. Should I make an issue for that, or will that be internally tracked?
@jfrankl Thanks, I made those adjustments:

It'd be great if you can add an issue for tracking that, thanks.

@kshepard cool just created #475 for that. Thanks!

authors: alexelash jfrankl kshepard

repo: PublicMapping/districtbuilder


text:
🛑 XBackBone is down

In ce2a256, XBackBone (https://share.pxlbuzzard.com) was down:

HTTP code: 0
Response time: 0 ms

Resolved: XBackBone is back up in 3f8d413.

repo: PxlBuzzard/upptime


text:
Update profitableGamble.cpp

changed the return type of function
Description
enter here if you have any details
Program Name -   profitableGamble.cpp
Issue No.- #

Type issue number after hash(#)

Checklist(self check)

[ ] Yes, this task assigned to me.
[x] My code follows the style guidelines(Clean Code) of this project
[x] I have performed a self-review of my own code
[x] My Filename is in camelCase format
[x] I have added Problem statement, Problem link in file.

unassigned task

authors: SanyuktaSaha aayushi-droid

repo: Py-Droid/Edabit-Solutions


text:
Task call parsing failure

Unable to parse task calls using pyverilog.
Failure signature: (fail.log)
Syntax error
Traceback (most recent call last):
  File "task_parse.py", line 5, in <module>
    ast, direct = parse(vfiles, [], [])
  File "/home/vdodeja2/.local/lib/python3.7/site-packages/pyverilog/vparser/parser.py", line 2322, in parse
    ast = codeparser.parse()
  File "/home/vdodeja2/.local/lib/python3.7/site-packages/pyverilog/vparser/parser.py", line 2300, in parse
    ast = self.parser.parse(text, debug=debug)
  File "/home/vdodeja2/.local/lib/python3.7/site-packages/pyverilog/vparser/parser.py", line 77, in parse
    return self.parser.parse(text, lexer=self.lexer, debug=debug)
  File "/home/vdodeja2/.local/lib/python3.7/site-packages/pyverilog/vparser/ply/yacc.py", line 265, in parse
    return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
  File "/home/vdodeja2/.local/lib/python3.7/site-packages/pyverilog/vparser/ply/yacc.py", line 1047, in parseopt_notrack
    tok = self.errorfunc(errtoken)
  File "/home/vdodeja2/.local/lib/python3.7/site-packages/pyverilog/vparser/parser.py", line 2272, in p_error
    self._coord(p.lineno))
  File "/home/vdodeja2/.local/lib/python3.7/site-packages/pyverilog/vparser/plyparser.py", line 55, in _parse_error
    raise ParseError("%s: %s" % (coord, msg))
pyverilog.vparser.plyparser.ParseError: :25: before: (

Verilog code: (task_example.v)
module task_example ();

  reg [7:0] r_Mux_Addr_Data = 0;
  reg       r_Addr_Valid = 1'b0;
  reg       r_Data_Valid = 1'b0;

  task do_write;
    input [7:0] i_addr, i_data;
    begin
      // demonstrates driving external Global Reg
      r_Addr_Valid    = 1'b1;
      r_Mux_Addr_Data = i_addr;
      #10;
      r_Addr_Valid    = 1'b0;
      r_Data_Valid    = 1'b1;
      r_Mux_Addr_Data = i_data;
      #10;
      r_Data_Valid = 1'b0;
      #10;
    end
  endtask

  always @(*)
    begin
      #10 do_write(8'h01, 8'hBC);
      //do_write(8'h01, 8'hBC);
      //do_write(8'h02, 8'hCD);
    end

endmodule

Python script to parse the verilog (task_parse.py)
from pyverilog.vparser.parser import parse

vfiles = ["./task_example.v"]

ast, direct = parse(vfiles, [], [])

ast.show()

Environment:
OS: Ubuntu 18.04.5 LTS
Python version: 3.7
PyVerilog version: 1.2.1
Attaching above files:
task_failure.zip

Task-call statement support is under development with SystemVerilog support on feature_systemverilog branch. Stay tuned!

authors: VibhorDodeja shtaxxx

repo: PyHDI/Pyverilog


text:
check changelog using nox

I wanted to get the green tick when the CI-skip-changelog label was applied 😝
... and I didn't think it hurt to use the same tech we use for the rest of the pipeline.

bors r=messense

bors r+ p=1

bors retry

bors r=messense

(I think what happened here is that the unicode emoji was blowing up with Windows file encodings, let's see if this passes now I removed it...)

authors: davidhewitt messense


text:
docs: semantic change typo

Thank you for contributing to PyO3!
By submitting these contributions you agree for them to be dual-licensed under PyO3's MIT OR Apache-2.0 license.
Please consider adding the following to your pull request:

an entry for this PR in newsfragments - see [https://pyo3.rs/main/contributing.html#documenting-changes]

or start the PR title with docs: if this is a docs-only change to skip the check

docs to all new functions and / or detail in the guide
tests for all new or changed functions

PyO3's CI pipeline will check your pull request, thus make sure you have checked the Contributing.md guidelines. To run most of its tests
locally, you can run nox. See nox --list-sessions
for a list of supported actions.

I'm reasonably certain this is not a typo, why do you think it is?

Sorry, perhaps I was hasty with my change, but this sentence threw me and still does.
Perhaps necessary should be changed to sufficient?
When would  a Py<T> not be necessary for lifetime reason?
Happy to close, forget, and apologize for jumping to conclusions.

Py<T> is "easier" to work with, because it does not carry a lifetime around. That is useful for storing in other pyclasses or long lived structs in general.
The sentence is correct, but maybe this version is better to understand?
"This means that Bound<'py, T> should usually be used whenever carrying this lifetime is acceptable, and Py<T> otherwise."

This is clearer to me.
Thanks!

"This means that Bound<'py, T> should usually be used whenever carrying this lifetime is acceptable, and Py<T> otherwise."

Changed commit to use this wording.

authors: alex birkenfeld digitalsentinel dsentinel


text:
Add an option to use Huggingface metrics

🚀 Feature
Support Huggingface metrics.
Motivation
Torchmetrics are great, but there are many metrics that are not publicly available. Luckily, Huggingface implemented lots of them. Can you please an easy way to add metrics from Huggingface?
Pitch
Specifying a metric from Huggingface, making sure I give it the correct arguments without needing to implement it on my own.

@yuvalkirstain I think this is a great idea! But after adding a metric to torchmetrics (link), I'll be the first to say that this might be a little tricky. There's a lot refactoring going on.

How did we want to swap metrics? I'm imagining that in the yaml, it looks like:
metrics:
  accuracy:
    path: torchmetrics.Accuracy
  recall:
    path: torchmetrics.Recall

And we can swap it by switching it to:
metrics:
  accuracy:
    path: datasets.metrics.Accuracy
  recall:
    path: datasets.metrics.Recall

If there's a custom metric, we can format it like:
metrics:
  MyCustomMetric:
    path: abs/path/to/metric.py

Where it tries to import MyCustomMetrics from abs/path/to/metric.py
Also, with a few metrics, the targets/preds order are switched or are in the process of being switched. So it might be good to generalize metric as a dataclass, just like what HuggingFace is doing, where the output is a callable dictionary. All thoughts on this are welcome!

@mathemusician with only looking at the huggingface metrics API, I think it should be relatively easy to give an adapter for that like this:
class HFMetricAdapter(torchmetrics.Metric):
    def __init__(self, hf_metric):
        super().__init__()
        self.hf_metric = hf_metric

    def update(self, *args, **kwargs):
        self.hf_metric.add_batch(*args, **kwargs)

    def compute(self):
        return self.hf_metric.compute()

That being said, I don't know much about huggingface metrics and therefore I am not sure, whether all the magic torchmetrics does in the background to properly sync and accumulate the metrics state across different GPUs (which would be required for correctness when training on multiple GPUs) will work. For that to work, huggingface would have to take care of that.
@yuvalkirstain @mathemusician
What Metrics specifically would you like to see? Maybe we can add more of them to torchmetrics for a more native experience?

@justusschock Good point. It might actually be easier to migrate as many metrics from HuggingFace, then use our hooks, rather writing workarounds for using someone else's hooks. @yuvalkirstain Any thoughts?

@mathemusician @justusschock
Huggingface metrics is very popular and might have metrics that can not be found in TorchMetrics, or implementations that slightly differ from those found in TorchMetrics. Additionally, people will probably add new metrics to Huggingface metrics. Therefore, I really like the HFMetricAdapter workaround. I find this to be an orthogonal effort to adding more metrics to TorchMetrics.

@mathemusician @justusschock
Huggingface metrics is very popular and might have metrics that can not be found in TorchMetrics, or implementations that slightly differ from those found in TorchMetrics. Additionally, people will probably add new metrics to Huggingface metrics. Therefore, I really like the HFMetricAdapter workaround. I find this to be an orthogonal effort to adding more metrics to TorchMetrics.

@yuvalkirstain Understood, as stated, with this adaptor we, however, cannot guarantee that everything works fine regarding synchronization.
And if we start implementing new torchmetrics Metrics now, I think there is a high chance that new metrics can be implemented to it quickly as well. I see a huge benefit there, because this is not tied to one ecosystem.

@justusschock Yes, I understand. Thank you so much for the help.

repo: PyTorchLightning/lightning-transformers


text:
PearsonCorrcoef will break when single sample is passed at a time.

🐛 Bug

When passing a single sample at a time to the PearsonCorrcoef metric it will crash. I am not sure if this is the intended behavior but it causes problems for big models training with batch size of one.
To Reproduce
import torchmetrics
correlation = torchmetrics.PearsonCorrcoef()

# Works
correlation.update(torch.tensor([0.3, 0.7, 0.9]), torch.tensor([0.4, 0.5, 0.4]))
correlation.compute()

# Crashes
correlation.update(torch.tensor([0.3]), torch.tensor([0.4]))
correlation.update(torch.tensor([0.7]), torch.tensor([0.5]))
correlation.update(torch.tensor([0.9]), torch.tensor([0.4]))
correlation.compute()

Error Message:
RuntimeError: zero-dimensional tensor (at position 0) cannot be concatenated

@Borda #229 is in v3.2.0 (https://github.com/PyTorchLightning/metrics/commits/v0.3.2), but the issue isn't fixed:
import torch
import torchmetrics

print(torch.__version__)
print(torchmetrics.__version__)

correlation = torchmetrics.PearsonCorrcoef()

correlation.update(torch.tensor([0.3]), torch.tensor([0.4]))
correlation.update(torch.tensor([0.7]), torch.tensor([0.5]))
correlation.update(torch.tensor([0.9]), torch.tensor([0.4]))
correlation.compute()

Output:
1.8.0
0.3.2
/shared/raimis/opt/miniconda/envs/tmp/lib/python3.8/site-packages/torchmetrics/utilities/prints.py:36: UserWarning: Metric `PearsonCorrcoef` will save all targets and predictions in buffer. For large datasets this may lead to large memory footprint.
  warnings.warn(*args, **kwargs)
Traceback (most recent call last):
  File "bug.py", line 12, in <module>
    correlation.compute()
  File "/shared/raimis/opt/miniconda/envs/tmp/lib/python3.8/site-packages/torchmetrics/metric.py", line 251, in wrapped_func
    self._computed = compute(*args, **kwargs)
  File "/shared/raimis/opt/miniconda/envs/tmp/lib/python3.8/site-packages/torchmetrics/regression/pearson.py", line 95, in compute
    preds = torch.cat(self.preds, dim=0)
RuntimeError: zero-dimensional tensor (at position 0) cannot be concatenated

repo: PyTorchLightning/metrics


text:
BYOL: Move unnecessary dependencies to "if name == 'main'" section

Move imports, to the "if name == 'main' section.
What does this PR do?
Avoids importing unnecessary stuff, among them a cv2 import via the SimCLR transform modules, when importing BYOL

Hello @sorenrasmussenai! Thanks for opening this PR.

In the file pl_bolts/models/self_supervised/byol/byol_module.py:

Line 186:121: E501 line too long (122 > 120 characters)
Line 188:1: W293 blank line contains whitespace

Do see the Hitchhiker's guide to code style


text:
Fix pre-commit isort failure on tests/trainer/*.py

What does this PR do?

Relates to #4805
Before submitting

[x] Was this discussed/approved via a GitHub issue? (not for typos and docs)
[x] Did you read the contributor guideline, Pull Request section?
[x] Did you make sure your PR does only one thing, instead of bundling different changes together?
[ ] Did you make sure to update the documentation with your changes? (if necessary)
[ ] Did you write any new necessary tests? (not for typos and docs)
[ ] Did you verify new and existing tests pass locally with your changes?
[ ] Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review
Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:

[ ] Is this pull request ready for review? (if not, please submit in draft mode)
[ ] Check that all items from Before submitting are resolved
[ ] Make sure the title is self-explanatory and the description concisely explains the PR
[ ] Add labels and milestones (and optionally projects) to the PR so it can be classified
[ ] Check that target branch and milestone match!

Did you have fun?
Make sure you had fun coding 🙃

Please merge first #5420

Please merge first #5420

@arnaudgelas it seems you introduced cumulative change from other PR, mind keep the change only to files mentioned in the PR, so here it is tests/trainer/*.py

@arnaudgelas it seems you introduced cumulative change from other PR, mind keep the change only to files mentioned in the PR, so here it is tests/trainer/*.py

Please merge first #5420

pls make the changes independent, there is no reason why it shall be cumulative and we would need to rebase each PR

Please merge first #5420

pls make the changes independent, there is no reason why it shall be cumulative and we would need to rebase each PR

@Borda Once #5420 gets merged, I will rebase that one.

@Borda Once #5420 gets merged, I will rebase that one.

@Borda rebased

@Borda rebased

@Borda The 2 commits are atomic and meaningful as such. I don't get why you want to squash them? I though that was one of your requirement, squashing them together is going the other way around, isn't it?

@Borda The 2 commits are atomic and meaningful as such. I don't get why you want to squash them? I though that was one of your requirement, squashing them together is going the other way around, isn't it?

authors: Borda arnaudgelas

repo: PyTorchLightning/pytorch-lightning


text:
download youtube audio

Description
Accept YouTube video link and download audio file

Type of issue

[X] Feature (New Script)
[x] Bug
[x] Documentation

Checklist:

[x] I have read the project guidelines.
[x] I have checked all the existing projects, before submitting a new project issue.
[x] I have checked previous issues to avoid duplicates.
[x] This issue will be meaningful for the project.

I can do this. Can you assign me this issue?

I would like to work on this.

I would like to work on this, i have previousely worked on python projects related to audio seperation from videos and have created plugins

I would like to work on this, i have previousely worked on python projects related to audio seperation from videos and have created plugins

This issue has been assigned already

@AdityaJ7 Thank you for assigning me! I have started working on it, I think this project will need some time, what is the time limit for completing this? I'll update you regularly.

Hey, I'd love to do this task!

@AdityaJ7 Thank you for assigning me! I have started working on it, I think this project will need some time, what is the time limit for completing this? I'll update you regularly.

Complete before 7 days

Hey, I'd love to do this task!

Hi @Vyprath thanks for showing interest in this issue but it has already been claimed by someone else, please check other unclaimed issue or create your own issue if you think our repos are , missing any script
Thanks

@AdityaJ7 Thank you for assigning me! I have started working on it, I think this project will need some time, what is the time limit for completing this? I'll update you regularly.

Complete before 7 days

Yes, I think that is enough!

Please give me some more time.

I have submitted a pull request. Please check and sorry for the delay.


text:
运行过程中会出现如下错误，求帮助解决

兄弟，检查一下文件requirements.txt里面的插件是否都下载安装好了，最后启动docker再试一遍。

我也遇到了这个问题，
Complete output (3 lines):
Building lxml version 4.6.3.
Building without Cython.
Error: Please make sure the libxml2 and libxslt development packages are installed.

现在已经修改成拉取我 build 好的镜像，可以重新试试。

authors: Germey ariesljm songzih zyj957


text:
"Could not load type 'Q42.HueApi.LocalHueClient'" when running with mono

My application is a console application and everything works correctly when running on windows(10), however when I attempt to run the same build with mono I get the following error:
Unhandled Exception: System.TypeInitializationException: The type initializer for 'com.LuminousVector.Karuta.Karuta' threw an exception. ---> System.TypeLoadException: Could not load type 'Q42.HueApi.LocalHueClient' from assembly 'Q42.HueApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.   at com.LuminousVector.Karuta.Karuta.RegisterCommands () <0x40df24c0 + 0x00213> in <filename unknown>:0   at com.LuminousVector.Karuta.Karuta..cctor () <0x40dcd5f0 + 0x002ef> in <filename unknown>:0   --- End of inner exception stack trace ---   at com.LuminousVector.Karuta.Program.Main () <0x40dccd50 + 0x00033> in <filename unknown>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'com.LuminousVector.Karuta.Karuta' threw an exception. ---> System.TypeLoadException: Could not load type 'Q42.HueApi.LocalHueClient' from assembly 'Q42.HueApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.   at com.LuminousVector.Karuta.Karuta.RegisterCommands () <0x40df24c0 + 0x00213> in <filename unknown>:0   at com.LuminousVector.Karuta.Karuta..cctor () <0x40dcd5f0 + 0x002ef> in <filename unknown>:0   --- End of inner exception stack trace ---   at com.LuminousVector.Karuta.Program.Main () <0x40dccd50 + 0x00033> in <filename unknown>:0
The package was installed via NuGet and I've tried reinstalling, rebuilding as release/debug and nothing makes a difference, it doesn't load on mono. First I should ask if this project normally works correctly with mono and if so, is there a solution to this?
My project is .Net 4.6.1, Console Application, Any CPU
You can find my project here if there's anything you want to double check, and the class specifically that uses this project.

I've seen a mono project that works with this library in the past. So I guess it can work. But I haven't tested it and I'm not sure everything works with mono.
You can check out the source for Q42.HueApi, build it against mono and maybe figure out what's wrong?

Hi there, i had the exact same problem and was able to solve this with the following steps:

If you are using the api within a library or a subpackage, make sure that you install the Q42 nuget package in all those Projects and the main Project referencing the DLLs.
I did update the Microsoft.Bcl.Build package to Version 1.0.21 (restart your IDE if requested..), but i am not sure if this step is necessary. You could first skip this step if you like and try later if it still fails..
Important: you have to insert a binding redirection in your app.config file (the main app.config file for the application which is run by Mono!) I am targeting .Net 4.5, so maybe you have to adapt the following to 4.6, but try this first:

<configuration>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

If all dependencies are correctly configured the dlls "System.Net.Http.Primitives.dll" and "System.Net.Http.Extensions.dll" should be copied in the Bin dir, but the other System.Net.Http.*.dll should NOT (These are loaded from the GAC).

I am successfully running the Api on a Raspberry 2 with mono 4.4.2.
Hope i could help... ;)

Thank you so much, that worked!!! How did you figure out that this was the cause?

Nice, glad i could help! :)
I figured it out with a lot of pain and trial and error (setting MONO_LOG_LEVEL=debug and trying to understand whats going wrong), but at the end it was Visual Studio which helped me: there was a warning about different versions of System.Http.Net mapped and a hint to add a binding redirect. Luckily there was an option within the hint to automatically generate and insert this into app.config. Otherwise i wouldn't have known that..
I should have paid attention to that warning earlier on ;)
Although i am still not knowing exactly WHY there is this version conflict and how i could have noticed this by myself..
Happy coding...

Thanks, this might help me in the future if I encounter similar issues.

authors: TheDarkVoid michielpost spacepope


text:
doNd: Integers are converted to floats

Steps to reproduce

Have two parameters, one that has float values, and one that has validator Ints
Try to do a 2D sweep of the two parameters using dond

Expected behaviour
The sweep should work normally
Actual behaviour
TypeError, because dond is trying to set the integer parameter to a float value.
Minimal working example
import qcodes as qc
from qcodes.utils.validators import Ints
from qcodes.utils.dataset.doNd import dond, ArraySweep

qc.config.core.db_location = "./test.db"

qc.load_or_create_experiment("test")

float_param = qc.ManualParameter("float_param")
int_param = qc.ManualParameter("int_param", vals=Ints(0, 100))

dond(
    ArraySweep(float_param, [1.1, 2.2, 3.3]),  # if I comment out this line, works OK
    ArraySweep(int_param, [1, 2, 3]),
) # -> TypeError: ('1.0 is not an int; Parameter: int_param', 'setting int_param to 1.0')

Tested on qcodes v0.33.

@mgunyho would it be a decent workaround for you to pass a numpy array of ints to ArraySweep as opposed to list of ints? the challange is that whatever you pass gets transofmed into a numpy array, and i guess list of ints also gets transformed to an array of floats.

The same happens if I pass it as a numpy array (either np.array([1,2,3]) or more explicitly np.array([1,2,3], dtype=np.int)). It also doesn't matter whether the float or int array is first. I didn't check what dond does internally but seems like it's coercing all of the arrays to the same datatype. Maybe using a pandas dataframe (or separate arrays for each param value) would work better with heterogeneous types.
For now my workaround was to just do a for-loop over the int-value (so one measurement for each) because I didn't have that many of them, but that's not very good in the long run.

I think the issue is that do_nd bundles all the setpoints into one array (look at the implementation of _flatten_setpoint_values
I will see if I can have a look at that as part of #4325

@mgunyho I have added a test to https://github.com/QCoDeS/Qcodes/pull/4325 based on your original issue confirming that this has been resolved by the refactor in that pr. I have also clarified the types of the setpoints in LinSweep clarifying that this can only generate float setpoints

So the test is now
def test_sweep_int_vs_float():

    float_param = ManualParameter("float_param", initial_value=0.0)
    int_param = ManualParameter("int_param", vals=Ints(0, 100))

    dond(ArraySweep(int_param, [1, 2, 3]), float_param)

I actually had something slightly different in mind with this issue. My problem originally was that I was trying to do a 2D sweep where one of the axes is an integer, and another one is float. The MWE is missing the parameter to be measured, this is what it should have been:
import qcodes as qc
from qcodes.utils.validators import Ints
from qcodes.utils.dataset.doNd import dond, ArraySweep

qc.config.core.db_location = "./test.db"

qc.load_or_create_experiment("test")

float_param = qc.ManualParameter("float_param")
int_param = qc.ManualParameter("int_param", vals=Ints(0, 100))
acquisition_param = qc.ManualParameter("thing_to_be_measured", initial_value=123)  # the parameter we're going to measure

dond(
    ArraySweep(float_param, [1.1, 2.2, 3.3]),
    ArraySweep(int_param, [1, 2, 3]),
    acquisition_param,  # this was missing
) # -> ValueError: 1.0 is not an int

But in any case, the issue is indeed fixed by the refactor.
While testing this, I noticed another bug: the original MWE, without the acquisition_param, where I accidentally forgot to add the parameter to be acquired causes an UnboundLocalError:
UnboundLocalError                         Traceback (most recent call last)
.../arraysweep_int_test.py in <module>
     14
     15
---> 16 dond(
     17     ArraySweep(float_param, [1.1, 2.2, 3.3]),  # if I comment out this, works OK
     18     ArraySweep(int_param, [1, 2, 3]),

.../Qcodes/qcodes/dataset/dond/do_nd.py in dond(write_period, measurement_name, exp, enter_actions, exit_actions, do_plot, show_progress, use_threads, additional_setpoints, log_info, break_condition, dataset_dependencies, *params)
    552     sweeper = _Sweeper(sweep_instances, additional_setpoints)
    553
--> 554     measurements = _Measurements(measurement_name, params_meas)
    555
    556     LOG.info(

.../Qcodes/qcodes/dataset/dond/do_nd.py in __init__(self, measurement_name, params_meas)
    218             self._grouped_parameters,
    219             self._measured_parameters,
--> 220         ) = self._extract_parameters_by_type_and_group(params_meas)
    221         self.measurement_names = self._create_measurement_names(measurement_name)
    222

.../Qcodes/qcodes/dataset/dond/do_nd.py in _extract_parameters_by_type_and_group(params_meas)
    274         if multi_group:
    275             grouped_parameters = tuple(multi_group)
--> 276         return tuple(measured_all), grouped_parameters, tuple(measured_parameters)
    277
    278

UnboundLocalError: local variable 'grouped_parameters' referenced before assignment

I suppose if the *args are only Sweep:s, and none are parameters, there should be an error message indicating that the measurement parameters are missing. (This is on version 0f54cf2f15)

To clarify, here's a failing test for this:
def test_dond_without_measurement_params():
    a = ManualParameter("a", initial_value=0)

    with pytest.raises(
        ValueError
    ):
        dond(ArraySweep(a, [1, 2, 3]))

Thanks I agree that we should give a better error message when there is no parameter to measure.

authors: astafan8 jenshnielsen mgunyho

repo: QCoDeS/Qcodes


text:
add vs code temp files to gitignore

sorry, I should have all done it in one PR.... I guess

👍 Yes @Dominik-Vogel I agree

authors: Dominik-Vogel jenshnielsen


text:
MasterObjectPooler.DestroyPool throws an error

Can't destroy Transform component of 'EnemyBarnaclePool Pool'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.

Should be destroying the GameObject instead of the transform

This should now be fixed and will be released with V1.0.2


text:
BUG: ImportError: libGL.so.1: cannot open shared object file: No such file or directory

Thanks for providing version 2 of your fantastic tool MOOSE!
When following your installation instructions and finally starting moose via:
moosez -h
I received the following error:
Traceback (most recent call last):
  File "/home/[...]/MOOSE2.0/moose-env/bin/moosez", line 5, in <module>
    from moosez.moosez import main
  File "/home/[...]/MOOSE2.0/moose-env/lib/python3.9/site-packages/moosez/__init__.py", line 7, in <module>
    from . import moosez
  File "/home/[...]/MOOSE2.0/moose-env/lib/python3.9/site-packages/moosez/moosez.py", line 36, in <module>
    from moosez import image_processing
  File "/home/[...]/MOOSE2.0/moose-env/lib/python3.9/site-packages/moosez/image_processing.py", line 32, in <module>
    import cv2
  File "/home/[...]/MOOSE2.0/moose-env/lib/python3.9/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/home/[...]/MOOSE2.0/moose-env/lib/python3.9/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/software/all/Anaconda3/2021.11/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

I am working remotely via SSH on a supercomuting cluster. I believe the error is generated via the opencv-python which installs GUI functionality.
I could fix the error by installing:
pip install opencv-python-headless
opencv-python-headless is a version of opencv-python that doesn't include the GUI features, so it also doesn't depend on the graphics libraries. It seems to be a good solution for setups that don't have a full graphical environment.

Hi @rullator, many thanks for pointing out the issue and also fixing it 👍🏾! Did you also check it in a Gui-environment? Just asking, because we need to make sure, it works in both the cases. It's OK if you haven't, just let us know so that we can run some tests, before making a PR! Thanks again for the find 🥇

No, I didn't test it in GUI environment.. just command line :)

@mprires can you please test this in windows environment? And see after @rullator's suggested change nothing breaks.

I can confirm nothing breaks in Linux. @mprires whenever you have time, run it in windows.

I tested it and the fix also works in GUI environment! Thank you for the find :)

authors: LalithShiyam mprires rullator

repo: QIMP-Team/MOOSE


text:
R0.3

I was getting an import error without this change.

please nevermind, delete this if possible, wrong branch!

repo: QISKit/qiskit-sdk-py


text:
Tab Separator not showing with containers

Hello,
first of all I would like to show appreciation for the tab shape of
userChrome.TabCorners.Option10.Enabled
since I read that some shape may be removed based on appreciation I thought it was a good idea to let you know that I really appreciation this option (I think this was the previous "edge" style)
After this, I would like to report that tab separators don't seem to work between containers tabs (they don't show) even if
userChrome.TabSeparatorsMediumSaturation-Enabled
is enabled.
My system info are:
FF113 stable release channel
Win10 22h2
Oh, and one last question: where is the folder named "v1.6.116" that is present in the .zip file of the 113 release supposed to go? in the chrome folder as usual?
Thanks for making WaveFox, I really appreciate your hard work!

I originally wanted to keep all the changes for v1.6.116, but later changed my mind, as users of Firefox 115 ESR will have to use the style for more than a year. To reduce fragmentation between styles, I decided to make the changes that are possible in v1.6.114. This version will most likely become v1.6.115 ESR. I want to use a month in reserve to find bugs and fix them. In v1.6.116 it is planned to remove support for Windows 7/8 and ecotic tab layouts. Everything else has already been removed in v1.6.114. As for the tab separators, they should not be displayed if the container is active, since the containers already have a background.

I originally wanted to keep all the changes for v1.6.116, but later changed my mind, as users of Firefox 115 ESR will have to use the style for more than a year. To reduce fragmentation between styles, I decided to make the changes that are possible in v1.6.114. This version will most likely become v1.6.115 ESR. I want to use a month in reserve to find bugs and fix them. In v1.6.116 it is planned to remove support for Windows 7/8 and ecotic tab layouts. Everything else has already been removed in v1.6.114.

I see, it makes sense! That a nice way of thinking in my opinion!

As for the tab separators, they should not be displayed if the container is active, since the containers already have a background.

Argh, I have modified the code to disable the container background as that was too colorful for me, do you happen to know if there's any "on the fly" way to have separators showing with containers?
Only if it isn't too much work to think on, of course!

I corrected the description in the release to the current one.

Thanks! I think it will be a great clarification as most stable release channel are approaching to FF113 just today, right now.

If you want, you can put directly into 1.6.114. Although it is marked as beta, I already made all the changes I wanted there. It is fully compatible with version 113 of the browser. The only thing I didn't do was remove the old svg set, but otherwise the style is ready for browser version 114.

Argh, I have modified the code to disable the container background as that was too colorful for me, do you happen to know if there's any "on the fly" way to have separators showing with containers?
Only if it isn't too much work to think on, of course!

Delete this line.

Much appreciated! Thanks a lot!

Argh, I have modified the code to disable the container background as that was too colorful for me
@Minibus93, can you please specify how exactly you achieved this? I don't like coloured container tabs as well.

@QNetITQ Hi! I saw the comment by my notification bar on my phone, but I can't see it anymore so I'm not sure if you still need it (and I'm not sure if I remember it all lol).
Anyway, it was about containers, so sure, I'll try to give as much details as possible on how fir them into WaveFox.
I'm not the author of the code for this style of containers, I just saw them somewhere and frankensteined it into WaveFox (I may have changed something for the FF113 update out of the original code, but that's about it)
Anyway, so:

Delete the "Container Indicators" section in the WaveFox css file;
add this code instead:

/* rework of container style */ .tab-context-line {   order: 1 !important;   opacity: 1 !important;   transition: none !important; }
And it's done.
Hope it's still useful :D

Hey @Minibus93, thanks for the info. Actually, it was me who commented 😅.
I deleted the comment because I was able to fix it myself (well, sort of). I found some css related to the container indicator in the userChrome.css and deleted them. But, your solution is much better. I can't thank you enough for the deatiled response and sorry for causing the confusion.

authors: Minibus93 QNetITQ TerraZ-UO

repo: QNetITQ/WaveFox


text:
Bloat considered helpful :-)

As an elderly ex-C programmer, I share and appreciate the instinct to make everything lean and clean -- so please consider this counter-argument as being offered with a light-hearted spirit.
For me, the mantra "Make it work, make it right and only then make it faster and smaller." took a long time to internalize, but once absorbed it seldom let me down.  It recognizes that in the early days of a project, the scarcest resource is developer time.
With respect to Transcrypt, the scarcest resource is Jacques's time as the prime developer followed by the time of those us making use of what he's developed.  I mention this because I want to distinguish between the case where fully supporting a particular CPython behavior is difficult and time-consuming to implement vs the case where it simply adds size to the generated code.
For the latter case, my own preference would be for Transcrypt to default to full support -- however bloated -- with a path for optimizing when and where it's needed. Think of it as meta-EAFP, if you will.
For the first case, where full support requires too much effort to implement, I'm wondering if some form of  compiler warnings with links to the doc or issues might save time for users of Transcrypt. Perhaps something like:
WARNING: IncompletelyImplemented: strip() Optional arguments not supported. See issue #41

Cheers and thanks once again for developing this incredibly useful application!
Mike

Hmm, pragmas exist for a reason, pragmas could be used (and are being used) to add bloated code where needed (which otherwise, for simple reasons, don't need to exist).. I too think NotImplementedError should be raised on runtime if the code is trying to use something not turned on by pragmas

@the1337guy Agree about pragmas. I like them. I'm just suggesting the defaults should be the unoptimized condition with pragmas and command line switches behaving the way most C compilers do -- no optimization unless you ask for it.
Where possible I'd rather have a compiler warning than a runtime error.  When I'm developing in CPython I keep an IPython session open and do lots of testing of a few lines at a time. That option really isn't easily available for transpiled code and browsers let most errors pass with just a message to the console. I'm not sure I'd ever get anything done without Chrome DevTools and Transcrypt's source maps. Even so, the process of figuring out what went wrong is at least an order of magnitude more effort than debugging most CPython problems.

I'd definitely be for emitting compiler warnings if it could be built, but that would, in my understanding, require a large shift in how the compiler operates.
Right now the compilation / translation is fairly "unknowing" about what code that's supported actually is - it just translates directly to JavaScript stuff and relies on the builtin scopes defining python builtins. There's no way to, say, know whether a variable is a string when there's a some_var.strip() line - the compiler literally doesn't have that information.
I think it would be awesome to build a transpiler / compiler which could have that information, either through analysis or typings, but I don't think it's feasible for Transcrypt to have it without a large paradigm shift.

Indeed this isn't easily solved without the compiler doing a lot more static analysis.
So I'm afraid it's off limits for now...
KR
J

authors: JdeH Michael-F-Ellis daboross the1337guy

repo: QQuick/Transcrypt


text:
Fix segfault in Sales::save() function

If you are trying to save the sales.csv files when there are no transactions we get a segfault. This should instead print an empty sales file that only has it's header.

I was away yesterday and haven't paid very much attention to the Sales stuff, so this may be wildly oversimplifying the issue:
Is it possible that that this for loop starting on line 177 in Sales.cpp:
    for (i = 0; i <= curr_transaction; i++) {
        p_fout << transaction_by_order[i]->sale_id << ',' << transaction_by_order[i]->date << ','
               << transaction_by_order[i]->total_price << ',' << transaction_by_order[i]->num_sales << ','
               << transaction_by_order[i]->buyer << ',' << transaction_by_order[i]->seller << std::endl;
        for (j = 0; j < transaction_by_order[i]->num_sales; j++) {
            if (transaction_by_order[i]->sales[j] != NULL) {
                c_fout << transaction_by_order[i]->sales[j]->sale_id << ','
                       << transaction_by_order[i]->sales[j]->item_id << ','
                       << transaction_by_order[i]->sales[j]->num_sold << ','
                       << transaction_by_order[i]->sales[j]->sale_price << std::endl;
            }
        }
    }

Just needs the condition changed to < curr_transaction?
I could be wrong as I haven't really read through the code -- I just saw this.  If there are 0 transactions, this for loop is gonna run and try to index transactions that don't exist, no?
@vbroda17 @Brenaren

Unless I am mistake, Vincent set curr_transaction to be the last transaction on the list, not one after it. So if we set it to < only it would never print the last transaction. I think a solution would just be to double check that a transaction exists before starting this loop.

authors: Brenaren nshoap-utk

repo: QT-Pies/inventory-project


text:
Recent Solution Submission commit without reloading

Suggestion regarding removing a feature that stops users from committing the latest solution without reloading.
I understand this is done to stop people from making fake commits on their GitHub profiles. But this spoils the user experience more rather than accomplishing the intention. The users who want to add commits would anyway reload and commit.
Also, there are codes available online which add fake commit history on the profile.
Like this: https://github.com/artiebits/fake-git-history
Would be very helpful. Thanks

fixed: #172
Please allow 1-2 days before you see the changes on your browser. Happy new year!

authors: QasimWani yashmardikar

repo: QasimWani/LeetHub