text:
Add util OsResources.resources_for_tx_type

Replaces common idiom. Also move getter after new, which should be the
first function.

Stack:

#1181
#1180
#1179 ⬅
#1178
#1177
#1176
#1175

⚠ Part of a stack created by spr. Do not merge manually using the UI - doing so may have unexpected results.

This change is

Codecov Report
Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (9c6a5eb) 68.91% compared to head (ac0d74a) 68.85%.

Files
Patch %
Lines

crates/blockifier/src/fee/os_usage.rs
80.00%
0 Missing and 1 partial :warning:

Additional details and impacted files
@@                              Coverage Diff                              @@
##           pr/giladchase/gilad/os-resources/67f489ab    #1179      +/-   ##
=============================================================================
- Coverage                                      68.91%   68.85%   -0.06%
=============================================================================
  Files                                             57       57
  Lines                                           7097     7087      -10
  Branches                                        7097     7087      -10
=============================================================================
- Hits                                            4891     4880      -11
  Misses                                          1791     1791
- Partials                                         415      416       +1

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

authors: codecov-commenter giladchase

repo: starkware-libs/blockifier


text:
TransactionExecutionInfo: add serialize

This change is

Codecov Report
Attention: 35 lines in your changes are missing coverage. Please review.

Comparison is base (b602b31) 70.97% compared to head (adb3ecc) 70.74%.

Files
Patch %
Lines

crates/blockifier/src/execution/call_info.rs
0.00%
23 Missing and 6 partials :warning:

crates/blockifier/src/execution/entry_point.rs
33.33%
0 Missing and 2 partials :warning:

crates/blockifier/src/transaction/objects.rs
0.00%
0 Missing and 2 partials :warning:

...ve_blockifier/src/py_transaction_execution_info.rs
0.00%
1 Missing :warning:

crates/native_blockifier/src/py_utils.rs
0.00%
0 Missing and 1 partial :warning:

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1315      +/-   ##
==========================================
- Coverage   70.97%   70.74%   -0.23%
==========================================
  Files          59       59
  Lines        7341     7366      +25
  Branches     7341     7366      +25
==========================================
+ Hits         5210     5211       +1
- Misses       1717     1740      +23
- Partials      414      415       +1

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

source: gharchive/pull-request

license_type: permissive

license_source: github-api


text:
refactor: add class hash to CallContractExecutionError

This change is

Codecov Report
Attention: Patch coverage is 77.77778% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 73.67%. Comparing base (ef7ec7e) to head (8b55de6).

Files
Patch %
Lines

crates/blockifier/src/transaction/transactions.rs
11.11%
6 Missing and 2 partials :warning:

...lockifier/src/execution/deprecated_syscalls/mod.rs
83.33%
0 Missing and 1 partial :warning:

crates/blockifier/src/execution/syscalls/mod.rs
80.00%
0 Missing and 1 partial :warning:

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1681      +/-   ##
==========================================
- Coverage   73.67%   73.67%   -0.01%
==========================================
  Files          59       59
  Lines        8589     8622      +33
  Branches     8589     8622      +33
==========================================
+ Hits         6328     6352      +24
- Misses       1781     1786       +5
- Partials      480      484       +4

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

authors: codecov-commenter zuphitf


text:
Added support for crate keyword

#3178

This change is

where shall I add "test" contract?

maybe we should even disallow the current default

Just curious what is 'current default'? Inside the crate one will be able to use only crate keyword?

repo: starkware-libs/cairo


text:
Prevented starknet plugin from code generation on items not on config.

Fixes #4897

This change is

Also, please doc it where you don't use the filtered iter. Until we fix it in a better way (e.g. allow generation of code inside an item and not only beside it), we need to make sure that new plugins (that will copy code from existing ones) will note this issue and handle it correctly. Use a one sentence summary of our conversation to explain the rule and its rational.

authors: orizi yuvalsw


text:
feat(config): privacy level for config parameters

Pull Request type
Please check the type of change your PR introduces:

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, renaming)
[ ] Refactoring (no functional changes, no API changes)
[ ] Build-related changes
[ ] Documentation content changes
[ ] Other (please describe):

What is the current behavior?

Issue Number: N/A
What is the new behavior?

Does this introduce a breaking change?

[ ] Yes
[ ] No

Other information

This change is

crates/papyrus_config/src/lib.rs line 135 at r1 (raw file):
Previously, yair-starkware (Yair) wrote…
Can this be a member of the content, only in the relevant variants?

This way you wont need the temporary variant and it can just be a bool

authors: yair-starkware yoavGrs

repo: starkware-libs/papyrus


text:
Tracing: open span for monitoring gateway callbacks

Pull Request type
Please check the type of change your PR introduces:

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, renaming)
[ ] Refactoring (no functional changes, no API changes)
[ ] Build-related changes
[ ] Documentation content changes
[ ] Other (please describe):

What is the current behavior?

Issue Number: N/A
What is the new behavior?

Does this introduce a breaking change?

[ ] Yes
[ ] No

Other information

This change is

crates/papyrus_monitoring_gateway/src/lib.rs line 56 at r1 (raw file):
Previously, dan-starkware wrote…
Also not related, can you fix this to something like:
Monitoring gateway is running, listening on - {}.

Note that I instrumented the run_server function, and now the config is a field in the span.
Not sure if the local_addr function might return a different value, but if not I can just remove the addr from the event (otherwise just add it as a field).
wdyt?


text:
release: 1.7.2

:robot: I have created a release beep boop
1.7.2 (2023-01-19)
Performance Improvements

router: add tid to context (6983e60)

This PR was generated with Release Please. See documentation.

:robot: Release is at https://github.com/starudream/go-lib/releases/tag/v1.7.2 :sunflower:

repo: starudream/go-lib


text:
jQuery to 3.5.1 changes in Domoticz beta makes plugin not work in "custom" menu.

Issue description
See this thread for more info:
https://github.com/domoticz/domoticz/issues/4374
Additional information
Zigbee2MQTT version: Latest dev
Python version:3.7.3
Domoticz version:build 2020.2 build12449
Plugin version: latest from git

The issue is now resolved with your fix today. Thank you!

source: gharchive/issue

license: MIT


text:
GUI Select USB port

Hi, Is it possible to integrate a dropdown list in the GUI, same style as the "Permit join" checkbox that goes into the "configuration.yaml" to modify the USB port ? And would it be useful to some of you ?
In my case the CC2531 is sometimes allocated to /dev/ttyACM0 or ACM1.

That wouldn't be possible as it is zigbee2mqtt configuration, not plugin one.
I wouldn't recommend to use syntax like /dev/ttyACM0, you can use /dev/serial/by-id/.... instead

authors: Di-Ny stas-demydiuk


text:
TuYa TS0121_plug

Device description
TuYa TS0121_plug
Zigbee2mqtt page
https://www.zigbee2mqtt.io/devices/TS0121_plug.html
MQTT message with device information
,{"dateCode":"","description":"10A UK or 16A EU smart plug","friendly_name":"Stopcontact","hardwareVersion":1,"ieeeAddr":"0x842e14fffe1395bd","lastSeen":1604583352096,"manufacturerID":4098,"manufacturerName":"_TZ3000_g5xawfcq","model":"TS0121_plug","modelID":"TS0121","networkAddress":58772,"powerSource":"Mains (single phase)","type":"Router","vendor":"TuYa"},
MQTT messages from device
Put here examples of MQTT messages with different states you've received from device, as example
Zigbee2MQTT:info  2020-11-05 14:57:34: MQTT publish: topic 'zigbee2mqtt/Stopcontact', payload '{"current":0,"energy":1.54,"linkquality":63,"power":0,"state":"ON","voltage":239}'

Zigbee2MQTT:info  2020-11-05 14:57:44: MQTT publish: topic 'zigbee2mqtt/Stopcontact', payload '{"current":0,"energy":1.54,"linkquality":63,"power":0,"state":"ON","voltage":239}'

Zigbee2MQTT:info  2020-11-05 14:57:54: MQTT publish: topic 'zigbee2mqtt/Stopcontact', payload '{"current":0.07,"energy":1.54,"linkquality":63,"power":0,"state":"ON","voltage":239}'

MQTT state change commands
Zigbee2MQTT:info  2020-11-05 15:01:53: MQTT publish: topic 'zigbee2mqtt/Garage_Stopcontact', payload '{"current":0,"energy":1.54,"linkquality":63,"power":0,"state":"OFF","voltage":239}'

Please consider switching to the next version of the plugin #458.
Reopen this issue in case of any issues.


text:
Bug: xstate swallows exceptions if there are subscribers

Description
When an exception is thrown in an action, the error is visible and reported, unless there are subscribers to the state machine.
If there are subscribers, then the machine is simply stopped without any output.
Expected result
I would expect the error to be raised independently of subscribers.
Actual result
Exceptions just disappear
Reproduction
https://codesandbox.io/s/ancient-violet-2jp4fz
Additional context
Tested with v5.0.0-beta.10 to beta.17

The error story will be revamped soon. The intention is to never swallow things and that will be the primary design goal of the refactor in this area.

Until then, if anybody runs into this: this is how you still get errors:
  machine.subscribe({
    next: (state) => {
      console.log('State:', state.value)
    },
    complete: () => console.log(`Game machine ${id} completed`),
    error: (error) => console.error(‘ERROR’, error),
  })

I confirmed manually that this is no longer the problem with https://github.com/statelyai/xstate/pull/4145

authors: Andarist enyo

repo: statelyai/xstate


text:
[core] Add state.can(event)

This PR adds state.can(...):
someState.can({ type: 'TOGGLE' }); // `true` if it will cause a transition

If we're adding this in core, I would like to see the full functionality of https://github.com/VanTanev/xstate-helpers/blob/development/src/react/useIsXStateTransitionAvailable.ts - eg, type inference for both event types as strings and event objects - XState supports that in other places.
Also, I strongly believe that the result of state.can() should always be a boolean and never undefined. If there is no machine available on the state, can() should just return false.
Also, what is the best practice around memorizing this? Is machine.transition() expensive enough to want to use React.useMemo() around state.can()?

diff --git a/packages/core/src/State.ts b/packages/core/src/State.ts
index 17435556..2762c9b6 100644
--- a/packages/core/src/State.ts
+++ b/packages/core/src/State.ts
@@ -129,7 +129,7 @@ export class State<
    */
   public children: Record<string, ActorRef<any>>;
   public tags: Set<string>;
-  private machine: StateMachine<TContext, any, TEvent, any> | undefined;
+  protected machine: StateMachine<TContext, any, TEvent, any> | undefined;
   /**
    * Creates a new State instance for the given `stateValue` and `context`.
    * @param stateValue
@@ -321,16 +321,16 @@ export class State<
   /**
    * Determines whether sending the `event` will cause a transition.
    *
-   * If this state was created outside of a machine (e.g., with `State.from(...)`), `undefined` will be returned.
+   * If this state was created outside of a machine (e.g., with `State.from(...)`), `false` will be returned.
    *
    * @param event The event to test
    * @returns Whether the event will cause a transition
    */
-  public can(event: TEvent): boolean | undefined {
+  public can(event: TEvent | TEvent['type']): boolean {
     if (!this.machine) {
-      return undefined;
+      return false;
     }

-    return this.machine.transition(this, event).changed;
+    return !!this.machine.transition(this, event).changed;
   }
 }
diff --git a/packages/core/test/state.test.ts b/packages/core/test/state.test.ts
index 8b56738f..70145a3f 100644
--- a/packages/core/test/state.test.ts
+++ b/packages/core/test/state.test.ts
@@ -590,6 +590,10 @@ describe('State', () => {
             on: {
               NO_CHANGE: 'a',
               ACTION: { actions: 'someAction' },
+              ACTION_WITH_COND: {
+                actions: 'someAction',
+                cond: (_: any, e: any) => e.cond
+              },
               CHANGE: 'b'
             }
           },
@@ -598,15 +602,30 @@ describe('State', () => {
       });

       expect(machine.initialState.can({ type: 'UNKNOWN' })).toEqual(false);
+      expect(machine.initialState.can('UNKNOWN')).toEqual(false);
+
       expect(machine.initialState.can({ type: 'NO_CHANGE' })).toEqual(false);
+      expect(machine.initialState.can('NO_CHANGE')).toEqual(false);
+
       expect(machine.initialState.can({ type: 'ACTION' })).toEqual(true);
+      expect(machine.initialState.can('ACTION')).toEqual(true);
+
       expect(machine.initialState.can({ type: 'CHANGE' })).toEqual(true);
+      expect(machine.initialState.can('CHANGE')).toEqual(true);
+
+      expect(
+        machine.initialState.can({ type: 'ACTION_WITH_COND', cond: true })
+      ).toEqual(true);
+      expect(
+        machine.initialState.can({ type: 'ACTION_WITH_COND', cond: false })
+      ).toEqual(false);
+      expect(machine.initialState.can('ACTION_WITH_COND')).toEqual(false);
     });

-    it('should return undefined for states created without a machine', () => {
+    it('should return false for states created without a machine', () => {
       const state = State.from('test');

-      expect(state.can({ type: 'ANY_EVENT' })).toEqual(undefined);
+      expect(state.can({ type: 'ANY_EVENT' })).toEqual(false);
     });
   });
 });

After the last commit, this is chef's kiss~!
💯
Only thing left to fix is an incompatibility with StateConfig type.
It might be OK to make machine a public property?

Oops, my bad for leaving the 2nd machine prop there, sorry.

How should errors thrown by assign actions and guards be treated? How they should be treated when we implement error-related changes and we actually start capturing all unhandled errors? Should an error be counted as a change (errors will, most likely, try to select a transition - why way or another)?

Can this be resolved in a separate PR? Let's keep this one low-scope.

@Andarist Ready for re-review

Can this be resolved in a separate PR? Let's keep this one low-scope.

At this stage, this is a design question about this API - both for v4 and for v5 (the answer can differ for both). I feel like it should be answered before merging this PR in because whatever lands on the main branch should be "releasable" and we shouldn't release something that might change (behavior-wise) soon-ish.
If you don't want to keep this PR low-scope but you'd like to make the design of this more tight & explicit before releasing then you could always create a PR targeting this PR.
If the answer is: "nothing should happen in v4 and errors should bubble to the caller" then it's fine. We can refine this in v5 (but a ticket~ should be created so we don't forget about it) but the appropriate tests should be added to validate this and to prevent us from regressing.

If the answer is: "nothing should happen in v4 and errors should bubble to the caller" then it's fine. We can refine this in v5 (but a ticket~ should be created so we don't forget about it) but the appropriate tests should be added to validate this and to prevent us from regressing.

This is the answer IMO. Just added a test for this 👍
How would this be refined in v5?

How would this be refined in v5?

That depends on the outcome of the error handling refactor. The behavior has been settled for the v4 though so let's just don't bother with thinking how this related to v5

@Andarist Ready for final review 🏁

authors: Andarist VanTanev davidkpiano


text:
Added --without-hashes to poetry export in Dockerfile.

docker build wouldn't work, it said:
ERROR: In --require-hashes mode, all requirements must have their versions pinned with ==.
poetry export --without-hashes removed the error.
See discussion here:
Poetry fails in CI/CD with ERROR

Pawel suggested this as an alternative:
rm poetry.lock
poetry lock
poetry install

and then push to master


text:
Header issue when installed through nimble

When doing nimble test from Nimbus on mac I get the following:
/Users/.../Programming/Status/nimbus/nimcache/nimbus_rocksdb_backend.c:12:10: fatal error: '/Users/.../.nimble/pkgs/headers/c.h' file not found
#include "/Users/.../.nimble/pkgs/headers/c.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

which comes from https://github.com/status-im/nim-rocksdb/blob/92ac374a55ca822131a3c6a8bc05c53bb638f69d/src/rocksdb/librocksdb.nim#L38-L40
So:

headers should be added in the nimble file
The path resolution is wrong, it should be something like: ~/.nimble/pkgs/rocksdb-0.2.0/rocksdb/headers/c.h

Cloning rocksdb locally and using nimble develop instead of nimble install works fine however.
Given how nimble works, the package structure should be changed from
project/src/<files>
to
project/nimblename/<files>
because on nimble install the "src" directory disappears and we can't rely on paths.

An alternative solution would be to move the headers folder inside the src folder. It seems that the problem is that nimble deploys only the src folder on installations.

Yes this is my point 1, but beyond that nimble is checking the wrong place /Users/.../.nimble/pkgs/headers/c.h instead of ~/.nimble/pkgs/rocksdb-0.2.0/rocksdb/headers/c.h (which I agree would require installing both the src and the headers directories)

Fixed by changing pkg structure.

authors: mratsim yglukhov zah

repo: status-im/nim-rocksdb


text:
Clang support

Useful for static analysis and libFuzzer.

For this we at least need to drop the dependency on -fplan9-extensions.

repo: stblr/mkw-sp


text:
C implementation for stdlib_base_lucas()

Resolves #892 .
Description implementation of the C stdlib_base_lucas

What is the purpose of this pull request?

This pull request:
implements all C files associated with the lucas function
Related Issues

Does this pull request have any related issues? No

This pull request:

resolves #892

Questions

Any questions for reviewers of this pull request?

No.
Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

@kgryte Wanted to give you a heads up that, when viewed in dark mode, the initial definition of the READMEs are hard to see (they're in black font).
Checklist

Please ensure the following tasks are completed before submitting this pull request.

[x] Read, understood, and followed the contributing guidelines.

@stdlib-js/reviewers

@Jordan-Gallivan Re: dark mode. Is this when viewing the Markdown on GitHub or elsewhere?

You mind posting a screenshot?

@kgryte
See attached:

authors: Jordan-Gallivan kgryte

repo: stdlib-js/stdlib

license_source: bigquery


text:
Typo fix load.name -> name

Fix for #26

Thanks.

Published as 1.1.1

authors: Bajix matthewp

repo: stealjs/steal-css

license: mit


text:
EditOnModify and EditOnSave no longer work

I'm constantly getting error: file write-protected, click override...
Also, I'm no longer getting the files I modify in my default changelist in P4.
Can you please help?

Sorry for a false alarm, apparently VSCode switched to my second workspaces, and that's where the files were going. Closing this.

repo: stef-levesque/vscode-perforce


text:
vscode-perforce fails when using a "personal (local) server"

When using a "personal (local) server", vscode-perforce generates incorrect "p4" command lines.
To reproduce:
Personal servers may be created via one of these methods:

p4 init
p4 clone
Using p4v and creating a Personal Sever

In workspace using a personal server, the .p4config file contains a P4PORT entry that looks like these:
Windows: P4PORT=rsh:p4d.exe -i -J off -r "$configdir\.p4root"
Linux: P4PORT=rsh:/bin/sh -c "umask 077 && exec p4d -i -J off -r '$configdir/.p4root'"
OSX: P4PORT=rsh:/bin/sh -c "umask 077 && exec p4d -i -J off -r '$configdir/.p4root'"
Actual Results
This leads the Perforce integrate to run P4 commands that look like this:
"p4" -u jeff.putsch -c jeff.putsch-dvcs-1566707823 -p rsh:/bin/sh -c "umask 077 && exec p4d -i -J off -r '$configdir/.p4root'" -d /home/putsch/src/Maxim/mdx/mipi/ edit "/home/putsch/src/Maxim/mdx/mipi/README.rst"
Which does not provide a valid P4 command:

The quoting of the P4PORT is wrong.
The value of $configdir is not expanded.

Expected Results:
A valid P4 command that works in this environment.
One idea would be to add "P4CONFIG" to the environment, then not use the "-p " option if P4PORT starts with "rsh:".
Jeff.

Hi @ulfwin @jdputsch
I've just pushed an update to my fork that partially resolves this.
Specifically, it should fix the escaping of the command
It does not fix the variable expansion, so you still need to change the default generated .p4config file to replace $configdir with the real path.*
I tested it by changing the P4PORT as described, and ensuring perforce.port vscode config setting was not defined, and it works for me
* ultimately I would like to change the activation so it doesn't explicitly read the p4 config file, but uses perforce's own logic to get the correct client details, which would expand the variables automatically, but it's quite a big task

Tired and working on Windows! Thanks a lot @mjcrouch !
Indeed expanding the variables would be nice, but the biggest problem of having to change back and fourth is taken care of with this work around.

authors: jdputsch mjcrouch ulfwin


text:
Fix for issue #385

Try loading image dimensions unless it's allready loaded 250ms after
document.ready.
See: https://github.com/stefanfoulis/django-filer/issues/385

Coverage remained the same at 68.65% when pulling 55fcfc301683dd041f21958882b8da664c3a63be on strindhaug:develop into 43527a159e8501015f264fdf94c9cfaf9b65e7e0 on stefanfoulis:develop.

Nice thanks

authors: coveralls strindhaug yakky

repo: stefanfoulis/django-filer


text:
change nested tag color

in this html:

    salam

        simple text

close and open parent tags don't resolve my problem any time because it can't be extends some propertise such as color,font face or other things from parent.
for example:

    salam

            simple text

how can i change nested tag as : span

Thanks for the test case! I can reproduce the problem (everything is green), but don't have a fix yet.

It cauae of resolve many problems of android programers.thanks

Should be fixed at head:

@stefanhaustein oh man! thank you very much

p.s. you may need to remove "!important", I don't think it's valid syntax at this position....

@stefanhaustein yes its not valid syntax.I removed it

authors: MahdiPishguy stefanhaustein


text:
display image over internet

how can i use this library when i have some images over internet not assets? i get error and its must be use background, is any solution?

Images on the internet should just work like asset images. What error did you observe? Did you set the base URL? Can you provide a sample HTML snippet that doesn't work as expected?

@stefanhaustein  yes, sure
   try {
       String text   = "

";
       Reader reader = new StringReader(text);
       myHiClass htmlView = new myHiClass(this);
       htmlProcessor.parse(reader, htmlView);
       ScrollView scrollView = new ScrollView(this);
       scrollView.addView(htmlView);
       setContentView(scrollView);
       makeSelectable(scrollView);
   } catch (Exception e) {
       e.printStackTrace();
       Log.e("HtmlView ", e.getMessage());
       throw new RuntimeException(e);
   }

screen shot:
http://rupload.ir/upload/xhkjmp6q7kq3x812fvu2.png

@stefanhaustein I'm so sorry, after some delay time image can be show

repo: stefanhaustein/nativehtml


text:
Error loading prometheus.yml

prometheus      | level=error ts=2019-06-06T17:17:22.649Z caller=main.go:717 err="error loading config from "/etc/prometheus/prometheus.yml": couldn't load configuration (--config.file="/etc/prometheus/prometheus.yml"): open /etc/prometheus/prometheus.yml: permission denied"
i followed steps in #13 but still same issue .
its running in vm

@ajithkrishnar can you confirm the permissions in your dockprom/prometheus folder please?

@ajithkrishnar I'm closing this off due to inactivity, if you continue to experience this issue, please provide the details requested above and I'll re-open the issue.

authors: ajithkrishnar nightah

repo: stefanprodan/dockprom


text:
react-stampit

https://github.com/stampit-org/react-stampit
I love it. Though I understand people prefer the somewhat broken/incomplete classes.

Sorry, mixins are no go. Feel free to convice me to opposite.

In order to do that I would need to know why they are no go?

For me classes + higher order component is a no go since statics are not forwarded.

As long as we keep using higher order components to approach the same thing as with mixins, I can't see any point of stopping mixins usage in React Native. Components composition is something I really like when using mixins, it's also less boilerplate to write. Waiting for the official solution made specifically for ES6.
Some examples:

AnimateMixin - adds animation to a component when state changes (LayoutAnimation in iOS)
TrackKeyboardMixin - tracks keyboard and adds this.state.keyboardPosition to your component so you can adjust position of e.g. your form when keyboard is toggled.

Mixins is composition...

Mixing is merging, HOC is composition. What does not work for you with higher order components? Mixings is super brittle, once someone will use handleChanges or similar method. React ES6 classes are ok, they allow you to add local state, which is ok for experimenting.

Mixins are anti-functional approach, exactly as Dan wrote. There are many most of the time "nice" features in any programming language, but the task of constant/linear development complexity system is to prefer pure funtional before any "nice" features whenever possible. If it's not possible due to environment, then that's the right place for low level abstraction to keep the app as functional as possible.

As I wrote, HOC does not forward statics.

If you already use statics, then is your "functional" level messed already so much, that you can copy/paste them. :-D

I'll refer to Eric Elliot to debate mixins. I'm not qualified further than having an opinion.
http://ericleads.com/2013/06/classical-inheritance-is-obsolete-how-to-think-in-prototypal-oo/
https://github.com/stampit-org/stampit
http://ericleads.com/2014/02/prototypal-inheritance-with-stamps/

If you already use statics, then is your "functional" level messed already so much, that you can copy/paste them. :-D

I don't quite understand this.

I've read those things about stampit. And I actually like it. But I would need more time to study it. About the statics - did you mean that higher order component doesn't automatically get the static properties of the wapped one?

did you mean that higher order component doesn't automatically get the static properties of the wapped one?

Yes.

From functional view it would be better to have "utility object" injected in constructor, which would pass without problems. But if you really want static methods then it's better to create higher order component factory, which can copy the static props to the HoC. It kind of sucks, but static properties kind of suck themselves. ;-)

Ran into this problem again today. I can't use willTransitionTo in a component that is wrapped by a exposeRouter.

I ran into the same problem @ronag. I need prevent user closes the form while inserting data, like the docs
willTransitionFrom: function (transition, component) {
  if (component.formHasUnsavedData()) {
    if (!confirm('You have unsaved information,'+
                 'are you sure you want to leave this page?')) {
      transition.abort();
    }
  }
}

then when wrap requireAuth using another HoC the willTransitionFrom method never is called
Here there are some workaround for this kind of problem: https://github.com/acdlite/flummox/issues/173
Any suggestion?

willTransitionTo will not be static method with new react-router api anyway, so 1) wait for new api 2) use some temp workaround 3) don't use willTransitionTo. Anyway, I guess you can not prevent accidental leaving through browser back button, so there is no point to use confirm for that. I would just save all data into global app state, then data will be never lost, and you can use onBeforeUnload for protecting accidental app closing. Makes sense?

My work around is to in exposeRouter do:
static willTransitionTo = Component. willTransitionTo

Ugly, but it works until I personally switch to react-stampit.

authors: fabriciocolombo grabbou ironer ronag steida

repo: steida/este


text:
Server refactoring part 1

Issue #218

I actually think that instead of frontend folder, we can just use este folder, so all we give to the users is a pure Express server with este middleware :)

It's ready to be merged sir?

Yes! The comment was about the fact it will conflict with #217, but that's ok. We can resolve them just in case. The part one is ready!

I'll submit it again -.-

authors: grabbou steida


text:
Centralised Exchange Trading

Is there a way for stellar expert explorer to connect to centralised exchanges and update trading volumes on explorer.

The explorer shows only on-chain data. Pulling trading volumes from external sources is out of scope, and won't be implemented in the foreseeable future.

Thank you orbitlens for the reply.

authors: ThaneCoin orbitlens

repo: stellar-expert/stellar-expert-explorer


text:
exp/services/recoverysigner: add docs for how to setup unique signing keys

What
Add docs to the README for how to setup unique signing keys in recoverysigner using the new logic in the recoverysigner-unique-signing-keys breanch.
Why
Someone should be able to get pretty far using the usage text but it will be helpful to have some clear docs that step-by-step how to setup the recoverysigner with unique signing keys.

Done in #2807.

repo: stellar/go


text:
[test] failing variant of update-wasm test

Add a variant of test_contract_wasm_update that tries to update to an invalid WASM and check that:

[ ] The update fails
[ ] The contract didn't get bricked in the process

Possibly try a few other forms of invalid-update besides just "the WASM was bad" (eg. auth failures or budget limits)

Possibly try a few other forms of invalid-update besides just "the WASM was bad" (eg. auth failures or budget limits)

There is no auth for updating the Wasm (current contract updates its own Wasm, so it's an authorized action by default). I don't see much value in covering generic failures (like budget) for this specific case - any traps generically result in rollback, which includes the contract instance entry. We could cover try_call though, which hasn't been mentioned in this issue.

authors: dmkozh graydon

repo: stellar/rs-soroban-env


text:
Rspec error: `attribute': Stellar::Asset does not convert to xdr (ArgumentError)

Steps to reproduce:

download rvm, rvm install 2.2.6, gem install bundler
git clone https://github.com/stellar/ruby-stellar-base
cd ruby-stellar-base
running bundler results in the following error:

Bundler could not find compatible versions for gem "activesupport":
  In Gemfile:
    stellar-base was resolved to 0.11.0, which depends on
      xdr (~> 1.0.0) was resolved to 1.0.0, which depends on
        activemodel (~> 4) was resolved to 4.2.7.1, which depends on
          activesupport (= 4.2.7.1)

    stellar-base was resolved to 0.11.0, which depends on
      activesupport (~> 4)

    stellar-base was resolved to 0.11.0, which depends on
      activesupport (~> 4)

    xdrgen was resolved to 0.0.1, which depends on
      activesupport (~> 5)

change activesupport version of ruby-stellar-base to version 5 in ruby-stellar-base.gemspec
cd ..; git clone https://github.com/stellar/ruby-xdr
cd ruby-xdr
change activesupport and activemodel version for ruby-xdr from 4 to 5
run bundle
change to ruby-stellar-base folder and modify Gemfile to take local ruby-xdr and run bundle
run bundle exec rake and the following error shows:

ubuntu@me:~/sources/ruby-stellar-base$ bundle exec rake
/home/ubuntu/.rvm/rubies/ruby-2.2.6/bin/ruby -I/home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib:/home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-support-3.5.0/lib /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
Coverage report generated for RSpec to /home/ubuntu/sources/ruby-stellar-base/coverage. 218 / 297 LOC (73.4%) covered.
/home/ubuntu/sources/ruby-xdr/lib/xdr/dsl/struct.rb:5:in `attribute': Stellar::Asset does not convert to xdr (ArgumentError)
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/trust_line_entry.rb:35:in `<class:TrustLineEntry>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/trust_line_entry.rb:29:in `<module:Stellar>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/trust_line_entry.rb:28:in `<top (required)>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry/data.rb:32:in `<class:Data>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry/data.rb:23:in `<class:LedgerEntry>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry/data.rb:22:in `<module:Stellar>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry/data.rb:21:in `<top (required)>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry.rb:43:in `<class:LedgerEntry>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry.rb:36:in `<module:Stellar>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry.rb:35:in `<top (required)>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry_change.rb:30:in `<class:LedgerEntryChange>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry_change.rb:22:in `<module:Stellar>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar/ledger_entry_change.rb:21:in `<top (required)>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar-base-generated.rb:123:in `<module:Stellar>'
        from /home/ubuntu/sources/ruby-stellar-base/generated/stellar-base-generated.rb:100:in `<top (required)>'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/backports-3.6.8/lib/backports/std_lib.rb:9:in `require'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/backports-3.6.8/lib/backports/std_lib.rb:9:in `require_with_backports'
        from /home/ubuntu/sources/ruby-stellar-base/lib/stellar-base.rb:11:in `block in <top (required)>'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/activesupport-5.0.1/lib/active_support/core_ext/kernel/reporting.rb:13:in `block in silence_warnings'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/activesupport-5.0.1/lib/active_support/core_ext/kernel/reporting.rb:26:in `with_warnings'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/activesupport-5.0.1/lib/active_support/core_ext/kernel/reporting.rb:13:in `silence_warnings'
        from /home/ubuntu/sources/ruby-stellar-base/lib/stellar-base.rb:10:in `<top (required)>'
        from /home/ubuntu/sources/ruby-stellar-base/spec/spec_helper.rb:8:in `require'
        from /home/ubuntu/sources/ruby-stellar-base/spec/spec_helper.rb:8:in `<top (required)>'
        from /home/ubuntu/sources/ruby-stellar-base/spec/lib/stellar/account_flags_spec.rb:1:in `require'
        from /home/ubuntu/sources/ruby-stellar-base/spec/lib/stellar/account_flags_spec.rb:1:in `<top (required)>'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `load'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `block in load_spec_files'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `each'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `load_spec_files'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:100:in `setup'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:86:in `run'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:71:in `run'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:45:in `invoke'
        from /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/exe/rspec:4:in `<main>'
/home/ubuntu/.rvm/rubies/ruby-2.2.6/bin/ruby -I/home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/lib:/home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-support-3.5.0/lib /home/ubuntu/.rvm/gems/ruby-2.2.6/gems/rspec-core-3.5.4/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed

I can confirm the error is the same with ruby 2.2.0

I can't repro this on ruby 2.5.1.  Happy to repoen if you get another set of reproduction steps.

authors: mvaneijk nullstyle

repo: stellar/ruby-stellar-base


text:
[SDP-1210] The invitation email should not be sent when the tenant provisioning fails

What
Hold off on sending invitation email until after entire tenant provisioning process completes
Why
[TODO: Why this change is being made. Include any context required to understand the why.]
Known limitations
[TODO or N/A]
Checklist
PR Structure

[x] This PR has a reasonably narrow scope (if not, break it down into smaller PRs).
[x] This PR title and description are clear enough for anyone to review it.
[x] This PR does not mix refactoring changes with feature changes (split into two PRs otherwise).

Thoroughness

[x] This PR adds tests for the new functionality or fixes.
[x] This PR contains the link to the Jira ticket it addresses.

Configs and Secrets

[x] No new CONFIG variables are required -OR- the new required ones were added to the helmchart's values.yaml file.
[x] No new CONFIG variables are required -OR- the new required ones were added to the deployments (pr-preview, dev, demo, prd).
[x] No new SECRETS variables are required -OR- the new required ones were mentioned in the helmchart's values.yaml file.
[x] No new SECRETS variables are required -OR- the new required ones were added to the deployments (pr-preview secrets, dev secrets, demo secrets, prd secrets).

Release

[x] This is not a breaking change.
[ ] This is ready for production.. If your PR is not ready for production, please consider opening additional complementary PRs using this one as the base. Only merge this into develop or main after it's ready for production!

Deployment

[ ] Does the deployment work after merging?

stellar-disbursement-platform-backend-preview is available here:SDP:      https://sdp-backend-pr294.previews.kube001.services.stellar-ops.com/healthAP:       https://sdp-ap-pr294.previews.kube001.services.stellar-ops.com/healthFrontend: https://sdp-backend-dashboard-pr294.previews.kube001.services.stellar-ops.com

stellar-disbursement-platform-backend-preview is available here:SDP:      https://sdp-backend-pr294.previews.kube001.services.stellar-ops.com/healthAP:       https://sdp-ap-pr294.previews.kube001.services.stellar-ops.com/healthFrontend: https://sdp-backend-dashboard-pr294.previews.kube001.services.stellar-ops.com

stellar-disbursement-platform-backend-preview is available here:SDP:      https://sdp-backend-pr294.previews.kube001.services.stellar-ops.com/healthAP:       https://sdp-ap-pr294.previews.kube001.services.stellar-ops.com/healthFrontend: https://sdp-backend-dashboard-pr294.previews.kube001.services.stellar-ops.com

stellar-disbursement-platform-backend-preview is available here:SDP:      https://sdp-backend-pr294.previews.kube001.services.stellar-ops.com/healthAP:       https://sdp-ap-pr294.previews.kube001.services.stellar-ops.com/healthFrontend: https://sdp-backend-dashboard-pr294.previews.kube001.services.stellar-ops.com

stellar-disbursement-platform-backend-preview is available here:SDP:      https://sdp-backend-pr294.previews.kube001.services.stellar-ops.com/healthAP:       https://sdp-ap-pr294.previews.kube001.services.stellar-ops.com/healthFrontend: https://sdp-backend-dashboard-pr294.previews.kube001.services.stellar-ops.com

stellar-disbursement-platform-backend-preview is available here:SDP:      https://sdp-backend-pr294.previews.kube001.services.stellar-ops.com/healthAP:       https://sdp-ap-pr294.previews.kube001.services.stellar-ops.com/healthFrontend: https://sdp-backend-dashboard-pr294.previews.kube001.services.stellar-ops.com

stellar-disbursement-platform-backend-preview is available here:SDP:      https://sdp-backend-pr294.previews.kube001.services.stellar-ops.com/healthAP:       https://sdp-ap-pr294.previews.kube001.services.stellar-ops.com/healthFrontend: https://sdp-backend-dashboard-pr294.previews.kube001.services.stellar-ops.com

stellar-disbursement-platform-backend-preview is available here:SDP:      https://sdp-backend-pr294.previews.kube001.services.stellar-ops.com/healthAP:       https://sdp-ap-pr294.previews.kube001.services.stellar-ops.com/healthFrontend: https://sdp-backend-dashboard-pr294.previews.kube001.services.stellar-ops.com

stellar-disbursement-platform-backend-preview is available here:SDP:      https://sdp-backend-pr294.previews.kube001.services.stellar-ops.com/healthAP:       https://sdp-ap-pr294.previews.kube001.services.stellar-ops.com/healthFrontend: https://sdp-backend-dashboard-pr294.previews.kube001.services.stellar-ops.com

stellar-disbursement-platform-backend-preview is available here:SDP:      https://sdp-backend-pr294.previews.kube001.services.stellar-ops.com/healthAP:       https://sdp-ap-pr294.previews.kube001.services.stellar-ops.com/healthFrontend: https://sdp-backend-dashboard-pr294.previews.kube001.services.stellar-ops.com

stellar-disbursement-platform-backend-preview is available here:SDP:      https://sdp-backend-pr294.previews.kube001.services.stellar-ops.com/healthAP:       https://sdp-ap-pr294.previews.kube001.services.stellar-ops.com/healthFrontend: https://sdp-backend-dashboard-pr294.previews.kube001.services.stellar-ops.com

stellar-disbursement-platform-backend-preview is available here:SDP:      https://sdp-backend-pr294.previews.kube001.services.stellar-ops.com/healthAP:       https://sdp-ap-pr294.previews.kube001.services.stellar-ops.com/healthFrontend: https://sdp-backend-dashboard-pr294.previews.kube001.services.stellar-ops.com

stellar-disbursement-platform-backend-preview is available here:SDP:      https://sdp-backend-pr294.previews.kube001.services.stellar-ops.com/healthAP:       https://sdp-ap-pr294.previews.kube001.services.stellar-ops.com/healthFrontend: https://sdp-backend-dashboard-pr294.previews.kube001.services.stellar-ops.com

stellar-disbursement-platform-backend-preview is available here:SDP:      https://sdp-backend-pr294.previews.kube001.services.stellar-ops.com/healthAP:       https://sdp-ap-pr294.previews.kube001.services.stellar-ops.com/healthFrontend: https://sdp-backend-dashboard-pr294.previews.kube001.services.stellar-ops.com

authors: stellar-jenkins ziyliu


text:
Add section on supercluster / theoretical max TPS tests

This change adds links to our supercluster documentation on running reproducible theoretical max TPS tests.

Preview is available here:http://developers-pr874.previews.kube001.services.stellar-ops.com

Preview is available here:http://developers-pr874.previews.kube001.services.stellar-ops.com

repo: stellar/stellar-docs


text:
On stable version a documentation page is broken

Describe the bug
The stable version of documentation does not provide StellarGraph API information.
To Reproduce
Steps to reproduce the behavior:

Go to StellarGraph API
The page provides no information

Observed behavior
No information provided on API page
Expected behavior
API information showcase, like on any other version, (e.g., on the dev version https://stellargraph.readthedocs.io/en/latest/api.html)
Environment
Operating system: Windows10
Additional context
Screenshots:  https://ctrl.vi/i/h0bDdPUig

As of January 27th, 2023, the issue has not been fixed. Could you assign this to an owner or a contributor of this repo?

authors: AmadeusZhang cloudmadeofcandy

repo: stellargraph/stellargraph


text:
Release workflow fails when identifying related PRs

The release workflow currently fails at one point in the github plugin, where the release success is handled.
Because all important steps (create git tag, create github release, publish release artifacts) are done before, this is not a critical issue.
However, it seems to prevent comments on PRs and issues that the changes were released.
It seems to fail here when determining the PRs related to the release.
https://github.com/semantic-release/github/blob/bfd07360e589da7cec9debff537daa030c57924c/lib/success.js#L81
Example workflow run:
https://github.com/stempler/bnd-platform/actions/runs/12046684611

More verbose logging of semantic-release was enabled in https://github.com/stempler/bnd-platform/pull/160 (verified in dry run), hope we can get some more insights on the next actual release run.

repo: stempler/bnd-platform


text:
Implement GROUP BY

Implement the GROUP BY strategy brainstormed earlier to subquery using the sqlJoin as the where and taking user-specified grouping columns and aggregate functions on the field.

Hi,
I am developing a prototype for my current project and man, join-monster is a decent piece of software that can solve 80% of my problems out of the box. GroupBy is in the other 20%, so I was wondering why this feature was closed?
I hacked a group by into the QueryRoot resolver by just collecting the fields to be grouped by in the context and appending groupby in the dbCall function of the demo - it works pretty well when you sqlBatch the join. So I was wondering if there's any blocker further down the road that I've missed? If not, a hint into the right direction how this ought to be tackled would be highly appreciated. I'd be happy to contribute to this great project :)
Thanks!

Interesting.... do you have a sample or a fork I can check out? I ended up closing it because I couldn't get a consistent, efficient implementation that worked in all situations, e.g. after a sqlJoin or a sqlBatch. I am certainly open to the idea.

I couldn't get a consistent, efficient implementation that worked in all situations

I agree, adding robust support without limitations will be hard, if possible at all. Please do not consider this a proper approach - it's just the result of a quick PoC if join-monster can solve problems in my current project - I added a groupBy hack to the demo here, just
npm install
npm start

Sample query:
{
  users {
    id
    stats(from: "2016-01-01", to: "2017-08-02") {
      comments
      likes
    }
    posts {
      body
      stats(from: "2016-01-01", to: "2017-08-02") {
        comments
        likes
      }
    }
  }
}

General functionality is to populate context.groupBy in the where() of the StatsConnector by climbing up the nodes in the sqlASTNode and then appending the group by SQL in the resolver() of the QueryRoot.

authors: acarl005 peterviergutz stem-admin

repo: stems/join-monster


text:
Crash when iOS suspends app after being backgrounded

Build Information
v0.13.3 via SPM
Issue
We noticed a number of crashes due to EXC_CRASH: RUNNINGBOARD 0xdead10cc. According to the Apple docs, this is likely due to iOS terminating our app because we are actively performing database operations while in the background.
The problem is that we didn't initially know we needed to do anything special in order to avoid this problem, and this could easily happen to anyone who uses this framework.
One potential solution we are in the process of experimenting with is a helper function on the Connection object. Something like this:
@discardableResult
public func withThrowingBlock<T>(_ function: String = #function, _ block: (() throws -> T)) throws -> T {

    // Allows the block to be performed in the background for a short period of time
    let taskId = UIApplication.shared.beginBackgroundTask(withName: function)
    defer { UIApplication.shared.endBackgroundTask(taskId) }

    return try block()
}

This would make for a fairly simple solution to prevent crashes in the vast majority of cases. To use the example for this project:
do {
    let db = try Connection("path/to/db.sqlite3")
    let users = Table("users")
    let id = Expression<Int64>("id")
    let name = Expression<String?>("name")
    let email = Expression<String>("email")

    try db.withThrowingBlock {
        try db.run(users.create { t in
            t.column(id, primaryKey: true)
            t.column(name)
            t.column(email, unique: true)
        })
    }

} catch {
    print (error)
}

Or you could use it to return a value directly:
do {
    let db = try Connection("path/to/db.sqlite3")
    let users = Table("users")
    ...

    let count = try db.withThrowingBlock {
         try db.scalar(users.count) // 0
    }
    print(count)

} catch {
    print (error)
}

As a follow up, we ended up wrapping the entire SQLite Connection object into its own client, which mostly acts as a helper to ensure no one creates one manually. This also helps us with managing the lifetime of the connection as it appears to maintain a reference and needs to be properly closed.
The client class looks something like this:
/// Wraps a SQL database and allows for operations to be performed safely.
public class SQLiteClient {

    let databaseFilename: String?
    let logger: Logger

    private(set) var didEnterBackground = false

    private var cancellables = Set<AnyCancellable>()
    private var _connection: Connection?
    private var createTables: ((_ connection: Connection) throws -> Void)?

    // Custom path we use to store databases - needs to allow read/writes
    private static let databaseDirectory = FileManager.default.sharedDocumentsURL

    /// Initializes the SQL wrapper. You must either pass in a block to create the tables or
    /// call ``setup(createTables:)`` once at a later time.
    /// - Parameters:
    ///   - filename: The short name of the database. Example: "History.sqlite3"
    ///   - logger: The OS logger to which this client should log, usually a local logger.
    ///   - createTables: Optional. A block to immediately setup the database by creating tables only if they do not exist.
    ///   Do not call ``setup(createTables:)`` if used.
    public init(filename: String, logger: Logger, createTables: ((_ connection: Connection) throws -> Void)? = nil) {
        self.databaseFilename = Self.databaseDirectory?.appendingPathComponent(filename).path
        self.logger = logger

        // Track if running in the background
        subscribeToPublishers()

        // Try to setup if a block is passed in
        if let createTables = createTables {
            setup(createTables: createTables)
        }
    }

    // MARK: Public

    /// Clears the database by either deleting the specified tables,
    /// or deleting the database file if needed.
    /// - Parameter tables: Optional. An array of `Table` items to clear.
    /// If empty, the database file will be deleted.
    /// - Returns: True of clearing was successful, False if not.
    public func clearAll(tables: [Table] = []) -> Bool {

        // Try deleting the tables
        var didClear = deleteTables(tables)

        // Try deleting the database if needed
        if !didClear {
            didClear = deleteDatabase()
        }

        // Create a new database or tables if needed
        if didClear {
            createDatabaseIfNeeded()
        }

        return didClear
    }

    /// Deletes the underlying database permanently.
    /// Public for testing purposes.
    @discardableResult
    public func deleteDatabase() -> Bool {
        guard let databaseFilename = self.databaseFilename,
              FileManager.default.fileExists(atPath: databaseFilename)
        else { return false }

        do {
            // Close the connection before deleting the database
            self.connection = nil

            // Try deleting the database altogether
            try FileManager.default.removeItem(atPath: databaseFilename)

            return true

        } catch {
            log(error: error, message: "Error deleting database")
        }

        return false
    }

    /// Optional if a `createTables` block is not used during initialization.
    /// Setup the client by creating tables, but only if needed.
    /// Used if you need to reference `self` in the block in order to perform additional operations
    /// once the tables are properly created.
    /// - Parameter createTables: Block to create tables, but only do so if tables do not already exist.
    public func setup(createTables: @escaping ((_ connection: Connection) throws -> Void)) {
        guard !self.didSetup else { self.logger.resumableAssert("Setup should only be called once"); return }

        // Allows us to create or re-create tables as needed
        self.createTables = createTables

        // Creates the actual SQL database file and tables if needed
        createDatabaseIfNeeded()
    }

    /// Performs one or more operations on the connection in a safe way,
    /// particularly if the app is sent to the background.
    @discardableResult
    public func withSafeConnection<T>(_ block: ((Connection) throws -> T)) throws -> T {
        guard let connection = self.connection else { throw ServiceError.cancelled }

        do {
            return try connection.withSafeThrowingBlock {
                return try block(connection)
            }
        } catch {
            log(error: error, message: "Error performing operation")
            throw error
        }
    }

    // MARK: Private

    private var connection: Connection? {
        get {
            guard self.didSetup else { self.logger.resumableAssert("Setup must be called first"); return nil }
            guard !self.didEnterBackground else { return nil }

            if self._connection == nil {
                self._connection = createConnection()
            }

            return self._connection
        }
        set { self._connection = newValue }
    }

    private var didSetup: Bool { self.createTables != nil }

    private func createConnection() -> Connection? {
        guard let databaseFilename = self.databaseFilename
        else { self.logger.resumableAssert("Database file is missing"); return nil }

        var connection: Connection?

        do {
            connection = try Connection(databaseFilename)
        } catch {
            log(error: error, message: "Error creating connection")
        }

        self.logger.resumableAssert("Connection shouldn't be nil", connection != nil)
        return connection
    }

    private func createDatabaseIfNeeded() {
        do {
            try createDirectoryIfNeeded()
            try createTablesIfNeeded()
        } catch {
            log(error: error, message: "Error creating database")
            self._connection = nil
        }
    }

    private func createDirectoryIfNeeded() throws {
        guard let databaseFilename = self.databaseFilename else { throw ServiceError.invalidState }

        do {
            // Create documents directory if file does not exist
            if !FileManager.default.fileExists(atPath: databaseFilename),
               let databaseDirectoryPath = Self.databaseDirectory?.path {

                try FileManager.default.createDirectory(atPath: databaseDirectoryPath,
                                                        withIntermediateDirectories: true,
                                                        attributes: nil)
            }

        } catch {
            log(error: error, message: "Error creating directory")
            throw error
        }
    }

    private func createTablesIfNeeded() throws {
        guard let createTables = self.createTables else { throw ServiceError.invalidState }

        do {
            // Creates tables in a safe way
            try withSafeConnection { connection in
                try createTables(connection)
            }

        } catch {
            log(error: error, message: "Error creating tables")
            throw error
        }
    }

    /// Deletes the tables without deleting the actual database
    private func deleteTables(_ tables: [Table]) -> Bool {
        guard !tables.isEmpty else { return false }

        do {
            // Try dropping the database table
            try withSafeConnection { connection in
                try tables.forEach { table in
                    try connection.run(table.drop(ifExists: true))
                }

                return true
            }

        } catch {
            log(error: error, message: "Error clearing table")
        }

        return false
    }

    /// Logs a client error using the OS logger
    private func log(error: Error, message: StaticString) {
        let info = (error as? SQLite.QueryError)?.description
            ?? (error as? SQLite.Result)?.description
            ?? error.localizedDescription

        self.logger.error("\(message): \(info)")
    }

    private func subscribeToPublishers() {
        // Allows us to avoid initiating new operations while in the background
        NotificationCenter.default
            .publisher(for: UIApplication.willEnterForegroundNotification)
            .sink { [weak self] _ in
                self?.didEnterBackground = false
            }
            .store(in: &self.cancellables)

        NotificationCenter.default
            .publisher(for: UIApplication.didEnterBackgroundNotification)
            .sink { [weak self] _ in
                self?.didEnterBackground = true
            }
            .store(in: &self.cancellables)
    }
}

fileprivate extension Connection {

    /// Performs a block operation in a safe way by notifying
    /// iOS that it may need more time if the app is sent to the background.
    @discardableResult
    func withSafeThrowingBlock<T>(_ function: String = #function, _ block: (() throws -> T)) throws -> T {

        // Allows the block to be performed in the background for a short period of time
        let taskId = UIApplication.shared.beginBackgroundTask(withName: function)
        defer { UIApplication.shared.endBackgroundTask(taskId) }

        return try block()
    }
}

Here's an example of safe usage:
let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "cacheDatabase")
let client = SQLiteClient(filename: "cache.sqlite3", logger: logger)

// Create the database table if it doesn't exist
client.setup { connection in
    // Used to version the database schema
    connection.userVersion = 0

    // Creates tables only if needed
    try connection.run(CacheItem.tableCreate())
}

// Run a query
do {
    let count = return try self.databaseClient.withSafeConnection { connection in
        try connection.scalar(CacheItem.tableCount())
    }
    print("Table count: \(count)")
} catch {
    print("Error loading count: \(error.localizedDescription)")
}

// Clear data
if client.clearAll(tables: [CacheItem.table]) {
    // Clear succeeded
    postNotification()
}

There's no "official" way to test this, but if you wait 30 seconds, iOS will emit warnings and notify you about background tasks.
One issue that we did uncover since my original comment nearly a year ago is that despite what an Apple rep told me directly, there is a fairly high performance cost (or at least, noticeable) to performing a background task. As such, we only use this code when we must rather than always and unfortunately still experience crashes in some non-trivial scenarios where average performance matters more than occasional background issues.

I suspect my case is a bit different (same core issue) after having looked through and debugged quite a bit. I've been unable to crash it myself after many different tests on device, not getting any warnings when waiting and/or backgrounding on sim either.
The customers crash reports for me call out a function in the initialization method, hours after launch -- suggesting de-suspension, which from my research should never run again. This leaves where the actual problem is happening as rather cryptic. When looking at memory instrument of a healthy run it looks like the crash dump is just reporting the first location of DB access.
In my situation reads and writes only occur from user input so no queries should occur in the background making me wonder if I need to close out the connection. In your code I don't see this occur unless necessary. In your production app did you close out the connection or do you leave it long running/always open?

authors: MikeMorawski PatrickDanino


text:
Null pointer when fetching an empty BLOB

According to the SQLite Documentation:

The return value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer

But this is the way SQLite.swift handles BLOB (on struct Cursor in Statements.swift):
  public subscript(idx: Int) -> Blob {
        if let pointer = sqlite3_column_blob(handle, Int32(idx)) {
            let length = Int(sqlite3_column_bytes(handle, Int32(idx)))
            return Blob(bytes: pointer, length: length)
        } else {
            fatalError("sqlite3_column_blob returned NULL")
        }
    }

Shouldn't the else return an empty BLOB (Blob(bytes: [])) in this case?

Good catch, just pushed a fix for this.

authors: brunokoga jberkel


text:
[Bug]: It's not a bug, I ask for help

What happened?
Hi, I'm a newbie to Filament, and I installed the plugin according to the documentation, but I don't see that it does anything. I imagine that you have to put something inside the panel file, but they don't explain how to do that. Could you help me with that?
Thanks
How to reproduce the bug
does nothing, a new menu appears
Package Version
0.0.13
PHP Version
8.3.11
Laravel Version
11
Which operating systems does with happen with?
Windows
Notes
Sorry, but I was looking for how to do it, and nothing came up.

Did you run the following command?
php artisan filament:jetstream:install --teams --api
(remove --teams and/or --api if this functionality is needed)

If you already have installed filament, and then run the commands in the README, you will end up generating two different panels. This library uses "/app" as the route name, and the default is /admin. Check ~/app/Providers/Filament

repo: stephenjude/filament-jetstream


text:
Error configStore.del is not defined

I got this error while trying to upload a file to GCS
/pipeline/source/node_modules/gcs-resumable-upload/index.js:326
  this.configStore.del(this.file)
                   ^

TypeError: this.configStore.del is not a function
    at Upload.deleteConfig (/pipeline/source/node_modules/gcs-resumable-upload/index.js:326:20)
    at Request.<anonymous> (/pipeline/source/node_modules/gcs-resumable-upload/index.js:172:12)
    at emitTwo (events.js:111:20)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/pipeline/source/node_modules/request/request.js:1171:10)
    at emitOne (events.js:101:20)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (/pipeline/source/node_modules/request/request.js:1091:12)
    at IncomingMessage.g (events.js:291:16)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Thanks for reporting, fixed.

authors: lnlwd stephenplusplus

repo: stephenplusplus/gcs-resumable-upload


text:
Error: you must install the ZED SDK.

When I run setup.py build, I got this error.
However, I have installed ZED SDK for severl times. I am sure I installed it successfully because I can run the examples.
Anyon have some ideas? Thanks!
By the way, I am using Win10 and the prerequisites are satisfied.

C:\zed>python setup.py build
Error: you must install the ZED SDK.
Compiling pyzed/defines.pyx because it changed.
[1/1] Cythonizing pyzed/defines.pyx
Compiling pyzed/types.pyx because it changed.
[1/1] Cythonizing pyzed/types.pyx
Compiling pyzed/core.pyx because it changed.
[1/1] Cythonizing pyzed/core.pyx
Compiling pyzed/mesh.pyx because it changed.
[1/1] Cythonizing pyzed/mesh.pyx
Compiling pyzed/camera.pyx because it changed.
[1/1] Cythonizing pyzed/camera.pyx
running build
running build_py
running build_ext
building 'pyzed.defines' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\sjwhh\AppData\Local\Programs\Python\Python36\include -IC:\Users\sjwhh\AppData\Local\Programs\Python\Python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\winrt" /EHsc /Tppyzed/defines.cpp /Fobuild\temp.win-amd64-3.6\Release\pyzed/defines.obj
defines.cpp
pyzed/defines.cpp(507): fatal error C1083: 无法打开包括文件: “sl/types.hpp”: No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

@sjwhhhi just got it myself. The setup.py is looking for an environment variable called ZED_INCLUDE_DIRS while the installation creates one called ZED_SDK_ROOT_DIR.
Short fix is to create it yourself and set it to where the "include" folder inside where ZEN SDK was installed for me it was C:\Program Files (x86)\ZED SDK\include

I also had this problem. Not only did you have to add ZED_INCLUDE_DIRS to your environment variables and point it to the include directory, but also ZED_LIBRARY_DIR pointed to the lib directory. Both are just the ZED_SDK_ROOT_DIR plus \include or \lib.

authors: Alonmeytal adambeytin sjwhhhi

repo: stereolabs/zed-python


text:
add support for password protected redis

please consider adding support for password protected redis

We have added authentication feature, thanks for suggestion.


text:
Feature request: Formatting on changed lines only

This may not be the right place to ask, but I was wondering: Is it possible to run the formatters automatically, but only for the new changes as per the git diff?
I would like to use Neovim for work, but I find that it changes code that I didn’t touch and makes my PRs unnecessarily long 😅

conform supports range formatting, so you could probably re-use a lot of the code in the injected formatter and pass in git diff ranges instead of treesitter ranges

I see!
I would only add that - if this feature gets implemented - it may make sense to enable this on a per-formatter basis.
For eg. I would only want golines to take effect in lines I've changed, but it would make sense to have goimports trigger every time I change a file as for the order of the imports to be correct, the whole context (all of the imports) need to be passed into the formatter - not just the import lines that were changed.
Thanks for taking this feature request into consideration :)

Here's a command I made for this, maybe it could be used a reference for a future PR:
vim.api.nvim_create_user_command('DiffFormat', function()
  local lines = vim.fn.system('git diff --unified=0'):gmatch('[^\n\r]+')
  local ranges = {}
  for line in lines do
    if line:find('^@@') then
      local line_nums = line:match('%+.- ')
      if line_nums:find(',') then
        local _, _, first, second = line_nums:find('(%d+),(%d+)')
        table.insert(ranges, {
          start = { tonumber(first), 0 },
          ['end'] = { tonumber(first) + tonumber(second), 0 },
        })
      else
        local first = tonumber(line_nums:match('%d+'))
        table.insert(ranges, {
          start = { first, 0 },
          ['end'] = { first + 1, 0 },
        })
      end
    end
  end
  local format = require('conform').format
  for _, range in pairs(ranges) do
    format {
      range = range,
    }
  end
end, { desc = 'Format changed lines' })

In case someone is interested. Similar to the above command, but using gitsigns to to get the hunks:
function()
  local hunks = require("gitsigns").get_hunks()
  local format = require("conform").format
  for _, hunk in pairs(hunks) do
    if hunk ~= nil then
      local start = hunk.added.start
      local last = start + hunk.added.count
      -- nvim_buf_get_lines uses zero-based indexing -> subtract from last
      local last_hunk_line = vim.api.nvim_buf_get_lines(0, last - 2, last - 1, true)[1]
      local range = { start = { start, 0 }, ["end"] = { last - 1, last_hunk_line:len() } }
      format({ range = range })
    end
  end
end

another update: in the previous snipped, the command doesn't return until everything is reformatted, which sometimes takes a while. The following snipped does it asynchronously.
I only tested it with clang-format.
function()
  local ignore_filetypes = { "lua" }
  if vim.tbl_contains(ignore_filetypes, vim.bo.filetype) then
    vim.notify("range formatting for " .. vim.bo.filetype .. " not working properly.")
    return
  end

  local hunks = require("gitsigns").get_hunks()
  if hunks == nil then
    return
  end

  local format = require("conform").format

  local function format_range()
    if next(hunks) == nil then
      vim.notify("done formatting git hunks", "info", { title = "formatting" })
      return
    end
    local hunk = nil
    while next(hunks) ~= nil and (hunk == nil or hunk.type == "delete") do
      hunk = table.remove(hunks)
    end

    if hunk ~= nil and hunk.type ~= "delete" then
      local start = hunk.added.start
      local last = start + hunk.added.count
      -- nvim_buf_get_lines uses zero-based indexing -> subtract from last
      local last_hunk_line = vim.api.nvim_buf_get_lines(0, last - 2, last - 1, true)[1]
      local range = { start = { start, 0 }, ["end"] = { last - 1, last_hunk_line:len() } }
      format({ range = range, async = true }, function()
        vim.defer_fn(function()
          format_range()
        end, 1)
      end)
    end
  end

  format_range()
end

NOTE: this hasn't been tested thoroughly and editing the file, while it is being formatted in the asynchronously might mess things up. Also note: it is important to go through the hunks in reverse order to make sure that the formatting does not affect line numbers of subsequent hunks,

Here's another implementation with mini.diff, you can use it with mini.git or gitsigns as diff source.
      local diff_format = function()
        local data = MiniDiff.get_buf_data()
        if not data or not data.hunks then
          vim.notify("No hunks in this buffer")
          return
        end
        local format = require("conform").format
        -- stylua range format mass up indent, so use full format for now
        if vim.tbl_contains(range_ignore_filetypes, vim.bo.filetype) then
          format({ lsp_fallback = true, timeout_ms = 500 })
          return
        end
        local ranges = {}
        for _, hunk in pairs(data.hunks) do
          if hunk.type ~= "delete" then
            -- always insert to index 1 so format below could start from last hunk, which this sort didn't mess up range
            table.insert(ranges, 1, {
              start = { hunk.buf_start, 0 },
              ["end"] = { hunk.buf_start + hunk.buf_count, 0 },
            })
          end
        end
        for _, range in pairs(ranges) do
          format({ lsp_fallback = true, timeout_ms = 500, range = range })
        end
      end

NOTE: this hasn't been tested thoroughly and editing the file, while it is being formatted asynchronously in the background might mess things up. Also note: it is important to go through the hunks in reverse order to make sure that the formatting does not affect line numbers of subsequent hunks,

And I tested this code with async = true, it does fail sometime, so I'm using sync format in here.

Thanks everyone.
I'm kinda new in neovim and conform .
I wanted to make this default behavior of format_on_save in my environment, like the way in vscode:
{
"editor.formatOnSaveMode": "modificationsIfAvailable",
}
I want conform to check if there is git hunks there. and format the code based on that. but if not using git for file. format the whole document.
another thing is, consider python i use isort and ruff, i want Isort format the imports no matter what but ruff checks for git hunks first.
the above code snippets works and created a DiffFormat command . but I don't know how I can make it the default behavior of conform and specific formatters can someone please help me with this ?

Thanks everyone. I'm kinda new in neovim and conform . I wanted to make this default behavior of format_on_save in my environment, like the way in vscode:
{
  "editor.formatOnSaveMode": "modificationsIfAvailable",
}

I want conform to check if there is git hunks there. and format the code based on that. but if not using git for file. format the whole document. another thing is, consider python i use isort and ruff, i want Isort format the imports no matter what but ruff checks for git hunks first. the above code snippets works and created a DiffFormat command . but I don't know how I can make it the default behavior of conform format_on_save and specific formatters . can someone please help me with this ?

I wanted the same feature as you did, and I got one solution: https://github.com/joechrisellis/lsp-format-modifications.nvim

Thanks everyone. I'm kinda new in neovim and conform . I wanted to make this default behavior of format_on_save in my environment, like the way in vscode:
{
  "editor.formatOnSaveMode": "modificationsIfAvailable",
}

I want conform to check if there is git hunks there. and format the code based on that. but if not using git for file. format the whole document. another thing is, consider python i use isort and ruff, i want Isort format the imports no matter what but ruff checks for git hunks first. the above code snippets works and created a DiffFormat command . but I don't know how I can make it the default behavior of conform format_on_save and specific formatters . can someone please help me with this ?

For anyone that is interested in this kind of behavior, I got it working by using the function provided by @linusboehm and then adding this to the format_on_save option:
local function format_hunks()
  -- Logic to format only the hunks in the file
end

require("conform").setup({
  -- options,
  format_on_save = function()
    -- Prefer to format git hunks instead of the entire file
    format_hunks()
  end,
})

I'm still testing this but so far, I haven't had any issues.
And in case you still want to format the entire file, you can create a keymap to do so:
vim.keymap.set({ "n", "v" }, "<leader>cf", function()
  conform.format(default_format_options)
end, { desc = "Format File or Range (visual mode)" })

authors: ArMot YuYuCong diogox linusboehm pgzm29 ribru17 stevearc wenjinnn


text:
bug: Strange toggleterm output. "exit $?"

Neovim version (nvim -v)
0.10
Operating system/version
Linux
Describe the bug

When I run a task I always see the strange output  "exit$" at the beginning and at the end. It's pretty ugly. How can this be fixed? I use overseer with integration for toggleterm
What is the severity of this bug?
minor (annoyance)
Steps To Reproduce

Install my repo
Run any task using overseer

Expected Behavior

I want to see only this
Minimal example file
// rust file
fn main() {
    let var = 2;
    println!("Hello, world!");
}

Minimal init.lua
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  { "stevearc/dressing.nvim", config = true },
  {
  'stevearc/overseer.nvim',
  cmd = { "OverseerRun", "OverseerRestartLast" },
  config = function()
    require("overseer").setup({
      templates = { "builtin", "user.cpp_build" },
      ---@diagnostic disable-next-line: assign-type-mismatch
      strategy = {
        "toggleterm",
        -- load your default shell before starting the task
        use_shell = true,
        -- overwrite the default toggleterm "direction" parameter
        direction = "tab",
        -- have the toggleterm window close and delete the terminal buffer
        -- automatically after the task exits
        close_on_exit = false,
        -- have the toggleterm window close without deleting the terminal buffer
        -- automatically after the task exits
        -- can be "never, "success", or "always". "success" will close the window
        -- only if the exit code is 0.
        quit_on_exit = "never",
        -- open the toggleterm window when a task starts
        open_on_start = true,
        -- mirrors the toggleterm "hidden" parameter, and keeps the task from
        -- being rendered in the toggleable window
        hidden = false,
      },
    })
  end,
},
{
    'akinsho/toggleterm.nvim',
    version = "*",
    lazy = true,
    config = function()

      require("toggleterm").setup({
        open_mapping = "<C-t>",
        autochdir = true,
        terminal_mappings = true,
        shade_terminals = false,
        direction = "float",
        float_opts = {
          title_pos = "center",
        },
      })

      vim.api.nvim_command 'autocmd TermOpen * startinsert' -- starts in insert mode
      vim.api.nvim_command 'autocmd TermOpen * setlocal nonumber' -- no numbers
      vim.api.nvim_command 'autocmd TermEnter * setlocal signcolumn=no' -- no sign column
      vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Go to normal mode' })
    end
  }
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Additional context
No response

UPDATE: I don't see this text if I set " use_shell = false". But it doesn't suit me because I still want to see the commands that have been run

UPDATE: I don't see this text if I set " use_shell = false". But it doesn't suit me because I still want to see the commands that have been run

I run into the same problem. This also breaks the safety check for terraform apply in my case:


text:
Overriding :object in #permitted_to? should change skip_attribute_test

Consider the following
    role :employee do
      has_permission_on :foo do
        if_attribute :has_special_permission? => is{true}
      end
    end

    class User < ActiveRecord::Base
      def has_special_permission?
         #fancy permission logic
      end
    end

    class FooController
      filter_access_to :index, attribute_check: true
    end

    <% if permitted_to?(:show, :foo, object: current_user) %>
      <!-- this link is scattered throughout the app -->
      <%= link_to "Foo", foo_path %>
    <% end %>

The intent here is that we have a non-resourceful controller and we want to check that a particular user has permission for this controller based on non-trivial logic buried in the User model.
The problem is in: https://github.com/stffn/declarative_authorization/blob/master/lib/declarative_authorization/in_controller.rb#L195
where :skip_attribute_test is determined based on the object variable which has not yet been overridden by the merge of the options passed in. So if object is present in the override hash, :skip_attribute_test does not seem to reflect the intended behavior, which is: if object is present, don't skip the attribute test.
Is this a bug or is there a different way I should be accomplishing this?
Thanks!

Just realized this can be worked around by explicitly passing in :skip_attribute_test like so:
<% if permitted_to?(:show, :foo, object: current_user, skip_attribute_test: false) %>


text:
building with stable rust instead of nightly

I would like to use this crate without having to rely on the nightly toolchain. I could build clingo-rs with the stable toolchain (using rust 1.31) after replacing std::ptr::Unique with std::ptr::NonNull (according to https://github.com/rust-lang/rust/issues/27730, Unique will remain unstable for ever).
After this change, "cargo test" fails (but it was already failing before) but all examples seem to run properly.
Do you think it is a valid change or is there something which can be corrupted by using NonNull instead of Unique?

Yes, doc tests are failing because of some example code in the doc strings.
I should add an ignore to this code.
For replacing Unique:
I'm not an expert on this, but from what I read it is probably the safer to use *mut T.
Do you have other reasons to use NonNull?

I'm new to rust and I'm not sure why Unique was here in the first place so I mostly tried NonNull after getting the following compiler message:
use of unstable library feature 'ptr_internals': use NonNull instead and consider PhantomData (if you also use #[may_dangle]), Send, and/or Sync
From what I understand, replacing Unique with NonNull is trivial and makes it clear that the pointer is valid, while switching to *mut seems to require slightly more work .

2 match blocks are used to guard the creation of the struct holding the pointer, they can be replaced by a direct is_null() check
it is accessed through as_ptr() everywhere else, so there are about 20 such calls to remove.

The build and example work with these two options, I can prepare a pull request with the one you prefer.

With using NotNull you give the compiler a guarantee so checks can be optimized. The guarantees are actually weaker than Unique so replacing it should not create safety problems.

authors: aurelien-naldi sthiele

repo: sthiele/clingo-rs


text:
pyads with wireless network?

Can the pyads work normal with a wireless network?

Yes as long as the route can be established, but i wouldn't rely on wireless. You may start getting into trouble with Connection errors  etc.

repo: stlehmann/pyads


text:
I2C, SPI, and other peripherals should require their respective DMA channels

Currently, it's possible to configure the SPI1 and I2C1 peripherals like this:
            let sda = gpiob.pb7.into_alternate_af1(cs);
            let scl = gpiob.pb6.into_alternate_af1(cs);

            let i2c = hal::i2c::I2c::i2c1(p.I2C1, (scl, sda), 100.khz(), &mut rcc);

            let sck = gpioa.pa5.into_alternate_af0(cs);
            let miso = gpioa.pa6.into_alternate_af0(cs);
            let mosi = gpioa.pa7.into_alternate_af0(cs);

            let spi = hal::spi::Spi::spi1(
                p.SPI1,
                (sck, miso, mosi),
                ws2812_spi::MODE,
                3_000.khz(),
                &mut rcc,
            );

However, this configuration doesn't actually work since on most STM32F0xx parts, SPI1 and I2C1 share DMA channels 2 (TX) and 3 (RX). Even if you don't use the DMA features, the attempt to share resources puts both peripherals into a bad state. On STM32F07x parts we could use the I2C1_DMA_RMP or SPI1_DMA_RMP bits in SYSCFG_CFGR1 to remap one of the two peripherals to use channels 6&7, so any API for this will need to support that somehow.
This also raises a related concern, which is that there doesn't seem to be a safe way to disable peripherals. My expectation would be that the release() methods would disable them, but looking at the implementations that doesn't seem to be the case. To support it, we'd probably have to pass the RCC into release().

Even if you don't use the DMA features, the attempt to share resources puts both peripherals into a bad state.

Is that so? I've done it before without problems and CubeMX also doesn't complain about that combination.

This also raises a related concern, which is that there doesn't seem to be a safe way to disable peripherals. My expectation would be that the release() methods would disable them, but looking at the implementations that doesn't seem to be the case. To support it, we'd probably have to pass the RCC into release().

I agree. We could also do it using a criticial section instead of taking a RCC parameter.

Is that so? I've done it before without problems and CubeMX also doesn't complain about that combination.

On an STM32F042k6, if I try to enable both peripherals using the code above the I2C peripheral gets stuck waiting for the TXIs flag to go low. Maybe it's only on these smaller parts that there is an issue? I don't have a logic analyzer (yet) so I don't know what the bus is actually doing... I'll try to track that down sometime next week when it arrives.

I agree. We could also do it using a criticial section instead of taking a RCC parameter.

That feels a little heavyweight -- what should compile down to a single register read-modify-write would require enabling/disabling interrupts. I don't know how expensive that is on the STM32s though, so maybe it's fine.

On an STM32F042k6, if I try to enable both peripherals using the code above the I2C peripheral gets stuck waiting for the TXIs flag to go low. Maybe it's only on these smaller parts that there is an issue?

The STM32F042 is one of my goto devices. Haven't seen the problem there. I can try to specifically reproduce with your suggested configuration the next couple of days. I also do have oscilloscope and logic analyser if needed.

That feels a little heavyweight -- what should compile down to a single register read-modify-write would require enabling/disabling interrupts. I don't know how expensive that is on the STM32s though, so maybe it's fine.

Costs a few cycles, no biggie. I wouldn't expect someone to release peripherals frequently and in performance sensitive code anyway.

I had a chance to play with this some more this evening, and it seems like the issue is related to conflicting pin assignments. If I configure only pin pa7 to AF0 (and don't start the SPI peripheral), I2C keeps working. Configuring any of the other pins used above (PA5 or PA6) to AF0 breaks the I2C peripheral.

I just checked https://www.st.com/resource/en/errata_sheet/dm00108473.pdf and couldn't find anything related. Still haven't had time to look at the hardware yet.

Okay, just tried it on the STM32F072DISCO, no such problem. Did you forget the pull-up maybe and this really is an electrical problem? (Just curious because I always use the internal pull-ups but your example code doesn't).

FWIW I've added a working I2C example (without the SPI pin configuration, but it's easy to copy them in from above) here: https://github.com/stm32-rs/stm32f072b-disco/blob/master/examples/i2c_hal_ssd1306alphabeter.rs

I was able to get things working using the following pin configuration:
             let sck = gpiob.pb3.into_alternate_af0(cs);
             let miso = gpiob.pb4.into_alternate_af0(cs);
             let mosi = gpiob.pb5.into_alternate_af0(cs);

             let sda = gpiob.pb7.into_alternate_af1(cs);
             let scl = gpiob.pb6.into_alternate_af1(cs);

This is the configuration recommended by ST for SPI peripheral on NUCLEO-F042K6 boards.
I don't /think/ it's an electrical problem, since:

The I2C bus works fine when the SPI peripheral isn't configured
There are external pullups on the SDA and SCL lines.

Looking at the output from a logic analyzer, it seems like the SPI data is showing up on I2C1 SDA (i.e. PB7).

Well, don't know what to tell you or do about it. Neither my own tests nor the documentation nor the datasheets nor the errata agree with your discoveries.
I guess this one of the "Doctor, doctor, it hurts when I do this..." cases.

That does seem to be the case =). Playing with it some more, it seems like attaching SPI1 to anything on GPIOA causes the whole GPIO frontend to fall over hard enough that it can't even wiggle pins? I don't have the tools to really debug this further, so I think I'll just close this out.

authors: bobtwinkles therealprof


text:
Added function to return Model Id

Added function to return the word from register Model_ID (0x010F) per the datasheet.
Note that my Adafruit VL53L4CX Time of Flight Distance Sensor returns 0xEBAA for the word at index 0x010F, the same as the VL53L4CD sensor, and not the value of 0xEAAA documented in the VL53L4CX datasheet (3.2 I2C interface - reference registers).
Could Adafruit have happened to integrate the VL53L4CD sensor into their “VL53L4CX” device? I’ll have to inquire with Adafruit.

Hello @ChuckVanzant ,
actually the output that you read is compatible with the Datasheet of VL53L4CX.

Best Regards,
Carlo

authors: ChuckVanzant cparata


text:
Documentation typo

On page 39 of the NEO430.pdf, I think you meant to say "stack" where you have heap:
3.1.2. Dynamic Memory
The remaining memory – so the memory after the .data section until the end of the RAM – is used for the
dynamic data during run time. This data includes the stack and the heap. The stack grows from the end of the memory down to the end of the .data section. The heap grows from the end of the .data section up to the end of the memory. Make sure there is no collision between the heap and the stack when using dynmic
memory allocation!

Thanks for the hint!
I have corrected that and I will update the documentary with the next commit.

authors: RickKimball stnolting


text:
Fix comment mistake

Hi @stnolting!
There is a little mistake in this comment. According to definition of custom instruction R4 type the bit-field is funct3 not funct7.
Regarts!

Thanks for fixing! 👍


text:
Support for Symfony 4

Fixes #354

Works for me 👍

@stof removed that .idea from .gitignore

Works for me too (y)

@stof we need this bundle soon :+1:

Oh please merge this!

+1 Pretty please, @stof!

Both #355 and this PR are 👍 for me. This bundle already has only private services and I can't see any other issues with this bundle and 4.0.
AND, I've just tested this bundle extensively with 4.0 and Flex and could not find any issues. Here is a Flex 4.0 project using this bundle: I was even able to activate ALL the listeners and everything looked just fine: https://github.com/weaverryan/stof_doctrine_extensions_40_test
@stof could we have a merge and tag? Personally, this is blocking our KnpU "Upgrade to Symfony4" tutorial :).
Thanks!

ping

@stof is there an ETA on this merge?

@stof Thanks for the merge. Could you tag now? Are there any issues that need to be addressed before creating a tag?

tag please

authors: ad3n christoph-hautzinger jaikdean lucasmezencio reganlawton stayeronglass tarlepp tehplague weaverryan

repo: stof/StofDoctrineExtensionsBundle


text:
Strings for AWS private

https://github.com/stolostron/backlog/issues/20859

/cc @Randy424

repo: stolostron/console


text:
fix issue about importing hosted hub

Summary
Related issue(s)
Fixes #

/retest

/retest

/retest

/retest

/retest

/cc @clyang82 @yanmxa

repo: stolostron/multicluster-global-hub


text:
[release-2.9] upgrade to go 1.20 (#1196)

upgrade to go 1.20

remove deprecated -i go flag

/lgtm

/retest

/test test-e2e

/test test-e2e

/test test-e2e

/retest

/retest

authors: dislbenn subbarao-meduri


text:
❓ Question:  How to set the local user PUID and GUID?

🙋♂ Question
Hi - I noticed in your release v0.18.1 that local users are supported instead of the root user.
How do I set this?  Do I have to set an environment variable for e.g., UID and GID?
Thanks!

This isn't possible but feel free to create a feature request. In v0.18.0 the permissions were changed but there wasn't an option to set UID and GID.


text:
[SO-194] Prism (v3) : Integration tests for ?__example=examplename

SO-194
Checklist

~[ ] Tests have been added (for bug fixes / features)~
~[ ] Docs have been added / updated (for bug fixes / features)~

What kind of change does this PR introduce
Adding tests for an already existing functionality.
What is the current behavior
No change in the functionality itself.

Agree with @XVincentX we want to show example selection is doing its thing, we should also have a third test which shows what happens when an invalid example is requested.
Does it error or just ignore it and pretend you didn’t even request an example?

You should receive an error message if the example you're selecting is not existing.

@phil, @XVincentX, I think that the concerns are addressed now. Can one of you approve if OK?

Nicely done, merge away!

authors: XVincentX lag-of-death philsturgeon

repo: stoplightio/prism


text:
Action Mock Return Response

I have a component where I pass in a function prop which will return a specific object which will end up putting the component in another state. I'd like to see the action addon method have an extra parameter which would contain the mocked response for the action.
For example:
class x extends React.Component {
  handleValidate = (e) => {
    const result = this.props.validate(e.target.value);
    if (!result.validated) {
       this.setState({ errors: result.errors });
    }
  }

  render() {
    return (
      <label>
        <input onChange={this.handleValidate} />
        {this.state.errors ? <span>{this.state.errors}</span> : null}
      </label>
    );
  }
}

So the story would be:
storiesOf(...)
  .add('will validate', (
    <x validator={action('validator', { validated: true } )} />
  ))
  .add('fails validation', (
    <x validator={action('validator', { validated: false, errors: 'bad result' } )} />
  ))

Why not
storiesOf(...)
  .add('will validate', (
    <x validator={() => ({ validated: true })} />
  ))
  .add('fails validation', (
    <x validator={() => ({ validated: false, errors: 'bad result' })} />
  ))

If you additionally want action for the logging purposes, you can even call action yourself:
  .add('will validate', (
    <x validator={(...args) => {
        action('validator')(...args)
        return ({ validated: true })
    }} />
  ))

which you can extract into a helper function / addon.
IMHO: addon is just there just for mocking and logging purposes, I don't see your use case as a part of that.

Here's the helper you need:
import {action} from '@storybook/addon-actions'

export const actionWithReturn = (name, returnValue) =>  (...args) => {
  action(name)(...args)
  return returnValue
}

authors: Hypnosphi baohx2000 inyono

repo: storybooks/storybook