text:
STM32 RTC sub seconds support

Implement support for handling the sub second registers.

I haven't payed attention to that earlier, but the clock source was checked incorrectly. I've fixed that in the new, first commit.

Sorry for the delay, I'm working on the comments now.

Please add some (at least minimal) way to get this compiled in CI

Do you have any suggestions how to do it?

Do you want me to do anything else?

Do you want me to do anything else?

Not for now, but before approving I'd like to make some tests or at least compile on few configurations.
This will also let time for others to review.

Here is the log:
*** Booting Zephyr OS build zephyr-v3.4.0-2458-gcfb5f828b708 ***
Running TESTSUITE counter_basic
===================================================================
START - test_all_channels
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing rtc@40002800
PASS - test_all_channels in 4.022 seconds
===================================================================
START - test_cancelled_alarm_does_not_expire
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing rtc@40002800
PASS - test_cancelled_alarm_does_not_expire in 7.891 seconds
===================================================================
START - test_late_alarm
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Skipped for rtc@40002800
PASS - test_late_alarm in 0.813 seconds
===================================================================
START - test_late_alarm_error
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Skipped for rtc@40002800
PASS - test_late_alarm_error in 0.813 seconds
===================================================================
START - test_multiple_alarms
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Skipped for counter
Skipped for counter
Skipped for rtc@40002800
PASS - test_multiple_alarms in 1.083 seconds
===================================================================
START - test_set_top_value_with_alarm
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Skipped for rtc@40002800
PASS - test_set_top_value_with_alarm in 1.576 seconds
===================================================================
START - test_short_relative_alarm
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing rtc@40002800
Assertion failed at WEST_TOPDIR/zephyr/tests/drivers/counter/counter_basic_api/src/test_counter.c:801: test_short_relative_alarm_instance: (i + 1 not equal to cnt)
rtc@40002800: Expected 6 callbacks, got 5
FAIL - test_short_relative_alarm in 0.753 seconds
===================================================================
START - test_single_shot_alarm_notop
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing rtc@40002800
Assertion failed at WEST_TOPDIR/zephyr/tests/drivers/counter/counter_basic_api/src/test_counter.c:403: test_single_shot_alarm_instance: (0 not equal to err)
rtc@40002800: Counter set alarm failed (err: -16)
FAIL - test_single_shot_alarm_notop in 1.221 seconds
===================================================================
START - test_single_shot_alarm_top
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Skipped for rtc@40002800
PASS - test_single_shot_alarm_top in 1.303 seconds
===================================================================
TESTSUITE counter_basic failed.
Running TESTSUITE counter_no_callback
===================================================================
START - test_set_top_value_without_alarm
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Testing counter
Skipped for rtc@40002800
PASS - test_set_top_value_without_alarm in 0.848 seconds
===================================================================
TESTSUITE counter_no_callback succeeded
------ TESTSUITE SUMMARY START ------
SUITE FAIL -  77.78% [counter_basic]: pass = 7, fail = 2, skip = 0, total = 9 duration = 19.475 seconds
- PASS - [counter_basic.test_all_channels] duration = 4.022 seconds
- PASS - [counter_basic.test_cancelled_alarm_does_not_expire] duration = 7.891 seconds
- PASS - [counter_basic.test_late_alarm] duration = 0.813 seconds
- PASS - [counter_basic.test_late_alarm_error] duration = 0.813 seconds
- PASS - [counter_basic.test_multiple_alarms] duration = 1.083 seconds
- PASS - [counter_basic.test_set_top_value_with_alarm] duration = 1.576 seconds
- FAIL - [counter_basic.test_short_relative_alarm] duration = 0.753 seconds
- FAIL - [counter_basic.test_single_shot_alarm_notop] duration = 1.221 seconds
- PASS - [counter_basic.test_single_shot_alarm_top] duration = 1.303 seconds
SUITE PASS - 100.00% [counter_no_callback]: pass = 1, fail = 0, skip = 0, total = 1 duration = 0.848 seconds
- PASS - [counter_no_callback.test_set_top_value_without_alarm] duration = 0.848 seconds
------ TESTSUITE SUMMARY END ------
===================================================================
RunID: c68cf89ac73c546729e0323ac92016ff
PROJECT EXECUTION FAILED

Thanks for the logs. How do you run the tests? It's executed on the nucleo_f429zi board, right? I've ordered the board to do it on my side and make sure everything is working fine. I should be able to reproduce the tests in a few days.

I've managed to reproduce the tests on the nucleo_f429zi board. Working on the fix.

I've debugged the problem.
The test failures occur when 1 tick alarm is programmed. For example  test_short_relative_alarm test checks the 1 tick alarm 100 times. The alarm is not triggered in ~20% cases.
I've noticed that the alarm doesn't occur when it is programmed one tick before deadline. It is a case when one tick occurs during the calculation of register values in the set_alarm function. IMO it still should work, but I started reading the reference manual one more time and I found the sentence Each change of the RTC_CR register is taken into account after 1 to 2 RTCCLK clock cycles due to clock synchronization..
I think it means 1 tick alarm won't work for RTC with subseconds and an additional check should be added that the relative minimum tick value is 2.
Please let me know what you think.

@erwango Please let me know what you think.

It seems there's a good amount of drivers dealing with such cases already. See STM32 timer based counter driver for instance.
Would you be able to apply the same in current case ?

@erwango Please let me know what you think.

It seems there's a good amount of drivers dealing with such cases already. See STM32 timer based counter driver for instance. Would you be able to apply the same in current case ?

I had to use a bit different detection method. It works fine and passes all testes.

I had to use a bit different detection method. It works fine and passes all testes.

Thanks I'll have a look once I have free time.
Just a side note, when updating a PR, please don't rebase at the same time. This prevents to easily see the diff using the [compare](https://github.com/zephyrproject-rtos/zephyr/compare/6b87b0597c6b94fb6b4b25474f5e4c473c1ffa6d..6ce4d587861db359b7e36337b55e7f4669f70c69) button provided by github and  we have to review the whole change again.
If rebase is really required, please proceed in 2 steps:
rebase and force push then update PR and force push (or in the order that better suit you).
If everyone would do the same, it would save a lot of time to reviewers.

Just a side note, when updating a PR, please don't rebase at the same time. This prevents to easily see the diff using the [compare](https://github.com/zephyrproject-rtos/zephyr/compare/6b87b0597c6b94fb6b4b25474f5e4c473c1ffa6d..6ce4d587861db359b7e36337b55e7f4669f70c69) button provided by github and we have to review the whole change again. If rebase is really required, please proceed in 2 steps: rebase and force push then update PR and force push (or in the order that better suit you).
If everyone would do the same, it would save a lot of time to reviewers.

Thanks for the tip. I just noticed how it works.

Sorry for the noise. I run the auto-formatter

Thanks for the comments. I should have done the requested changes by myself.

authors: erwango semihalf-niedzwiecki-dawid


text:
doc: README.rst added to subsys/console/echo sample

README added to the console echo sample

Morning, can someone else review this please?

Morning, can someone else review this please?

@nashif @carlescufi @kartben

source: gharchive/pull-request

repo: zephyrproject-rtos/zephyr

license_type: permissive

license_source: github-api


text:
doc: usermode: Improve documentation

The documentation related to dynamic object is hidden. Affects k_object_alloc(), etc functions.

Use __DOXYGEN__ in code, see examples in tree

Changed this way.


text:
doc: fix doc misspellings in doc, boards, samples

Occasional spelling-check scan found some misspellings.
Signed-off-by: David B. Kinder david.b.kinder@intel.com

Codecov Report

Merging #6953 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #6953   +/-   ##
=======================================
  Coverage   55.63%   55.63%
=======================================
  Files         462      462
  Lines       44567    44567
  Branches     8296     8296
=======================================
  Hits        24794    24794
  Misses      16381    16381
  Partials     3392     3392

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b78225...4b50d65. Read the comment docs.

authors: codecov-io dbkinder


text:
drivers:lpadc:enable nxp lpadc acquisition time feature

Enable nxp lpadc acquisition time feature, acquisition time can be expressed in microseconds, nanosecond, and ADC tickets, this patch has been processed these three different situations. When the input acquisition time unit is ADC tickets, it only needs to be matched with the elements in the sample time array. If the input acquisition time unit is nanoseconds or microseconds, first convert the unit of the elements in the sample time array from ADCK to nanoseconds, and then use the dichotomy to match the option closest to the acquisition time from the sample time array.

please read https://docs.zephyrproject.org/latest/contribute/contributor_expectations.html#contributor-expectations
this commit needs to be split up to multiple before it will be reviewed, see other PRs for examples

please read https://docs.zephyrproject.org/latest/contribute/contributor_expectations.html#contributor-expectations
this commit needs to be split up to multiple before it will be reviewed, see other PRs for examples

please read https://docs.zephyrproject.org/latest/contribute/contributor_expectations.html#contributor-expectations
this commit needs to be split up to multiple before it will be reviewed, see other PRs for examples

Thanks for your reminder, I updated the PR and split it into four commits, but the PR was accidentally closed by me. Can you please help me reopen it? Thanks.

could anyone help to review this PR? Thanks a lot.

@yvanderv please review the copyright changes of files that did not have NXP copyright, I don't know the rule here

The commits are well structured except for the fact that they are in a backwards order. You need to put the clock control commit first, then DTS changes, then the driver changes, then the sample overlays. This I think will ensure bisectibility of the commit history.
I still have to review the mcux_lpadc_acquisition_time_setup function more closely but first help me to understand why you are using floating point arithmetic so I have some better background about the code. Since floating point arithmetic will incur a cost on the platforms without an FPU especially there must be a reason?

Sorry for the late commit sequence update. The reason for using the float point type is the float point value are introduced when calculating the ADC period based on the ADC clock.

I am still confused why does adc_cycle_ns even need to be a float? It is being used to calculate the float sample_time_array values, but then these values are later casted to an int when used. Can't all of these be long ints perhaps? Or am I missing something

I am still confused why does adc_cycle_ns even need to be a float? It is being used to calculate the float sample_time_array values, but then these values are later casted to an int when used. Can't all of these be integer types perhaps? Or am I missing something

Why I think the variable adc_cycle_ns needs to be set to a floating point type, I would like to give an example to illustrate. Under NXP LPC55S36 platform, the default ADC clock frequency is 48MHz, so the ADC cycle is approximately 20.833 ns (if variable adc_cycle_ns is set to an integer type, then this number is 20).
case1(float point type, 20.833):
sample_time_array[0] = 20.833 * 3 =  62.499 ns
sample_time_array[1] = 20.833 * 5 = 104.165 ns
if the parameter ADC acquisition time passed by the application layer is 82ns, then the option kLPADC_SampleTimeADCK3 will be set to the corresponding bitfield.
case1(integer type, 20):
sample_time_array[0] = 20 * 3 =  60 ns
sample_time_array[1] = 20 * 5 = 100 ns
if the parameter ADC acquisition time passed by the application layer is 82ns, then the option kLPADC_SampleTimeADCK5 will be set to the corresponding bitfield.
If we use integer type in the code, the accuracy of the calculation results decreases. At this clock frequency (48MHz), and application configuration options (82ns), the optimal configuration item should be  kLPADC_SampleTimeADCK3.
Currently, my local code has changed the ADC sample time array (sample_time_array) to the integer type. The reason is that converting the final calculation result into an integer will not cause too much loss of accuracy, and at the same time reduces the calculation pressure of chips without FPU platforms (the subsequent calculation process uses array elements to compare with the acquisition_time_value).
for example
sample_time_array[0] = 20.833 * 3 =  62.499 ns = 62
sample_time_array[1] = 20.833 * 5 = 104.165 ns = 104
if the parameter ADC acquisition time passed by the application layer is 82ns, then the option kLPADC_SampleTimeADCK3 will be set to the corresponding bitfield.

Recreate a new PR (https://github.com/zephyrproject-rtos/zephyr/pull/70636) based on the nxp-upstream repository.

authors: ZhaoxiangJin decsny


text:
sensors: hts221: Fix a crash due to bad device init

The hts221 requires 2.2 ms at boot time to download
the flash content into the volatile mem and the
calibration values cannot be read before that.
This issue is causing following crash:
***** USAGE FAULT *****
Executing thread ID (thread): 0x20000234
Faulting instruction address:  0x80037de
Division by zero
Fatal fault in essential thread! Spinning...
Signed-off-by: Armando Visconti armando.visconti@st.com

@erwango @ydamigos
Area is sensor. I noticed this crash and I debugged the issue.
The 2.2 ms it is not stated anywhere, but I asked internally to
the application team .

Codecov Report

Merging #7401 into master will decrease coverage by <.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #7401      +/-   ##
==========================================
- Coverage   55.26%   55.26%   -0.01%
==========================================
  Files         467      467
  Lines       51641    51641
  Branches     9886     9886
==========================================
- Hits        28541    28540       -1
- Misses      19190    19191       +1
  Partials     3910     3910

Impacted Files
Coverage Δ

lib/posix/pthread.c
69.34% <0%> (-0.51%)
:arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5dc2ab4...03d2318. Read the comment docs.

authors: avisconti codecov-io


text:
boards: arm: doc: Add I2C feature and serial port section

This patch add I2C to supported features and I2C section for
96b_carbon, nucleof401re and olimexino_stm32
It also adds serial port section to 96b_carbon and olimexino_stm32
Signed-off-by: Yannis Damigos giannis.damigos@gmail.com

Did this just to get shippable to verify it, not sure what happened there


text:
drivers: intc: plic: fix for SMP=n when MP_MAX_NUM_CPUS > 1

The functions to obtain the address are hardcoded to return the address of the first core when CONFIG_SMP != y, this causes an issue with enabling an IRQ when there are more than one core in the system (CONFIG_MP_MAX_NUM_CPUS > 1), as the driver would first enable the IRQ on the first core, and when it tries to obtain the address for the following cores and disable the IRQ on them, the functions continue to return the address of the first core, causing the IRQ to be disabled on the first core.
Fix this by determine if CONFIG_MP_MAX_NUM_CPUS > 1 instead of CONFIG_SMP=y when returning the address.
See https://github.com/zephyrproject-rtos/zephyr/pull/78681#issuecomment-2391954215
Ran
west build -p auto -t run -b qemu_riscv64/qemu_virt_riscv64/smp -T zephyr/samples/subsys/profiling/perf/sample.perf

and there's a prompt

@ycsin thanks for the quick turnaround on this

authors: fabiobaltieri ycsin


text:
doc: Add verification plan

Add general verification and kernel verification plan
Signed-off-by: Spoorthi K spoorthi.k@intel.com

Codecov Report

Merging #7987 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #7987   +/-   ##
=======================================
  Coverage   55.03%   55.03%
=======================================
  Files         481      481
  Lines       53936    53936
  Branches    10474    10474
=======================================
  Hits        29686    29686
  Misses      19981    19981
  Partials     4269     4269

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5405f68...607c70c. Read the comment docs.

@dbkinder : Thanks for your detailed review. I have addressed them. Can you please take another look?

please close this and submit it here zephyrproject-rtos/qm under doc/plans

Sure @nashif. I have created PR on zephyrproject-rtos/qm. https://github.com/zephyrproject-rtos/qm/pull/1. Please review.

authors: codecov-io nashif spoorthik


text:
net: app: Split code for configuring network to a separate lib, "config"

net_app library consisted of 2 disjoint parts: a) library to
setup/configure networking on the application startup; b) library
to setup client and server connections.
As the configuration library is universally useful and is a generic
Zephyr networking component, split it out to a seperate top-level
networking library under net/lib/config/.
Fixes: #7658
Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org

Codecov Report

Merging #8460 into master will decrease coverage by 2.18%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #8460      +/-   ##
==========================================
- Coverage   64.61%   62.43%   -2.19%
==========================================
  Files         421      381      -40
  Lines       40296    30109   -10187
  Branches     6803     4918    -1885
==========================================
- Hits        26038    18799    -7239
+ Misses      11125     9390    -1735
+ Partials     3133     1920    -1213

Impacted Files
Coverage Δ

subsys/net/lib/config/init.c
60.25% <ø> (ø)

subsys/net/lib/dns/dns_pack.h
0% <0%> (-90.48%)
:arrow_down:

subsys/net/lib/http/http_parser_url.c
1.71% <0%> (-70.86%)
:arrow_down:

subsys/net/ip/rpl.h
0% <0%> (-69.24%)
:arrow_down:

subsys/net/ip/route.c
4.42% <0%> (-48.57%)
:arrow_down:

subsys/net/ip/nbr.c
47.22% <0%> (-44.45%)
:arrow_down:

subsys/net/ip/utils.c
41.81% <0%> (-38.37%)
:arrow_down:

subsys/net/ip/ipv6.c
10.6% <0%> (-35.71%)
:arrow_down:

subsys/net/ip/ipv6.h
66.66% <0%> (-33.34%)
:arrow_down:

subsys/net/ip/net_mgmt.c
48.46% <0%> (-32.53%)
:arrow_down:

... and 66 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fc4fc65...4d62471. Read the comment docs.

@jukkar, @tbursztyka: This implements initial part of #7658. As mentioned there, I'd also like to rename Kconfig options to get rid of "APP_" there, and as we decided, use "config" instead of "settings" terminology. But such a change would affect almost each sample/test. I'm taking a some time off, so if you don't mind, would like this change first, and then work on Kconfig updates.

Ok makes sense.

authors: codecov-io pfalcon tbursztyka


text:
DirectAccess Apis don't work

steps
try to get any node info: disks ,processes,jobs,cpus
Issue
will result internal server error

0-orchestrator Error :
ERRO[1801] job 'd4009983-4ea9-4025-89c5-51772050e4b0' does not exist
172.30.222.222 - - [16/Jul/2017:09:56:33 +0000] "GET /nodes/248a07e64220/disks HTTP/1.1" 500 40

Software Version
master on 7bb604efcd33cf58fd37814389fa3e35a831ee73

Same for get container jobs and process

When https://github.com/zero-os/0-core/pull/440 gets merged we can update our vendor

software versions
master :  0675fcc

source: gharchive/issue

authors: Dinaamagdy ahmedelsayed-93 grimpy

license_source: bigquery


text:
implementation of task #1180" testcase

related to
https://github.com/zero-os/0-orchestrator/issues/1180

 % nosetests -s -v testcases/basic_tests/test07_vms_apis.py:TestVmsAPI.test012_create_two_vms_with_same_vdisk --tc-file config.ini
GAT-077 ... ok

----------------------------------------------------------------------
Ran 1 test in 170.839s

OK


text:
AssertionError: season, seasonAdvanced stats MLB API Issue

Output:
====================================== short test summary info ======================================

FAILED tests/external_tests/stats/test_catching.py::TestCatchingStats::test_catching_stat_attributes_player - AssertionError: 1 != 2
FAILED tests/external_tests/stats/test_catching.py::TestCatchingStats::test_catching_stat_attributes_team - AssertionError: 1 != 2
FAILED tests/external_tests/stats/test_fielding.py::TestPitchingStats::test_fielding_stat_attributes_player - AssertionError: 1 != 2
FAILED tests/external_tests/stats/test_fielding.py::TestPitchingStats::test_fielding_stat_attributes_team - AssertionError: 2 != 4
FAILED tests/external_tests/stats/test_hitting.py::TestHittingStats::test_hitting_bydate_stats_player - AssertionError: {} == {}
FAILED tests/external_tests/stats/test_hitting.py::TestHittingStats::test_hitting_bydayofweek_stats_player - AssertionError: {} == {}
FAILED tests/external_tests/stats/test_hitting.py::TestHittingStats::test_hitting_bymonth_stats_player - AssertionError: {} == {}
FAILED tests/external_tests/stats/test_hitting.py::TestHittingStats::test_hitting_excepected_stats_player - AssertionError: {} == {}
FAILED tests/external_tests/stats/test_hitting.py::TestHittingStats::test_hitting_hotcoldzones_stats_player - AssertionError: {} == {}
FAILED tests/external_tests/stats/test_hitting.py::TestHittingStats::test_hitting_pitchArsenal_stats_player - AssertionError: {} == {}
FAILED tests/external_tests/stats/test_hitting.py::TestHittingStats::test_hitting_pitchlog_stats_player - AssertionError: {} == {}
FAILED tests/external_tests/stats/test_hitting.py::TestHittingStats::test_hitting_stat_attributes_player - AssertionError: 2 != 4
FAILED tests/external_tests/stats/test_hitting.py::TestHittingStats::test_hitting_stat_attributes_team - AssertionError: 2 != 4
FAILED tests/external_tests/stats/test_hitting.py::TestHittingStats::test_hitting_vsteam_stats_team - AssertionError: {} == {}
FAILED tests/external_tests/stats/test_pitching.py::TestPitchingStats::test_pitching_bydate_stats_player - AssertionError: {} == {}
FAILED tests/external_tests/stats/test_pitching.py::TestPitchingStats::test_pitching_bydayofweek_stats_player - AssertionError: {} == {}
FAILED tests/external_tests/stats/test_pitching.py::TestPitchingStats::test_pitching_bymonth_stats_player - AssertionError: {} == {}
FAILED tests/external_tests/stats/test_pitching.py::TestPitchingStats::test_pitching_excepected_stats_player - AssertionError: {} == {}
FAILED tests/external_tests/stats/test_pitching.py::TestPitchingStats::test_pitching_hotcoldzones_stats_player - AssertionError: {} == {}
FAILED tests/external_tests/stats/test_pitching.py::TestPitchingStats::test_pitching_pitchArsenal_stats_player - AssertionError: {} == {}
FAILED tests/external_tests/stats/test_pitching.py::TestPitchingStats::test_pitching_pitchlog_stats_player - AssertionError: {} == {}
FAILED tests/external_tests/stats/test_pitching.py::TestPitchingStats::test_pitching_playlog_stats_player - AssertionError: {} == {}
FAILED tests/external_tests/stats/test_pitching.py::TestPitchingStats::test_pitching_stat_attributes_player - AssertionError: 2 != 4
FAILED tests/external_tests/stats/test_pitching.py::TestPitchingStats::test_pitching_stat_attributes_team - AssertionError: 2 != 4

Issues:
Team endpoint that should return hitting stats for season:
https://statsapi.mlb.com/api/v1/teams/133/stats?stats=season,career&group=hitting
MLB api now returns Object not found when asked for season stats, which is a new output we have not seen before from the MLB api. When an addition stats type is included such as stats=season,career instead of just stats=season, we are returned a normal return but with only stats for career, it does not even include an empty season stats.
{
   "messageNumber":10,
   "message":"Object not found",
   "timestamp":"2023-02-28T20:31:24.076747546Z",
   "traceId":null
}

People endpoint that should return stats for season and seasonAdvanced:
https://statsapi.mlb.com/api/v1/people/660271/stats?stats=season,seasonAdvanced&group=pitching
MLB api returns an empty stats object, which unlike above, an empty stats object that I assume is meant to contain the pitching season and seasonAdvanced stats objects. When an additional group is added like above, stats=season,seasonAdvanced,career, only the career pitching stats are returned, missing both the season and seasonAdvanced.
{
   "copyright":"Copyright 2023 MLB Advanced Media, L.P.  Use of any content on this page acknowledges agreement to the terms posted here http://gdx.mlb.com/components/copyright.txt",
   "stats":[]
}

Summery:
The failed tests are all tied with the season and seasonAdvanced stat types. Because of these issues when we ask for 4 stat types and two of which are the issued season types, only 2 stat types are returned. Meaning that with a test expecting 4 but only receiving two, it fails, creating an assertionError.
Example below where we ask for season and career catching stats. Since only one is returned when we check, 1 != 2 and thus the AssertionError:
def test_catching_stat_attributes_team(self):
        """mlb get stats should return pitching stats"""
        self.stats = ['season', 'career']
        self.group = ['catching']
        # let's get some stats
        stats = self.mlb.get_team_stats(self.al_team, stats=self.stats, groups=self.group)

        # check for empty dict
        self.assertNotEqual(stats, {})

        # the end point should give us 2 hitting
        self.assertTrue('catching' in stats)
        self.assertFalse('hitting' in stats)
>       self.assertEqual(len(stats['catching']), 2)
E       AssertionError: 1 != 2

Thoughts
I think this may have something to do with it being the offseason. Could this be how the MLB api handles its returns for between seasons or is this the result of a change or update with the MLB api and how they handle these endpoints? Due the the lack of api information that is publicly available at this time we have no real idea.

@Mattsface What do you think, should we temporarily change the tests to "wait out" till the season starts to see if this is how the MLB api handles offseason stats requests for season or should we handle it with some code checking the date against the mlb season start and end dates when asking for season stats?
Not sure what we can really do besides just wait it out and see given the lack of public facing documentation on the api

@KCNilssen I will explore updating the pytests to add a specific season parameter. I believe you might be on to something with the new season starting.

@Mattsface I think the only thing to do at the moment is wait it out and see. I tried to find information on It and came up empty.
https://statsapi.mlb.com/api/v1/people/663728/stats?stats=season&season=2018&group=catching
Adding the season param for 2018 to see if that would change anything still results in an empty return. I think this issue must be with season stats?
Issues could be:

They are updating season stats and have chosen this for the mean time?
Season stats are broken on api side
They have completely changed the endpoint and the way we get stats

@Mattsface I think the only thing to do at the moment is wait it out and see. I tried to find information on It and came up empty.
https://statsapi.mlb.com/api/v1/people/663728/stats?stats=season&season=2018&group=catching
Adding the season param for 2018 to see if that would change anything still results in an empty return. I think this issue must be with season stats? Issues could be:

They are updating season stats and have chosen this for the mean time?
Season stats are broken on api side
They have completely changed the endpoint and the way we get stats

Let's give it a few days to see how things work out. I wish we had some information from the MLB on this.

PR Made. I added the season param to all stat tests.

Resolved with PR that includes a specified season for season stats to use to avoid the offseason mlb stats returning empty values.

authors: KCNilssen Mattsface

repo: zero-sum-seattle/python-mlb-statsapi

license: MIT


text:
Upgrade packages, Use typescript

Everything should work here except the dark theme for the website seems to no longer be applied.

I have added a second commit that enables typescript and uses it in the SvelteImg.svelte.

IntelliSense in action:

Img hover:

CTRL+SPACE

src hover:

In theory, js with jsdoc definitions should work just fine since svelte-package promises to generate ts.ds from them (so intellisense should be somewhat functional). The problem is it under-delivers. IBM does a better job with sveld so we use that instead.
Really appreciate your PR though! 🙏

repo: zerodevx/svelte-img

license: ISC


text:
Terminating multiprocessing.Process's with pyzmq in the mix

Hello,
I'm currently using pyzmq to perform some basic distributed computing. To that end, I'm running code that looks something like this:
#!/usr/bin/env python

import sys
import time
import enum
import collections
import socket
import multiprocessing
import zmq

HOSTNAME = socket.gethostname()
WORK = range(10)
TOTAL = len(WORK)

def producer():
    print("Running as producer...")
    context = zmq.Context()
    socket = context.socket(zmq.REP)
    socket.bind("tcp://*:{}".format(5555))
    for idx, i in enumerate(WORK):
        # Wait for a consumer to ask for work.
        socket.recv_pyobj()
        socket.send_pyobj(i)
        sys.stdout.write("\r{} of {} jobs distributed".format(idx + 1, TOTAL))
        sys.stdout.flush()

def consumer():
    def inner():
        print("Running as consumer for `{}`...".format(HOSTNAME))
        context = zmq.Context()
        # Create a socket to receive work items.
        socket_task = context.socket(zmq.REQ)
        socket_task.connect(
            "tcp://{host}:{port}".format(host=HOSTNAME, port=5555))
        # Create a socket to push results downstream.
        socket_result = context.socket(zmq.PUSH)
        socket_result.connect(
            "tcp://{host}:{port}".format(host=HOSTNAME, port=5556))

        # Subscribe to the command socket.
        socket_command = context.socket(zmq.SUB)
        socket_command.connect(
            "tcp://{host}:{port}".format(host=HOSTNAME, port=5557))
        socket_command.setsockopt_string(zmq.SUBSCRIBE, "")

        # Set up a poller to receive tasks/commands.
        poller = zmq.Poller()
        poller.register(socket_task, zmq.POLLIN)
        poller.register(socket_command, zmq.POLLIN)

        while True:
            # Request work.
            socket_task.send_pyobj(None)
            # Poll for requests.
            sockets = dict(poller.poll())
            # Handle a task.
            if sockets.get(socket_task) == zmq.POLLIN:
                # Retrieve work and run the computation.
                params = socket_task.recv_pyobj()
                time.sleep(1)
                result = params
                # Send the result downstream.
                socket_result.send_pyobj(result)
            # Handle a command.
            if sockets.get(socket_command) == zmq.POLLIN:
                cmd = socket_command.recv_pyobj()
                if cmd == "stop":
                    print("Stop command received")
                    # FIXME: Child processes don't seem to terminate here.
                    break

    def Process():
        proc = multiprocessing.Process(target=inner)
        proc.daemon = True
        proc.start()
        return proc
    pool = [Process() for i in range(8)]
    # Zombies are bad for your health.
    for proc in pool:
        proc.join()

def collector():
    print("Running as collector...")

    context = zmq.Context()
    socket_result = context.socket(zmq.PULL)
    socket_result.bind("tcp://*:{}".format(5556))

    socket_command = context.socket(zmq.PUB)
    socket_command.bind("tcp://*:{}".format(5557))

    n_results = 0
    while True:
        result = socket_result.recv_pyobj()
        n_results += 1
        sys.stdout.write(
            "\r{} of {} results collected".format(n_results, TOTAL))
        sys.stdout.flush()
        if n_results == TOTAL:
            break

    # Broadcast a stop instruction to shut down worker processes.
    socket_command.send_pyobj("stop")

def main():
    role = sys.argv[1]
    if role == "producer":
        producer()
    elif role == "collector":
        collector()
    elif role == "consumer":
        consumer()
    else:
        raise SystemExit("Invalid role")

if __name__ == "__main__":
    main()

If I run this on my local machine using
$ python sim.py producer
$ python sim.py collector
$ python sim.py consumer

(in three different terminals of course), everything works fine for the most part. Each process is receiving its work items, and each process successfully transmits its results to the collector. The problem occurs when shutting down the worker processes, which never get joined for some reason. Interrupting the consumer process shows that it is hanging at pid, sts = os.waitpid(self.pid, flag) in multiprocessing/popen_fork.py. The issue seems to be that the producer and collector terminate before the consumer(s) get a chance to. If I add a simple timeout at the end of the producer and consumer functions, every process terminates properly.
Could somebody explain to me why that is, and possibly suggest a more reliable solution than adding a random timeout?

The hang is caused by LINGER behavior on socket_task. At the beginning of every loop, socket_task is sending a ping to request new tasks. The last request from one or more workers is going out after the producer has closed its socket. This means that the request for a new task is waiting in a queue on the workers. The default LINGER behavior is to block Context.term until undelivered messages can be sent. If you set socket_task.linger = 0, it will immediately discard unsent messages.
If you change
socket_task = context.socket(zmq.REQ)

to
socket_task = context.socket(zmq.REQ)
socket_task.linger = 0

you should be set.

That did it! Thanks for the explanation.

authors: minrk nkoep

repo: zeromq/pyzmq


text:
White screen under Chrome for Mac and android

Under Chrome for android or Mac, the page loads, but the screen is white (blank).
No console errors. No network errors.
The file that causes this bug is bootstrap-arabic.min.cs.
The English version under same circumstances does not have this problem.
Thanks,

Can you please provide an example via jsfiddle, so I can understand what you mean exactly

It is hard to reproduce the bug in jsfiddle.
What happens is that while navigating the website, the page becomes blank unless you scroll down.
I applied the first workaround to handle it:
The first workaround is to scroll the page automatically using JQuery:
$(document).ready(function () {
window.scrollBy(0, 1);
window.scrollBy(0, -1);
});
The second workaround is to comment padding in this line:
.container {/* padding-right:15px; padding-left:15px; */ margin-right:auto; margin-left:auto;}
I don't know what causes the problem exactly, but the auto scrolling fixed it in my case.
You may close this (specific) case, but keep it in mind if it happened with another user.
Thanks.

Thanks for your explanation but I can't track the problem and I just tried to use the css files to see if that exists. The code in the repo matches the original repo except for directions. Maybe the problem exists in your code or browser. Please double check and let me know

license: mit


text:
Remove <header> in official site

Is your feature request related to a problem? Please describe.
I have to scroll over <header> to read the docs. When I switch tabs, I need to scroll again. It's inconvenient.
Describe the solution you'd like
Remove the whole <header>. The website will look like this:

This content can be added under navigation bar.

I'm not a web developer, this is kind of out of my scope. Should be a simple PR if anyone wants to try it

authors: CyrusYip zeroxoneafour

repo: zeroxoneafour/polonium


text:
WIP: Add travis (fix #15)

21 builds and counting ;)

Great work. ^^
Why colorlinks=true ? Because of menukeys we should load hyperref without colorlinks option.

Btw, you can change the Makefile and add a make install now :)

Why colorlinks=true ? Because of menukeys we should load hyperref without colorlinks option.

Rebase error, it is now fixed ;)

Btw, you can change the Makefile and add a make install now :)

Indeed :)

Ok. That's finally it :)

repo: zestedesavoir/latex-template


text:
Trait bound not satisfied on foldl

I have the code -
let unary = op("-")
            .or(op("NOT"))
            .repeated()
            .then(atom.clone())
            .foldr(|op, rhs| match op {
                "-" => Expr::Negation(Box::new(rhs)),
                "NOT" => Expr::Not(Box::new(rhs)),
                _ => unreachable!(),
            });

let product = unary
                .clone()
                .then(
                    op("*")
                        .to(Expr::Multiplication as fn(_, _) -> _)
                        .or(op("/").to(Expr::Division as fn(_, _) -> _))
                        .or(op("DIV").to(Expr::Quotient as fn(_, _) -> _))
                        .or(op("MOD").to(Expr::Modulo as fn(_, _) -> _)),
                )
                .then(unary)
                .repeated()
                .foldl(|lhs, (op, rhs)| op(Box::new(lhs), Box::new(rhs)));

It throws an error on the foldl call -
error[E0277]: the trait bound `Repeated<Then<Or<Or<Or<To<Padded<Just<char, &str, chumsky::error::Simple<char>>>, &str, fn(_, _) -> _>, To<Padded<Just<char, &str, chumsky::error::Simple<char>>>, &str, fn(_, _) -> _>>, To<Padded<Just<char, &str, chumsky::error::Simple<char>>>, &str, fn(_, _) -> _>>, To<Padded<Just<char, &str, chumsky::error::Simple<char>>>, &str, fn(_, _) -> _>>, Foldr<Then<Repeated<Or<Padded<Just<char, &str, chumsky::error::Simple<char>>>, Padded<Just<char, &str, chumsky::error::Simple<char>>>>>, Or<Or<chumsky::combinator::Map<impl chumsky::Parser<char, Value, Error = chumsky::error::Simple<char>> + Clone, fn(Value) -> Expr {Expr::Literal}, Value>, DelimitedBy<Recursive<'_, char, Expr, chumsky::error::Simple<char>>, Just<char, char, chumsky::error::Simple<char>>, Just<char, char, chumsky::error::Simple<char>>, char, char>>, chumsky::combinator::Map<impl chumsky::Parser<char, <char as Character>::Collection, Error = chumsky::error::Simple<char>> + Copy + Clone, fn(String) -> Expr {Expr::Variable}, String>>>, {closure@src\parser.rs:23:20: 23:29}, Vec<&str>, Expr>>>: chumsky::Parser<char, (_, _)>` is not satisfied
   --> src\parser.rs:38:22
    |
38  |                     .foldl(|lhs, (op, rhs)| op(Box::new(lhs), Box::new(rhs))),
    |                      ^^^^^ the trait `chumsky::Parser<char, (_, _)>` is not implemented for `Repeated<Then<Or<Or<Or<To<Padded<Just<char, &str, chumsky::error::Simple<char>>>, &str, fn(_, _) -> _>, To<Padded<Just<char, &str, chumsky::error::Simple<char>>>, &str, fn(_, _) -> _>>, To<Padded<Just<char, &str, chumsky::error::Simple<char>>>, &str, fn(_, _) -> _>>, To<Padded<Just<char, &str, chumsky::error::Simple<char>>>, &str, fn(_, _) -> _>>, Foldr<Then<Repeated<Or<Padded<Just<char, &str, chumsky::error::Simple<char>>>, Padded<Just<char, &str, chumsky::error::Simple<char>>>>>, Or<Or<chumsky::combinator::Map<impl chumsky::Parser<char, Value, Error = chumsky::error::Simple<char>> + Clone, fn(Value) -> Expr {Expr::Literal}, Value>, DelimitedBy<Recursive<'_, char, Expr, chumsky::error::Simple<char>>, Just<char, char, chumsky::error::Simple<char>>, Just<char, char, chumsky::error::Simple<char>>, char, char>>, chumsky::combinator::Map<impl chumsky::Parser<char, <char as Character>::Collection, Error = chumsky::error::Simple<char>> + Copy + Clone, fn(String) -> Expr {Expr::Variable}, String>>>, {closure@src\parser.rs:23:20: 23:29}, Vec<&str>, Expr>>>`
    |
    = help: the trait `chumsky::Parser<I, Vec<O>>` is implemented for `Repeated<A>`
note: required by a bound in `foldl`
   --> C:\Users\Aneesh\.cargo\registry\src\index.crates.io-6f17d22bba15001f\chumsky-0.9.3\src\lib.rs:528:15
    |
526 |     fn foldl<A, B, F>(self, f: F) -> Foldl<Self, F, A, B>
    |        ----- required by a bound in this associated function
527 |     where
528 |         Self: Parser<I, (A, B)> + Sized,
    |               ^^^^^^^^^^^^^^^^^ required by this bound in `Parser::foldl`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `rs-pseudocode` (bin "rs-pseudocode") due to previous error

I had a similar error on Clone earlier. Which was solved by adding + Clone to my parser function returns. For example -
fn lit_int() -> impl Parser<char, Value, Error = Simple<char>> {
    text::int(10).map(|s: String| Value::Integer(s.parse().unwrap()))
}

became -
fn lit_int() -> impl Parser<char, Value, Error = Simple<char>> + Clone {
    text::int(10).map(|s: String| Value::Integer(s.parse().unwrap()))
}

What trait should I add to make the foldl call work? How do I self diagnose these errors? The message is really cryptic because of the long type.

That works, thank you!

repo: zesterer/chumsky


text:
fix: change core::lazy::OnceCell to core::cell::OnceCell

I don't think this needs any further explanation.

Thanks!

authors: dawnofmidnight zesterer


text:
Superposición

Proceso

Ingrese a la pagina.

Resultado esperado
• No encontrar una superposición.
Resultado actual
• Se encuentra una superpocision del nav con la page 404.
Captura

Cualquier cosita pueden contactarme a nicogonzalez2008@gmail.com o por el slack de RollingCode

Se corrige la superposición del Navbar con la pagina de error 404.

Commit de referencia en rama main: [9ed1d4a]

authors: Nidev-lab zeta-dev-web

repo: zeta-dev-web/stock-front


text:
How to improve cascade.xml, and distortion correction before CNN?

It is a amazing work.
But I find the library can't recognize plates when the plates is oblique in photos.
How to improve cascade.xml, and distortion correction before CNN?

you can train your own harr cascade model, or you can try mtcnn.

repo: zeusees/HyperLPR


text:
检测眼睛闭合度问题

你好，作者。
首先非常感谢你们开源，然后我想请教几个问题:
在 windows 下 ， 我想通过眼睛的睁开角度和上下眼皮睁开的距离来判断正闭眼，现在测试发现当人脸倾斜角度稍微大的时候，经常识别不出来。以及当闭眼时候，眼睛特征点识别的也不是太理想，经常识别到眼皮上了 ，请问下，有什么好的解决办法吗 ？ 或者有什么优化的思路吗 ？
非常感谢，期待你们的解决。

一个可以通过丰富的训练数据解决，另外网络的设计也要继续优化。

repo: zeusees/HyperLandmark


text:
add default timeout value to requests in v1.x

Hi,
The sdk version v1.x uses the requests library. so we need to add a default timeout value to raise a proper exception when onesignal api is down.
https://documentation.onesignal.com/docs/onesignal-api#what-is-the-response-timeout-for-api-endpoints
What is the response timeout for API endpoints?
Responses are usually generated within a couple seconds. However, in extreme cases, they can take longer.
OneSignal will wait 30 seconds for a response before automatically canceling the request. To verify no duplicate requests go through, you can add an Idempotent Key with the external_id parameter.
but in requests documentation:
https://requests.readthedocs.io/en/master/user/advanced/#timeouts
Timeouts
Most requests to external servers should have a timeout attached, in case the server is not responding in a timely manner. By default, requests do not time out unless a timeout value is set explicitly. Without a timeout, your code may hang for minutes or more.
lack of timeout param in v1.x version  👇
def basic_auth_request(method, url, token=None, payload=None, params=None):
    """
    make a request using basic authorization
    :param method: [GET, POST, PUT, DELETE ...]
    :param url:
    :param token: basic authentication token
    :param payload: post body
    :param params: Dictionary or bytes to be sent in the query string
    :return:
    """
    request_kwargs = {}
    if token is not None:
        request_kwargs["headers"] = {"Authorization": "Basic {0}".format(token)}
    if payload is not None:
        request_kwargs["json"] = payload
    if params is not None:
        request_kwargs["params"] = params
    return requests.request(method, url, **request_kwargs)

the commit will be merged???

they just closed the PR without merging it 😔 🤷♂


text:
统一的文件路径校验等放到zfinder的serve.js中

https://github.com/zfinder/zfinder-mw-markdown/blob/master/lib/index.js#L51

done

repo: zfinder/zfinder


text:
🛑 JSONDiff is down

In cd50429, JSONDiff (https://www.jsondiff.com) was down:

HTTP code: 0
Response time: 0 ms

Resolved: JSONDiff is back up in 7e9163f.

repo: zgrossbart/jdd-upptime


text:
Completion callback is not called in dismiss method in DKImagePickerController

@objc open override func dismiss(animated flag: Bool, completion: (() -> Void)? = nil) {
       if self.inline {
           UIApplication.shared.keyWindow!.rootViewController!.dismiss(animated: true, completion: nil)
       } else {
           super.dismiss(animated: true, completion: nil)
       }
   }

should be
@objc open override func dismiss(animated flag: Bool, completion: (() -> Void)? = nil) {
       if self.inline {
           UIApplication.shared.keyWindow!.rootViewController!.dismiss(animated: true, completion: completion)
       } else {
           super.dismiss(animated: true, completion: completion)
       }
   }

Thanks!!! Fixed in the latest develop branch!


text:
数据字典那个字段在表格中为空

版本号：2.3
问题描述：
字段billtype,
数据字典ot_bill_type ,
字典配置为 1:出库单
字典配置为 2:入库单
online表单开发--功能测试中没问题,生成代码后那里就显示为空.导出也没问题

昨晚摸索了一下
是@Dict注解没生效
进入DictAspect中看了一下,
// 定义切点Pointcut
    @Pointcut("execution(public * org.jeecg.modules..*.*Controller.*(..))")
    public void excudeService() {
    }

指定了包名类型...
把这里改下就行了
权当记录吧~留给有缘人

repo: zhangdaiscott/jeecg-boot


text:
主键id加了IdType=AUTO，但是插入数据后还是会自动生成一个很长的主键

版本号：2.3
问题描述：entity实体中的id加了注解，预期是使用mysql的自增主键，但是插入数据后最终还是系统自动生成了一个很长的主键。
截图&代码：

友情提示： 未按格式要求发帖，会直接删掉。

auto的话默认走的是配置文件的注解策略

哦 这样啊，谢谢了。 我理解注解配置的优先级是不是应该更高呢，注解没配的话才读默认的配置文件配置。

哦 这样啊，谢谢了。 我理解注解配置的优先级是不是应该更高呢，注解没配的话才读默认的配置文件配置。
请教一下，关于使用数据库的自增ID，这个应该怎么去解决？

配置成AUTO就行啦

authors: PietyXiao shadow--walker zhangdaiscott


text:
页面表单权限中的显示隐藏控制无法控制api是否被使用

版本号：
2.1.0
问题描述：
页面表单权限中使用v-has的显示隐藏控制，只能控制前端是否显示，不能从根源上控制是否可以使用的权限，例如开发者工具中获取到token之后，可以直接curl或者postman构造请求去访问被隐藏的api接口。
截图&代码：
无

查看文档，可以配合 JAVA访问权限控制 来解决，谢谢！

有个小建议，可以约定例如 user 或者 user:* 包括 所有例如 user:edit, user:add, user:delete 等权限，并且默认生成的代码中都添加上 @RequiresPermissions("user:xxx") ,然后在前端页面默认添加上 user或user:* 的权限，这样前端配置就方便灵活点，不需要修改代码。

默认生成权限代码是可以，但同时要是必须授权才能使用。
可以做，但是这样增加了使用者的成本，很多人不会用反而会问很多问题。
不如现在这样，需要自己加

代码自动生成权限注解和权限指令的坏处

需要同时生成对应的权限升级SQL
需要手工授权才能访问（不授权访问不了）
增加了授权配置（如果项目要求严格默认大部分功能都需要颗粒化控制，是可以的；如果项目权限要求不高，反而增加了项目开发成本）

所以此方案可以视情况而定，如果权限要求高，可以改代码生成器模板，直接实现权限代码的生成。


text:
这个项目和微信那个项目哪者更优先

这个项目和微信那个项目哪者更优先

这个可以兼容微信，并且有其他额外渠道，后续优先更新这个

这个可以兼容微信，并且有其他额外渠道，后续优先更新这个

网页版或者小程序的问答项目后续更吗？

这个可以兼容微信，并且有其他额外渠道，后续优先更新这个

网页版或者小程序的问答项目后续更吗？

小程序工作量太大、定制化比较强， 短期不考虑， 网页版会更新

authors: Yan0789 silendir zhayujie

repo: zhayujie/bot-on-anything


text:
飞书无法识别图片的类别

⚠ 搜索是否存在类似issue

[X] 我已经搜索过issues和disscussions，没有发现相似issue

总结
当前cow版本：1.6.0-13-ge09f562
通过Linkai接入飞书[自建模式]
问题描述：
通过飞书客户端上传图片错误如下:
[INFO][2024-05-14 08:47:36][feishu_channel.py:95] - [FeiShu] send message success
123.58.10.239:17010 - - [14/May/2024 08:47:37] "HTTP/1.1 POST /" - 200 OK
[ERROR][2024-05-14 08:48:02][feishu_channel.py:225] - Unsupported message type: Type:image

期望能够通过飞书上传图片模型进行识别
举例
No response
动机
No response

是的，还不支持图片类型，可以看看后面是否更新支持

repo: zhayujie/chatgpt-on-wechat


text:
现在支持https协议吗，实际在用的时候，发现不支持

例如：https://www.sciencedaily.com/

支持HTTPS的，crash应该是bug

authors: wangwj zhegexiaohuozi

repo: zhegexiaohuozi/SeimiAgent


text:
One drive feature is expired.

Hi, I tried to download features from OneDrive. However, If found this message:
This item might not exist or is no longer available
This item might have been deleted, expired, or you might not have permission to view it. Contact the owner of this item for more information
Could you check and re-upload the feature, please?
Thank you.

Thank you. It seems like not working since the link might be changed. could you change new links?

Thanks for the reminder. Now I updated the links. lmk if have any issue.

repo: zhengshou/AutoLoc


text:
1

What's your question about?

authors: mowangmodi zhiyuanyou


text:
调用函数出现NPE，求大佬们帮忙看下具体是啥原因

调用gaode app的时候出现npe问题，用最新代码没发现具体是啥原因导致的。

代码样例：
package com.github.unidbg.gaode;
import com.github.unidbg.AndroidEmulator;
import com.github.unidbg.Module;
import com.github.unidbg.linux.android.AndroidEmulatorBuilder;
import com.github.unidbg.linux.android.AndroidResolver;
import com.github.unidbg.linux.android.dvm.*;
import com.github.unidbg.memory.Memory;
import java.io.File;
public class TestGaodeCallInitMethod extends AbstractJni {
private final AndroidEmulator emulator;
private final static String NameSpace = "/Users/zenglei11/Downloads";

private final Module module;

private final DvmClass Native;

private VM vm;

public TestGaodeCallInitMethod() {
    emulator = AndroidEmulatorBuilder
            .for32Bit()
            .setProcessName("com.autonavi.minimap")
            .build();

    File apkFile = new File(NameSpace + "/gaode7.8.apk");
    final Memory memory = emulator.getMemory();
    memory.setLibraryResolver(new AndroidResolver(23));

    vm = emulator.createDalvikVM(apkFile);
    vm.setJni(this);
    vm.setVerbose(true);
    String processName = emulator.getProcessName();
    emulator.showRegs();
    System.out.println("---" + processName);

    DalvikModule dm = vm.loadLibrary(new File(NameSpace + "/libserverkey-2.2.3.so"), false);
    dm.callJNI_OnLoad(emulator);

    module = dm.getModule();

    Native = vm.resolveClass("com/autonavi/server/aos/serverkey");

//        System.out.println(Native.callStaticJniMethodObject(emulator, "getAosKey()Ljava/lang/String;"));
    final DvmObject<?> dvmObject = Native.newObject(null);

    String result = dvmObject.callJniMethodObject(emulator, "getAosKey()Ljava/lang/String;").toString();
    System.out.println(result);
}

@Override
public DvmObject<?> callStaticObjectMethodV(BaseVM vm, DvmClass dvmClass, String signature, VaList vaList) {
    System.out.println("++++" + signature);
    if ("com/autonavi/common/CC->getApplication()Landroid/app/Application;".equals(signature)) {
        return vm.resolveClass("android/app/Application").newObject(signature);
    }

    return super.callStaticObjectMethodV(vm, dvmClass, signature, vaList);
}

public static void main(String[] args) throws Exception {
    TestGaodeCallInitMethod test = new TestGaodeCallInitMethod();
}

}
apk文件和so文件在下面的腾讯链接中：
链接：https://share.weiyun.com/mbdqeWHA 密码：rdnibe

复现并无问题呀

复现并无问题呀

请问下你用的是哪个版本的unidbg代码呢？我用最新代码会有npe问题，用v0.9.5包也是这个问题，而且还会提升具体哪里，可以看下面截图：

@Override
public int getStaticIntField(BaseVM vm, DvmClass dvmClass, String signature) {
    switch (signature){
        case "android/content/pm/PackageManager->GET_SIGNATURES:I":{
            return 64;
        }
    }
    return super.getStaticIntField(vm, dvmClass, signature);
}

正常补

@Override
public int getStaticIntField(BaseVM vm, DvmClass dvmClass, String signature) {
    switch (signature){
        case "android/content/pm/PackageManager->GET_SIGNATURES:I":{
            return 64;
        }
    }
    return super.getStaticIntField(vm, dvmClass, signature);
}

正常补

点赞，感谢大佬，可以了。

客气了，加油


text:
Incorrect handling of BETWEEN predicate, EXISTS, NOT EXISTS, IN, NOT IN subqueries

This test is from NIST test suite. RunNistTests needs to be run but asserts are suppressed.
NIST Test dml014.
SELECT PNUM
FROM PROJ
WHERE BUDGET >= 40000 AND BUDGET <= 60000;
Should return only one row, with 'Vienna' but returns four: Deale, Vienna, Deale, Akorn
SELECT CITY
FROM STAFF
WHERE NOT(GRADE BETWEEN 12 AND 13);
Also should return one row but returns many.
Similar problem.
SELECT WORKS.HOURS
FROM WORKS
WHERE WORKS.PNUM NOT IN
(SELECT PROJ.PNUM
FROM PROJ
WHERE PROJ.BUDGET BETWEEN 5000 AND 40000);
Returns more than one row.
SELECT HOURS
FROM WORKS
WHERE PNUM NOT IN
(SELECT PNUM
FROM WORKS
WHERE PNUM IN ('P1','P2','P4','P5','P6'));
Returns more than one row.
SELECT STAFF.EMPNAME
FROM STAFF
WHERE NOT EXISTS
(SELECT *
FROM PROJ
WHERE NOT EXISTS
(SELECT *
FROM WORKS
WHERE STAFF.EMPNUM = WORKS.EMPNUM
AND WORKS.PNUM=PROJ.PNUM));
Returns more than one row.

how to repro the tests? can you add the NIST as part of the unittest?

My branch has it but I think I will separate the Tests into a  separate branch and push it so that you can merge into master.

branch nist_tests has these tests.

@zhouruiapple ，the NOT IN subqueres is handling in #220

authors: 9DemonFox pkommoju zhouqingqing

repo: zhouqingqing/qpmodel


text:
Can not download the Data Fashion

Hi @zhusz ,
Thank for your interesting work. I want to download the data but I can only download Category and Attribute Prediction Benchmark. I can not download the rest. I see there are four datasets. Which one do you use for your algorithm? I did try both google drive and dropbox.
Thanks,
Hai

Just the  Category and Attribute Prediction Benchmark one.


text:
自定义的默认终端应用程序无法调用

version：5.3.6
安装第三方终端应用，如 windows terminal（[https://github.com/microsoft/terminal]）
在软件中设置为默认终端应用程序，按快捷键 shift + T 或者右键空白处菜单“在终端处打开”均无法调用，上一个版本 5.3.3 是可以调用的

Hi，经过调查，是由于5.3.6版本增加了执行exe权限的检查，但是由于Windows Terminal的执行方式是 “wt.exe” ，它是一个相对路径，因此在权限检查时失败（执行时由系统自动寻找它在环境变量中的绝对路径），进而导致无法启动Windows Terminal。该问题已于最新的提交 Here  中修复，并将随下一个版本修复。
您可以在设置中编辑Windows Terminal的配置文件，将相对路径更改为绝对路径，即可正常使用。

版本5.4.0已解决该问题，请确认


text:
建议：增加“字体样式”选项

我想自定义RX文件管理器的显示字体，希望可以有这个选项

但我见过可以更换全局字体的uwp应用

不要被表象蒙蔽了，简单应用可以对每一处字体应用单独的控制，对于RX这种复杂的应用成为几乎不可能的任务。我说的是UWP平台并没有全局统一的控制字体的设置可以用，如果非要强上的话没什么做不了的，就是几百上千个控件都要手动设置字体就是了

当然你要是有高效的方法也可以提出来

这个事情有转机，和其他UWP大佬以及MVP进行了交流，正在进一步研究


text:
中文问题

中文msvc 构建有啥办法兼容吗

警告C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
C++文件中注释含有中文字符导致的，目前删除了中文字符。。

不用删除中文注释，可以试试加cmake语句强制msvc编码用utf8（虽然我这里加不加都不影响，用的是qtcreator msvc2019+vs2022），如果还不行可以考虑用utf8 with bom编码：
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")


text:
[api] apioo/psx

A framework which helps to build clean and documented REST APIs.

Thanks for the suggestion.

authors: chriskapp ziadoz

repo: ziadoz/awesome-php

license: WTFPL


text:
deleting a variable mid function

When I'm programming in javascript, I do it all the time. Very useful, I can clearly see if some variable will not be used again.
Can LLVM do that?

@pluto439,
Simple answer: No.
Complicated answer: Yes, but not really.
Also how would it be useful at all?

@Ilariel

Simple answer: No.
Complicated answer: Yes, but not really.

Sometimes it seems like what someone is trying to accomplish doesn't make sense. And that makes it tempting to respond with curt answers like these. But they can come off as rude and make the other person feel defensive. It works out better for the community if we give each other benefit of the doubt.
When I'm confused about what someone is trying to accomplish - and I must confess I am confused about what @pluto439 is trying to accomplish in this issue - I try to find out more details about their use case.
@pluto439
Can you give a code example of what this would look like and how it would work?
Does variable scoping accomplish this? e.g.
fn foo() {
    var a: i32 = 1234;
    {
        var b: i32 = a + 10;
        // here we can use b
    }
    // here b is "deleted" AKA "out of scope"
}

What issue are you running into that makes you want to delete a variable mid function?

@andrewrk, I was wishing he would explain it would it be useful at all? I admit my wording was bad.
If we assume removal from memory then it is an issue that cannot be achieved without redesign of language semantics and custom calling convention
For lexical scoping it doesn't make any sense unless a variable name is going to be reused and @andrewrk mentioned variable scoping can achieve it.

JavaScript doesn't let you delete  variables once declared, with the exception of global variables which can be deleted in a limited number of cases.
So are you talking about assigning them something like a null value, or do you mean actually removing the name from the scope?

Well, here are a few examples from my javascript code. They mostly help me figure out my own code, so that I can see where exactly the last use of this variable is. I just don't like to leave trash behind, just another safety net for me.
savevideos_hook_video = function(aSubject, path) {

    aSubject.QueryInterface(Ci.nsITraceableChannel)

    var obj_TargetFile = FileUtils.getFile("Home", path)
    delete path

    //rest of the function

toString_group_to_three = function(in_number) {
    var str = in_number.toString()
    var str_len = str.length

    var num_of_digits_in_first_group = str_len % 3
    var num_of_spaces = Math.floor(str_len / 3)

    var out=str.substring(0,num_of_digits_in_first_group)
    var str_i = num_of_digits_in_first_group
    delete num_of_digits_in_first_group

    while (num_of_spaces != 0) {
        out = out + ' '
        num_of_spaces = num_of_spaces - 1

        out=out+str.substr(str_i,3)
        str_i = str_i + 3
    }
    return out
}

    var res = XVIDPAGE.exec(aSubject.originalURI.asciiSpec);
    if (!res) return

    var id = res[1]
    delete res

Example of what I want to avoid, search for }}}}} https://pastebin.com/L5L8VpsC . It's not mine btw. Probably just having one code block would've been enough here, it's probably written for compilers that don't support creating variables mid function.
Also I'd like to avoid how golang handles errors returned from their functions, that they stay for the rest of the function. Have to always change := to = around.
err := smfn.DoSomething()
if err {
  return 1
}

err = smfn.DoSomething()
if err {
  return 1
}

If I'll make a language, it will have an operator // as a shortcut for "delete this variable" and "this is the last usage of this variable".
5 2 divmod -- a b
a b //

5 2 divmod -- a b
[ a// b// ] print

Creating extra code blocks sort of works, but I dislike that I have to define variables in advance. Need to specify type of a variable, I'd like to move towards C++ auto and the likes of it. Python spoiled me, I guess.

@pluto439, deleting variables like that is against strict mode rules and possibly prevents optimizations that jit compilers can do. Meaning what you are doing is actually not only bad practice, but possibly also harmful for performance reasons.
See
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete
https://www.smashingmagazine.com/2012/11/writing-fast-memory-efficient-javascript/

delete actually has no effect on those variables. It may be useful as a visual indicator, but it doesn't  impact the variable itself. If you log the result of the delete expression, you'll see that it returns false, meaning the variable was untouched.

I could see some usefulness in dropping a variable early though, so as to avoid accidental use of the wrong one without the rightward drift of another scope. Don't know if it warrants a new feature but it's an interesting thought.

@Ilariel In those links, it's more about not changing object's layout for nothing. I think you're fine if you delete local variables with delete. In c and zig, it's literally impossible to change object's layout after declaring it.

Regardless of how JavaScript works, there's a feature proposal here that's in line with the zen of zig: communicate intent precisely. And this feature seems pretty well defined: some mechanism to explicitly remove a local variable from scope contrary to the stack-based {} scoping structure already available.
This doesn't seem like a bad idea to me. It does seem pretty complicated for very little gain, though. An example of the complexity is that you should only be allowed to remove a variable from scope if you're at the same scope level where it was declared (can't conditionally remove a variable, etc.).
Also it would be pretty silly to remove a variable from scope right as it's going out of scope anyway. I don't want anyone to think that that would be a "best practice" or anything, so we might consider making that situation a compile error.
This feature is a lot like access modifiers: the main purpose is to prevent programmers from doing something. Access modifiers are extremely useful in large code bases, because they specify between a symbol being visible only in this file or being visible to the entire project. That's a huge difference, and so access modifiers can be very valuable. However, this proposal has a much more modest gain; it only specifies a symbol being visible until the end of the block, or not.
Zig has a precedent for expecting a code reader to understand the entire function body in order to understand how code behaves (e.g. defer is considered an explicit control structure, not hidden control flow.). Following this precedent, this feature proposal is not necessary.
Let's keep this discussion about Zig, not about JavaScript. Thanks!

@Perelandric
Jesus christ, I never even checked! Looks like delete only deletes global variables, wow! I just assumed javascript worked like python. Wow.

@thejoshwolfe
The reason it's important for me is because I hope to use zig interactively in the future. That is, in an enviroment, where there are no functions, everything you type is one big function. Same reason I'd like to get rid of defer.

The reason it's important for me is because I hope to use zig interactively in the future. That is, in an enviroment, where there are no functions, everything you type is one big function.

Wow! That's quite a novel usecase. Let's leave this issue open, and could you please open a new issue discussing that usecase. I would imagine there are many obstacles that would need to be overcome in addition to variable scopes.

What would this code do?
var x = 1;
for (...) {
   if (...) delete x;
}

What would this code do?

Syntax error. delete would need to be at statement level. and if you put curly braces around the delete statement, then it's a semantic error, because deleting a variable would need to be in the same block as the variable was declared.

@thejoshwolfe:
I found that this currently compiles:
 var x : i32 = 1;
...
 x = undefined;

Perhaps this could be reinterpreted as "deleting a variable".

Yeah, that's perfect, actually. With (planned but not yet implemented) compile-time undefined value tracking (see #597) this accomplishes the goal of removing a variable from scope, by communicating the correct intent to the compiler.
In fact this is such a satisfying solution that I will close the issue now.

from https://github.com/zig-lang/zig/issues/597#issuecomment-342657852

It's not the same as deleting a variable then. I want it to stop existing, completely. I will only ever delete variables that are temporary anyway.

A stack variable in zig exists in the assembly instruction at the beginning of the function that increases the stack pointer by some number of bytes in order to fit all the stack variables.
So if you want a variable to stop existing completely, what you are actually wanting to do, is to replace one function definition with another, while the software is running. This is hot code swapping (see #68).
If you use a variable earlier in the function, and then want to delete it, there's nothing to delete. You still needed to increment the stack pointer at the beginning of the function by some number of bytes to fit the variable, for the time that you used it.

Actually, local variables exist in registers. They are placed on stack only if there's not enough place in registers.
There's no need for code swapping. It's called "liveness analysis", and is actually done automatically by all good compilers, including llvm. My "delete variable" is more a for programmer itself, so that he can know where exactly the scope of a variable ends, and so that he can use this name again without any care in the world. Technically, you could use ret ret2 ret3, and compiler would've made the same code. But it wouldn't have been as readable.

Deleting a variable is actually surprisingly simple. You just need to:

make sure variable creation and deletion happens on the same block (overwise it's too complex for compiler to figure out if variable still exists or not after some for, it would require some theorem solving and knowledge of the program as a whole, too hard)

throw error if variable is accessed after being deleted

if, after deleting a variable, another variable gets created with the same name, treat it as a new independant variable with the same name.

Liveness analysis from llvm is quite likely to do the rest of the job. The only problem that may appear is with debug information, debugger may be confused that there are two variables under the same name. It will make long functions easier to write

Variable deletion will be really handy when you need to chain variables:
def test(a):
    b = do_something(a)
    del a

    c = do_something(b)
    del b

    return c

And when you need to create a temporary variable that will never be used again, like error codes:
def test2():
    err = do_something('1.txt')
    if (err) return -1
    del err

    err = do_something('2.txt')
    if (err) return -1
    del err

    err = do_something('3.txt')
    if (err) return -1
    del err

    return 0

When C first appeared, it was required to place all variables at the beginning of function. Later, it was possible to declare new variables anywhere in the function. Being able to delete variables seems like a natural progression.

I think I can liive without it, by just putting comments //del variable instead. Since I didn't knew that javascript version wasn't working for so long. It would've been a good safety net though. I suspect everyone will be too lazy to actually use del anywhere.

Python uses this error message for undefined variables, or recently deleted variables. Just for the future reference. It could probably add "it was deleted just above at line xx". Error messages are a very important part of any language.
UnboundLocalError: local variable 'a' referenced before assignment

Should you be allowed to use a variable in a defer that gets deleted?
{
    var file = open(path);
    defer file.close();
    del file;

    var file = open(path);
    defer file.close();
    del file;
}

what about goto rules?
{
    var file = open(path);
retry:
    do_something(file);

    if (foo()) goto end;
    del file;

    if (bar()) goto retry;
end:
    var file = open(path);
    file.close();
}

@pluto439 what you are proposing is complicated and I'm not convinced that it is sound. You might be describing something that is a contradiction. What you are proposing is so complicated that in order to explain how it should work, I think you should go implement it, and then report back your findings.

So, there's no way to delete a variable in llvm? I get so confused when I read their docs.

Once the debugger will be complete, I'd like to display all "undefined" variables as "?". It will be more intuitive, I think. It's for variables that may contain garbage, and it doesn't really matter what's really is in them right now.

Using code blocks will work almost the same. Except you don't have to delete absolutely everything on block end, you may delete only some variables and keep others.

I have been very busy lately, so I am just now trying to read through this proposal.
I am not understanding what problem it really solves.   If you want to reuse variable names because you have a long function, then should not that function be refactored?   If it is to help the compiler, the liveness calculations in LLVM are pretty good and it will reuse registers when it determines that the variable is no longer used.
If you need temporaries, then the "automatic return value as the last value in a block" aspect of Zig should do what you want, no?   I see that used all over in Zig as a very nice idiom.   Zig does not need C's trinary operator because of this.
@pluto439, I think the debugger is probably one of the biggest problems.   You would need to keep some sort of state as to which variables were defined at every line of code as far as I can tell.   I can set a breakpoint anywhere.   So, I cannot (without massively invasive code generation) determine which variables are visible as the program executes.  That must be stored in the debugging information.
The ability to use code blocks seems like it gives you everything you want, but it is clean and straightforward.  It also does not require the removal of defer.
Sorry that I am not understanding why this change is worth the apparent amount of effort :-(

I'll just do it by using a preprocessor. A preprocessor that creates res res2 res3 variables out of var res del res var res del res var res del res. And reports an error if res was used after del res.

I am not understanding what problem it really solves.

It's not that necessary, I'm just trying to make programming in C more clean. People go to great lengths just to make programming more secure and comfortable, why not start on the language level.

If you want to reuse variable names because you have a long function, then should not that function be refactored?

There's no reason to use a ton of small functions instead of one big function. Big functions are usually easier to understand and write. Code Complete agreed with me on that.

If it is to help the compiler

It is to help the programmer. So that he doesn't have to read the whole function to see what happens with some variable.

If you need temporaries, then the "automatic return value as the last value in a block" aspect of Zig should do what you want, no?

Example?

The ability to use code blocks seems like it gives you everything you want, but it is clean and straightforward.

I don't want to create code blocks for every small thing. I want to keep as much code on the same level, flat. Code blocks ain't that straightforward, del is more straightforward. Click here https://github.com/zig-lang/zig/issues/594#issuecomment-343087325 , it's as straightforward as you can get.

I think the debugger is probably one of the biggest problems. You would need to keep some sort of state as to which variables were defined at every line of code as far as I can tell. I can set a breakpoint anywhere. So, I cannot (without massively invasive code generation) determine which variables are visible as the program executes. That must be stored in the debugging information.

If you just use preprocessor, it's not a problem at all, except working with debuggers is now more annoying.
If you do it on the code generator level, it shouldn't be that much more complex than what compiler and debugger are already doing. They already have support for creating a variable mid function and code blocks, deleting a variable is just one step forward. If you intend to reuse third party debuggers instead of writing your own, then yes, it's problematic.

It also does not require the removal of defer.

Defer is pretty terrible anyway, it makes control flow jump around. It's an inferior replacement for finally, whose only advantage is that it doesn't require you to create an extra identation. It doesn't destruct on code block end, only on function block end, and you will get some confusing results if you'll try to use defer inside a for loop.
And I'm not sure on this one, but I think inside catch and finally you can access local variables. Huh, with defer -- finally you also can create variables. Same with setjmp -- catch. You probably can't goto beyond the borders of each.
Even their names are bad. longjmp instead of throw, setjmp instead of catch, defer instead of finally, function start instead of try. The last one is interesting, but it makes your program less flexible, and makes you create more functions than necessary.
I don't understand why zig even has defer if there are no plans for exceptions anyway.

I used the term "liveness analysis", apparently it's also called "stack slot coloring". The thing that decides how local variables are stored.
I was pretty much told to just do it myself. I'm just gathering notes here at this point. I'll probably do it.

@pluto439, Don't take this badly, but given we seem to have found a better solution for similar behaviour, this issue is already closed, what you are suggesting doesn't seem to be worth the time to implement it unless you do it yourself and the benefits seem to be small if non-existent,  I recommend you gather notes as you said you are and do extensive research on this idea of yours, C and Zig as it also seems that you haven't really understood how things work as you are comparing apples to oranges. Also check whether the implementation and usage would fit Zig Zen and the syntax when you have done it. After that open another issue (or post to this issue).

Defer is pretty terrible anyway, it makes control flow jump around. It's an inferior replacement for finally, whose only advantage is that it doesn't require you to create an extra identation. It doesn't destruct on code block end, only on function block end, and you will get some confusing results if you'll try to use defer inside a for loop.

And I'm not sure on this one, but I think inside catch and finally you can access local variables. Huh, with defer -- finally you also can access variables. Same with setjmp -- catch. You probably can't goto beyond the borders of each.

First of all, no it is not a replacement and it is quite different when compared to the finally construct in most of the programming languages. Sure both allow you to do something at the end of an operation, but they work differently and shouldn't be compared.
Defer in Zig is closely related to C++ scope guards and Go defer https://blog.golang.org/defer-panic-and-recover while finally tends to be part of the try-catch-finally chain. As Zig doesn't have exceptions built-in to language and it uses low level error codes instead there is no reason for try-catch-finally. If you need a more detailed "exception" can still return an enum which contains a result or detailed error struct if you deem it necessary due to error case being recoverable and so common.
Try-catch-finally usually forces one to wrap all operations which can return an error or rather throw an error into a try block and then you create a catch block which catches the exceptions, possibly even one for each different exception depending on the language and whether the function should deal with them separately. Then as the last thing after try and possibly catch, finally is run.  Not only does this possibly hide information from the programmer as you can't visibly see which function or operation inside try block can throw an error without looking at them. This is why you have to deal with error codes when possibly returned and if you use an enum you would probably use a switch so in both cases you can visually see immediately which are possible error sources.
Also If you look the defer documentation you can see this example part
Referring to http://ziglang.org/documentation/master/#defer
// defer will execute an expression at the end of the current scope.
fn deferExample() -> usize {
    var a: usize = 1;

    {
        defer a = 2;
        a = 1;
    }
    assert(a == 2);

    a = 5;
    a
}

Defer executes at the end of the current scope! This is clearly different behaviour from finally. The most common use case for defer is most likely memory and resource management and you wouldn't want to wrap your allocations into try-catch-finally blocks because they just don't do the same thing.
That being allocate memory, defer deallocation at allocation site and then use it instead of having to write the deallocation code explicitly into the end of the function (possibly finally block), meaning defer allows us to write cleaner code and it is clearly not just an inferior replacement.

Even their names are bad. longjmp instead of throw, setjmp instead of catch, defer instead of finally, function start instead of try. The last one is interesting, but it makes your program less flexible, and makes you create more functions than necessary.

You can't compare apples to oranges like this. Catch and throw have barely anything else to do with setjmp and longjmp other than on lower level they can be used to implement the former.
Actually I'm a bit confused why are you even comparing those since I don't think that they are even in the std and when you search Zig repo only place where you can even find setjmp and longjmp is in the c_headers and deps (so I guess they aren't in the std after all).
Anyway considering setjmp are C standard library functions, and if implemented in Zig they probably should have similar functionality. See http://en.cppreference.com/w/c/program/setjmp for setjmp and http://en.cppreference.com/w/c/program/longjmp for longjmp functions in C standard library. As you see they are quite different beasts from throw and catch.

I don't understand why zig even has defer if there are no plans for exceptions anyway.
I hope you my explanation on defer made you understand

I also feel that I need to address this too

There's no reason to use a ton of small functions instead of one big function. Big functions are usually easier to understand and write. Code Complete agreed with me on that.

This is my opinion so someone else might say something different, but you can rather easily find arguments for both large and small functions, but usually it is more about modular reusable code that can be maintained easily.
Smaller functions that are shared with multiple longer aren't inherently bad if they improve readability and they don't abstract away necessary information.
Large functions aren't bad either unless they for example contain duplicated code that could be shared and inlined or do so many different things that probably should be split into different functions just to ease maintainability.
After all self-documenting functions are best code and when you have a really large function that is called something like download_url_scrape_web_page_and_find_css_file_location_and_x_amount_of_rules you have probably done something wrong but of course it might just be that the bad thing was just giving a bad name to a function.

This is getting in the territory of exceptions, which I created a topic about here #578.

Defer executes at the end of the current scope!

Thanks for checking it! I was thinking zig worked like golang. Here is an example, they recommend to create an extra function https://github.com/golang/go/issues/3978 . To me this looks ugly, using advanced features to plug holes in the language.

defer-panic-and-recover

Do you know if recover is planned? No mention of it in the docs.

a really large function that is called something like download_url_scrape_web_page_and_find_css_file_location_and_x_amount_of_rules

Functions like "open_window" or "init_physics" can get pretty large. And something that is used at the beginning may never be used again. Need to make lifetime of variables as short as possible, it will make code easier to read.
Having too many functions actually makes code harder to read, control flow is hard to figure out, it jumps all over the place, need to have tools for code navigation to find anything.

Catch and throw have barely anything else to do with setjmp and longjmp

Ain't they both are used for exception handling? I think they are just different names for one thing. They work just slightly differently internally, with longjmp not being able to chain/nest exceptions properly. Read #578 for more info, around this part: "Linux uses different approach to exception handling than windows, because windows method was patented at the time. They still use setjmp/longjmp since then."
I don't like how functions are merged with exception handling in golang, functions should be just functions -- a piece of code that gets called and returns. I want my program to execute linearly, and only create functions when it's really necessary. If a piece of code gets executed only once, and a bunch of functions only execute together in they same order, they shouldn't be functions.
It really depends if there are better alternatives to finally or defer. Look at this https://github.com/zig-lang/zig/issues/578#issuecomment-343738259 , dumped a bit of what can be.
Creating extra function arguments when I need to pass something is quite annoying.

I was playing with ffmpeg filters recently, it's somewhat close to what I hope for https://ffmpeg.org/ffmpeg-filters.html
The difference is, the "variables" are autodeleted on use. You have to make copies of "variables" manually, with split and asplit, and you can delete them with nullsink and anullsink. Very confusing at times, and terribly uncomfortable. Because you absolutely have to make sure that input variables match output variables exactly, everything else is an error.
I'm dreaming of a language where I can type code like var1 var2 do-something -- output1 output2. And deleting them with a simple this-is-deleted // and last-use// do-something -- dont-need-this//. I described it here https://board.flatassembler.net/topic.php?p=199776#199776 . Wish I had money to implement it, but nobody shares them. Either I suck at explaining this, or I'm talking with the wrong people. At least steal my ideas, do my work for me, yes.

authors: Ilariel PavelVozenilek Perelandric andrewrk kyle-github pluto439 thejoshwolfe

repo: zig-lang/zig


text:
Small improvements to the tuya ts0021 quirk

Proposed change
Some cosmetic changes to the tuya.ts0021.TS0021 quirk:

Hide the "Opening"/"Smoke" sensor. The IaSZone cluster causes this device to be recognized sometimes as an Opening sensor, and sometimes as a Smoke sensor (see #2847). This is confusing, so I removed that cluster.
The logbook only shows a generic "Attribute Updated event was fired" for every action (single, double, long presses). This is also confusing (https://github.com/zigpy/zha-device-handlers/issues/2847#issuecomment-2294935137). I added a new zha_event that logs more specific actions like "Button 2 Double Press". I kept the old events, as not to break existing automations.
The battery always showed up as unavailable. I tried a bunch of things, including reading the power clusters attributes directly for the percentage_remaining, using the TuyaPowerConfigurationCluster2AAA, the TuyaNoBindPowerConfigurationCluster, waiting for 24h. But nothing seemed to work. It's likely that I'm missing something, but it's possible that the device does not expose its battery voltage/percentage. Since it's not working, I also removed the power clusters, so they don't show on the UI anymore.

Additional information
Before

After

Checklist

[x] The changes are tested and work correctly
[x] pre-commit checks pass / the code has been formatted using Black
[x] Tests have been added to verify that the new code works

Can you integrate the datapoint 10 for battery like here? https://github.com/Koenkk/zigbee2mqtt/discussions/19765#discussioncomment-8553808

Great find @Barneybaer84, tks. I will patch the PR as soon as I'm at my computer.

Works great :)

repo: zigpy/zha-device-handlers


text:
A Question about "How Standard LM Parameterization Fails"

I just use the screenshot from the appendix of the paper for simplicity.
My question is, based on the first condition, it seems that the second equation does not hold.
For two reasons (Assume we're predicting 3rd element with z_{<3} from permutation {x2, x1, x3, x4} and {x2, x1, x4, x3}, namely x3 and x4 respectively):

Since i =3<>j=4, even though the input to h(z_{<3}) are the same {e(x2), e(x1)}, the weights are different, {w_23, w_13} to predict x3, and {w_24. w_14} to predict x4.
For all layers, the weights are also different for different target predictions, even with same input neurons.
Therefore, h(x_{z<t}) does not equal for the two permutations, even with the same prefix.

Since i <> j, if:
2.1.  X_i <> X_j, then e(X_i) <> e(X_j), the first term in exp() does not equal when predicting z_3
(i.e. x3 and x4 are the same word)
2.2.  X_i = X_j, then e(X_i) = e(X_j),  the first term in exp() equals when predicting z_3

So the e(x) h(x_{z<t}) may not hold for the two permutations with same prefix.
This is my confusion. Please correct me if I'm wrong.
Thx a lot.

It seems to me that you are confusing a "variable" with a "value". Upper case means variables and lower case means values. The second equation says, when X_3 and X_4 take the same value x, they are given the same distributions by the model.

Thank you

authors: FisheWYZ kimiyoung

repo: zihangdai/xlnet


text:
[bug] CFG_LIST, add list parameter, crashed

I tried to add a list parameter, but the program crashed when it reached this code line:
https://github.com/zilliztech/knowhere/blob/3d21950cc27e8383c9435dd2c011b7635fd44ac3/include/knowhere/config.h#L437C52-L437C52
ptr->valmay not has value. This is how I modified, while I don't quite understand.
*ptr->val = CFG_LIST();
*ptr->val = ptr->default_val;
for (auto&& i : json[it.first]) {
    ptr->val->value().push_back(i);
}

@autoxj
Yes this a a bug, we will fix is in the next release.
You can keep the original code and replace CFG_LIST with std::make_optional<std::list<int>>() to solve it.

/assign @Presburger

good catch

authors: Presburger autoxj liliu-z

repo: zilliztech/knowhere


text:
Updated twig.js to 0.8.6 and the version number to 0.3.1

I'm using the latest version on a project with no issues.
The tests in the repo error (for me) but it appears to just be a line break issue. The new version is adding '\n' after each line in a way that the test don't like. I'm not sure how to resolve it. I am on Windows so perhaps they would pass without error on unix/OSX.

Looks like they do pass!

So, why don't we merge? :) I extremely need the "embed" tag added in the latest twig.js version...

I've been using it with the merge and it works great.
On Fri, Jan 15, 2016 at 7:10 AM, Implico notifications@github.com wrote:

So, why don't we merge? :) I extremely need the "embed" tag added in the
latest twig.js version...
—
Reply to this email directly or view it on GitHub
https://github.com/zimmen/gulp-twig/pull/23#issuecomment-171945379.

Sorry, I was enjoying some days off but here we go! :-)

Nice, thanks:)

I did publish it to NPM as version 0.5.0 so you might have to update your dependencies:-)

Op 15 jan. 2016 om 16:59 heeft Implico notifications@github.com het volgende geschreven:
Nice, thanks:)
—
Reply to this email directly or view it on GitHub.

authors: JoelSutherland implico zimmen

repo: zimmen/gulp-twig


text:
Update activity tag field length (Oipa 2520)

Closes #2520

:tada: This PR is included in version 5.6.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:

authors: sylvanr zz-github-machine


text:
DRAFT: radicle contrib init

Introduction and basic instructions for Radicle peer-to-peer network for code collaboration, and seednode.link

Codecov Report
Patch coverage has no change and project coverage change: -0.03 :warning:

Comparison is base (a7c1820) 55.66% compared to head (91b3f43) 55.63%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #346      +/-   ##
==========================================
- Coverage   55.66%   55.63%   -0.03%
==========================================
  Files          32       32
  Lines        4982     4984       +2
==========================================
  Hits         2773     2773
- Misses       2209     2211       +2

Impacted Files
Coverage Δ

zingocli/src/lib.rs
0.00% <0.00%> (ø)

zingolib/src/lib.rs
36.36% <0.00%> (-3.64%)
:arrow_down:

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

authors: codecov-commenter patitieso

repo: zingolabs/zingolib


text:
Nightly release trigger

This PR adds a nightly release cycle on our beta branch. Triggered each night at 00:00.
Previously releases got trigged by committing to, or merging into, the beta and master branches. Which is no longer needed, because both branches will be released on cycles. This PR therefor removes that old functionality.

:tada: This PR is included in version 2.1.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:

repo: zino-app/graphql-flutter


text:
Cannot initiate connection to backend

I face an issue that my request not reach to backend... Can you help in this?
also the same subscription work in Apollo graphql website.
 import 'package:flutter/material.dart';
import 'package:graphql_flutter/graphql_flutter.dart';

class TrackingScreen extends StatefulWidget {
  const TrackingScreen({Key? key}) : super(key: key);

  @override
  State<StatefulWidget> createState() {
    return _TrackingScreenState();
  }
}

class _TrackingScreenState extends State<TrackingScreen> {
  @override
  Widget build(BuildContext context) {
    final httpLink = HttpLink(
      'https://......',
    );

    final authLink = AuthLink(
      getToken: () async => 'Bearer token',
    );

    var link = authLink.concat(httpLink);

    final websocketLink = WebSocketLink(
      'wss://......',
      config: const SocketClientConfig(
        inactivityTimeout: Duration(seconds: 30),
        delayBetweenReconnectionAttempts: Duration(seconds: 10),
      ),
    );

    link = Link.split(
      (request) => request.isSubscription,
      websocketLink,
      link,
    );

    final client = ValueNotifier<GraphQLClient>(
      GraphQLClient(
        cache: GraphQLCache(),
        link: link,
      ),
    );

    return GraphQLProvider(
      client: client,
      child: CacheProvider(
        child: Subscription(
          options: SubscriptionOptions(
            document: gql(
                r"""subscription Tracking($frequencyInSeconds: Int!, $packageNumber: Int!) {
                  tracking(frequencyInSeconds: $frequencyInSeconds, packageNumber: $packageNumber) {

                    timestamp
                  }
                }"""),
            variables: {
              "frequencyInSeconds": 3,
              "packageNumber": 10,
            },
            operationName: 'Tracking',
          ),
          builder: (result) => result.isLoading
              ? const Text('Loading...')
              : Text(result.data.toString()),
        ),
      ),
    );
  }

we need an example for this!
You can use our endpoint https://api.chat.graphql-flutter.dev/graphql

Hi @vincenzopalazzo
Yes I try it with your endpoint but it the same issue keep show loading only.

if you push the example that you try somewhere I can reproduce it, because I'm currently use in production the client and my code works

Hi
Here is the full code exactly.
`import 'package:flutter/material.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
class TrackingScreen extends StatefulWidget {
const TrackingScreen({Key? key}) : super(key: key);
@override
State createState() {
return _TrackingScreenState();
}
}
class _TrackingScreenState extends State {
@override
Widget build(BuildContext context) {
final httpLink = HttpLink(
'https://api.chat.graphql-flutter.dev/graphql',
);
final authLink = AuthLink(
  getToken: () async => 'Bearer token',
);

var link = authLink.concat(httpLink);

final websocketLink = WebSocketLink(
  'wss://api.chat.graphql-flutter.dev/graphql',
  config: const SocketClientConfig(
    inactivityTimeout: Duration(seconds: 30),
    delayBetweenReconnectionAttempts: Duration(seconds: 10),
  ),
);

link = Link.split(
  (request) => request.isSubscription,
  websocketLink,
  link,
);

final client = ValueNotifier<GraphQLClient>(
  GraphQLClient(
    cache: GraphQLCache(),
    link: link,
  ),
);

return GraphQLProvider(
  client: client,
  child: CacheProvider(
    child: Subscription(
      options: SubscriptionOptions(
        document: gql("""subscription ChatCreated {
          chatCreated {
            id
            description
            name
          }
        }"""),
      ),
      builder: (result) => result.isLoading
          ? const Center(child: Text('Loading...'))
          : Center(child: Text(result.data.toString())),
    ),
  ),
);

}
}`

@vincenzopalazzo
check this screenshot of what is printing in the debug console.

Mh I think you need to change the protocol.
Check how I do this https://github.com/zino-hofmann/graphql-flutter/pull/1204

Hi @vincenzopalazzo
The issue fixed after upgrade to graphql_flutter 5.1.1-beta.4  and add subprotocol to Graphql-transport-ws.

Coo! :) the beta is not so reckless is it?

authors: MagedAlNaamani vincenzopalazzo

repo: zino-hofmann/graphql-flutter


text:
Use with VS Code

I'd like to use Visual Studio Code's debugger with mocha-webpack tests. VS Code can debug mocha tests, but you have to tell it to use "node_modules/mocha/bin/_mocha" and not "mocha".
For mocha-webpack I tried both "node_modules/mocha-webpack/bin/mocha-webpack" and "node_modules/mocha-webpack/bin/_mocha" and it would run the tests but not attach the debugger. Not sure what is going wrong. Possibly related to #19

I don't use VS Code, but it's perhaps similiar to Intellij's mocha plugin.
The following config works for me. Have a look at devtoolModuleFilenameTemplate, devtoolFallbackModuleFilenameTemplate and devtool.
webpack.config.test.js
module.exports = {
  ....
  output: {
    devtoolModuleFilenameTemplate: '[absolute-resource-path]',
    devtoolFallbackModuleFilenameTemplate: '[absolute-resource-path]?[hash]'
  }
  target: 'node',
  devtool: "source-map"
};

Moreover i had to include source-map-support with --require source-map-support/register in my mocha-webpack.opts or as command argument.

Thanks for the suggestion. The devtool- options fixed VS Code debugging of my manual test build, but Code still doesn't attach to mocha-webpack.
I tried "--require source-map-support/register", but it breaks both mocha and mocha-webpack with the following error:
node_modules/source-map-support/source-map-support.js:411
      var hasStack = (arguments[1] && arguments[1].stack);
                                                  ^
SyntaxError:

I managed to fix the source-map-support syntax error by adding the 'node' environment option: evanw/node-source-map-support#137
The VS Code attachment issue remains though.

+1
it would be useful to have a --debug-brk option to run mocha in debug mode
The workaround is to compile with webpack, run mocha with --debug-brk and the attach VS Code debugger

--debug-brk option isn't necessary. Mocha have this option only cause they are spawning another mocha process (see here). mocha-webpack does not spawn another process, so --debug-brk  should work without further adjustments.

Are you manage to run it?
I'm getting an error:

Module parse failed: Unexpected token
You may need an appropriate loader to handle this file type

but it's the same webpack config that I run in the console. what can be the problem here?

Does anybody have any success with that?

+1, not been able to debug tests in vscode using mocha-webpack. Any updates?

I have tried the following code is feasible, but I don't know why.
webpack.config.js
if (process.env.NODE_ENV === "test") {
    //If you would to use breakpoint in vscode, then must be set devtool to "eval" base
    config.devtool = "eval-source-map";
    config.output = Object.assign(config.output, {
        devtoolModuleFilenameTemplate: "[absolute-resource-path]",
    });
}

{
    "version": "0.2.0",
    "configurations": [
    {
        "type": "node",
        "request": "launch",
        "name": "Mocha-webpack Tests",
        "program": "${workspaceFolder}/node_modules/mocha-webpack/bin/mocha-webpack",
        "args": [
            "--full-trace",
            "--timeout",
            "999999",
            "--colors",
            "tests/**/*.js"
        ],
        "sourceMaps": true,
        "env": {
            "NODE_ENV": "test"
        },
        "internalConsoleOptions": "openOnSessionStart"
    }]
}

authors: doronbrikman fabyo82 lpreterite notenoughneon rosieks xugao zinserjan

repo: zinserjan/mocha-webpack