idea: minimize html in build mode

Is your feature request related to a problem? Please describe.
Should vite build minify generated html files?  Downsides:

they're harder to read, though devtools can pretty print.
adds time to the build

Upside:

potentially loads faster

Describe the solution you'd like
pass html through something like html-minifier or roll something simple from scratch
Additional context
Seems logical given that js and css are minimized in build mode.

@isaacl You can try this simple plugin
https://github.com/anncwb/vite-plugin-html


ROR/Author Affiliation example doesn't seem to "just work" as of 5.12

I picked up https://github.com/IQSS/dataverse/issues/9150 but I've been a bit blocked by a working example of an external vocab script.
I tried getting the ROR/Author Affiliation script working, which I had tested early on when this (awesome) PR was created:

#9

However, as of https://github.com/IQSS/dataverse/commit/ecc23c0ebf (post 5.12.1 "develop" branch), the affiliation script doesn't seem to "just work" anymore.
I have a theory that it's breaking because an extra div was introduced in line 286 in this commit: https://github.com/IQSS/dataverse/commit/8c4c3d356274054c4fb5719e099af52bdfe1098f#diff-5ff0dd346b5d156cd409cd8a793e99ad72fbbe677bd1ec54e44406b2858cb2b4R286 . If that's right, the affiliation script doesn't work for 5.12 and newer.
 I'm not so good with CSS but I'm hoping someone (maybe even the original authors of PR #9, @Kris-LIBIS and @KaDee) might have a better, cleaner suggestion.
Or maybe we need to add more id's to divs in the JSF code? Someday we plan to move to React.
Anyway, with the hack above in place, I can see the magnifying glass and inserting values seems to work. Here are a couple screenshots:

There's an issue in this sprint that's even more related to all this:

https://github.com/IQSS/dataverse/issues/9151

One final thing I'll mention is that @qqmyers suggested not having "authorAffiliation" twice in examples/config/affiliation.json so I changed field-name to just "author" but I haven't tested this much, but he's right. As soon as I made this switch I was able to see the final HTML annotated with "data cvoc" here and there. So this seems important too as a prerequisite to the the hack above.
   {
-    "field-name": "authorAffiliation",
+    "field-name": "author",
     "term-uri-field": "authorAffiliation",

Yes, indeed. Some changes in the GUI of 5.12 broke the script and we had to change our script as well to make it work again. @ErykKUL made these changes and unfortunately it was not as simple as changing the selector, but not that complex either. From the identifiable element (div#metadata_author), we now have to step up the DOM hierarchy and that cannot be done with just the CSS query syntax, so some Javascript needs to be added to navigate up and search back down to find the edit boxes to add the search icon to.  I hope Eryk can explain better what changes are needed, but it does indeed not seem to be a good idea to use those generated identifiers in the selector.
BTW, @Kris-LIBIS and @KaDee both are me. The first is a work-account and the second one is my private one. I should have used only the first one.

@Kris-LIBIS described it correctly. Also, we have now a new way of adding a custom JavaScript to the dataset page:
:ControlledVocabularyCustomJavaScript allows a JavaScript file to be loaded into the dataset page for the purpose of showing controlled vocabulary as a list (with optionally translated values) such as author names.
To specify the URL for a custom script covoc.js to be loaded from an external site:
curl -X PUT -d 'https://example.com/js/covoc.js' http://localhost:8080/api/admin/settings/:ControlledVocabularyCustomJavaScript

Our relevant code looks something like this now:
let elements = $("#metadata_author")?.parent()?.parent()?.find(".dataset-field-values .edit-compound-field");
for(let i = 0; i < elements?.length; i++) {
  let metadataField = elements[i].children[0];
  ...
  metadataField.appendChild(...);
  ...
}

FWIW: There's an alternative script/config example in #14 that is compatible with Dataverse 5.14+

2023/12/18

Related to: Get the existing ROR plug-in working on the dataverse demo#9151

Closing in favor of this issue:

https://github.com/IQSS/dataverse/issues/9151


Error while creating release definition: Tasks with versions 'ARM Outputs:6.*' are not valid for deploy job 'Agent job' in stage Stage 1.

AB#3945

@bharath199406 If you are running Demo Generator on a brand new organization, please enable the Third-party application access via OAuth under  Organization Setting >> Policies

Run the demo generator again and try to install the extension needed by the template.
Thanks


Should I call flush before closing when using ZstdOutputStream?

Hopefully, someone could help on whether we should call flush before closing a ZstdOuputStream? Because this could produce different behavior.
    // compress without flush
    byte[] bytes1 = null;
    ByteArrayOutputStream outputStream1 = new ByteArrayOutputStream();
    try(ByteArrayOutputStream out = outputStream1;
        ZstdOutputStream zstd = new ZstdOutputStream(out, 3)) {
      zstd.setWorkers(0);

      zstd.write(0);
    }

    bytes1 = outputStream1.toByteArray();

    // compress with flush
    byte[] bytes2 = null;
    ByteArrayOutputStream outputStream2 = new ByteArrayOutputStream();
    try(ByteArrayOutputStream out = outputStream2;
        ZstdOutputStream zstd = new ZstdOutputStream(out, 3)) {
      zstd.setWorkers(0);

      zstd.write(0);

      zstd.flush(); // flush before close
    }

    bytes2 = outputStream2.toByteArray();

    Arrays.equals(bytes1, bytes2);

Call flush could produce extra 3 bytes:

Have you tried to call zstd.close() - it's not guaranteed the zstd stream is closed before calling outputStream1.toByteArray();
Closing the stream makes sure all the data is flushed downstream, so you don't need to flush it before that.
You need to call flush only if you have nor finished the stream but want to make sure that all written data is propagated downstream.

@luben, thank you for your response. The reason for this is that Apache Parquet added a flush before closing the ZstdOutputStream (as seen in this pull request). We noticed that the file sizes changed after upgrading the Parquet version.
I have another question: Is it acceptable to have some extra bytes in the output? These should be frame metadata, correct?

Yes, it will not hurt.

thanks @luben


Question - InfluxDB 1.6 Support?

I see that this fork is the most current fork for InfluxDB-Relay. Despite this, I have been unable to get the relay working with InfluxDB 1.6. Whenever I start the relay, it appears to hang at "Starting relays...".

Pretty strange we're using 1.6.2.
ii  influxdb                        1.6.2-1                            amd64        Distributed time-series database.
We look deeper in our setup.

Oct 17 10:57:06 noc-gd2z1l2 influxdb-relay[27410]: 2018/10/17 10:57:06 Starting relays...
Oct 17 10:57:06 noc-gd2z1l2 influxdb-relay[27410]: 2018/10/17 10:57:06 Starting UDP relay "udp-relay" on <IP_ADDRESS>:9096
Oct 17 10:57:06 noc-gd2z1l2 influxdb-relay[27410]: 2018/10/17 10:57:06 Starting HTTP relay "http-relay" on <IP_ADDRESS>:9096
Our (simple) configuration:
[[http]]

name = "http-relay"
bind-addr = "<IP_ADDRESS>:9096"
output = [
  { name = "influxdb01", location = "http://influxdb01.example.com:8086/write", timeout = "60s" },
  { name = "influxdb02", location = "http://influxdb01.example.com:8086/write", timeout = "60s" },
]

Ok, it appeared to be a configuration issue on my end. I believe I have it working now

Keep us informed we plan to maintain influxdb-relay for long-term period.

Confirmed issue was on my end. Been using this fork for a week, no major issues :+1:


Embedded C IoT Hub Certificate Samples on Linux don't compile

Describe the bug
The Embedded C IoT Hub Certificate Samples on Linux don't compile.
Exception or Stack Trace
None.
To Reproduce
Steps to reproduce the behavior:

follow the instructions up to and including section 4 of Configure and Run the Samples
the result of the cmake --build . command of section 5 is:

/home/pascalb/azure-sdk-for-c/sdk/samples/iot/paho_iot_provisioning_sas_sample.c:152:3: error: missing initializer for field ‘httpsProxy’ of ‘MQTTClient_connectOptions’ {aka ‘struct <anonymous>’} [-Werror=missing-field-initializers]
  152 |   MQTTClient_connectOptions mqtt_connect_options = MQTTClient_connectOptions_initializer;
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~

Code Snippet
See above.
Expected behavior
Should compile.
Screenshots
None.
Setup (please complete the following information):

OS: Linux Mint 20.1
IDE: none
Version of the Library used: not applicable

Additional context
None.
Information Checklist
Please make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

[X] Bug Description Added
[X] Repro Steps Added
[X] Setup information Added

Interesting this seems to happen with the newest version of the vcpkg paho-mqtt. For now, I would recommend using the vcpkg version which we have here which we support.

I have a issue here on paho for it.

Going to go ahead and close this for now since we have a working vcpkg hash and the issue was opened on Paho.

PR
https://github.com/eclipse/paho.mqtt.c/pull/1068

This fix has been merged on paho


split hash in chunks of 3 chars when entering

just my personal preference, I'd like them split in chunks of three chars, independent from how they where entered

Thanks!


error parsing docs saved with open office

I took a document made with MS Excel, that was saved as .xlsx
I opened in open office, then saved (as .xlsx).
I started getting this error:

Error:
test_get_file_header(TestSpreadsheet2Cloud):
TypeError: can't convert Symbol into Integer
/home/hoguej/.rvm/gems/ruby-1.9.2-p180/gems/rubyXL-1.1.12/lib/rubyXL/cell.rb:32:in []' /home/hoguej/.rvm/gems/ruby-1.9.2-p180/gems/rubyXL-1.1.12/lib/rubyXL/cell.rb:32:in block in is_date?'
/home/hoguej/.rvm/gems/ruby-1.9.2-p180/gems/rubyXL-1.1.12/lib/rubyXL/cell.rb:32:in select' /home/hoguej/.rvm/gems/ruby-1.9.2-p180/gems/rubyXL-1.1.12/lib/rubyXL/cell.rb:32:in is_date?'
/home/hoguej/.rvm/gems/ruby-1.9.2-p180/gems/rubyXL-1.1.12/lib/rubyXL/cell.rb:21:in value' /home/hoguej/.rvm/gems/ruby-1.9.2-p180/gems/rubyXL-1.1.12/lib/rubyXL/worksheet.rb:31:in block (2 levels) in extr
act_data'
/home/hoguej/.rvm/gems/ruby-1.9.2-p180/gems/rubyXL-1.1.12/lib/rubyXL/worksheet.rb:31:in map' /home/hoguej/.rvm/gems/ruby-1.9.2-p180/gems/rubyXL-1.1.12/lib/rubyXL/worksheet.rb:31:in block in extract_data'
/home/hoguej/.rvm/gems/ruby-1.9.2-p180/gems/rubyXL-1.1.12/lib/rubyXL/worksheet.rb:31:in map' /home/hoguej/.rvm/gems/ruby-1.9.2-p180/gems/rubyXL-1.1.12/lib/rubyXL/worksheet.rb:31:in extract_data'
/home/hoguej/dev/Spreadsheet2Cloud/lib/spreadsheet_2_cloud.rb:25:in headers' test/unit/test_spreadsheet_2_cloud.rb:46:in test_get_file_header'

If I skip the is_date? function, everything works fine.

Can you attach an example of the file that gives the error?

Here's the code I'm working on, fyi, https://github.com/hoguej/Spreadsheet2Cloud
I couldn't figure out how to attach to an issue, but it's avail here.
https://github.com/hoguej/Spreadsheet2Cloud/blob/master/test/unit/test.xlsx
This is the test file that causes the error.
https://github.com/hoguej/Spreadsheet2Cloud/blob/master/test/unit/test_spreadsheet_2_cloud.rb
(not that I'm monkey patching the Cell class here: https://github.com/hoguej/Spreadsheet2Cloud/blob/master/lib/spreadsheet_2_cloud.rb)


Update README.md

Example slack reaction add was failing, updated shorthand property names to match Slack API in example.

Coverage decreased (-3.04%) to 96.958% when pulling 0bb195e5bcc4150893346b829f2560a0988abb49 on jaylandro:patch-1 into 6ffaf627a45557150177c171286aa614c9686107 on BeepBoopHQ:master.


Fix Simple Typo

There is a small typo in README.md.
Should read behaviour precisely rather than behavior.

"Behavior" is the standard American English spelling, so no typos there.


⚠ Bofrost.be has degraded performance

In 50ecde5, Bofrost.be (https://www.bofrost.be) experienced degraded performance:

HTTP code: 200
Response time: 1136 ms

Resolved: Bofrost.be performance has improved in be580f3.


Indexes with clear benefit not picked up

Here is one case of a query with an index not being picked up.  I was expecting an index on a timestamp field which filters out over 90% of the data.
SQL:
select
	p.id as person_id,
	count(distinct bi.customer_name) as value
from people p
join customers c on c.person_id=p.id
join bars.table_1 dih on dih.customer_id=c.id
join bars.table_2 ba on ba.bar_id=dih.bar_id
join foo_info bi on bi.field_1 = ba.field_1 and bi.customer_name is not null
where dih.bar_type_id=2
	and dih.created_on>current_timestamp-interval'30 days'
group by 1

;

Plan (it said no indexes found):
                                                                     QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------
 GroupAggregate  (cost=1027786.18..1028521.02 rows=41991 width=12)
   Group Key: p.id
   ->  Sort  (cost=1027786.18..1027891.15 rows=41991 width=30)
         Sort Key: p.id
         ->  Hash Join  (cost=771.36..1024561.73 rows=41991 width=30)
               Hash Cond: ((ba.field_1)::text = (bi.field_1)::text)
               ->  Nested Loop  (cost=1.30..1023214.29 rows=41991 width=11)
                     ->  Nested Loop  (cost=0.87..1000310.55 rows=41991 width=11)
                           ->  Nested Loop  (cost=0.43..717486.22 rows=41991 width=11)
                                 ->  Seq Scan on table_1 dih  (cost=0.00..408446.64 rows=50173 width=8)
                                       Filter: ((bar_type_id = 2) AND (created_on > (now() - '30 days'::interval)))
                                 ->  Index Scan using table_2__pk_bar_id on table_2 ba  (cost=0.43..6.15 rows=1 width=11)
                                       Index Cond: (bar_id = dih.bar_id)
                           ->  Index Scan using customers_pkey on customers c  (cost=0.43..6.73 rows=1 width=8)
                                 Index Cond: (id = dih.customer_id)
                     ->  Index Only Scan using people_pkey on people p  (cost=0.43..0.54 rows=1 width=4)
                           Index Cond: (id = c.person_id)
               ->  Hash  (cost=547.25..547.25 rows=17825 width=33)
                     ->  Seq Scan on foo_info bi  (cost=0.00..547.25 rows=17825 width=33)
                           Filter: (customer_name IS NOT NULL)
(20 rows)

Plan after I created an index on created_on:
                                                                                QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 GroupAggregate  (cost=621942.73..622677.47 rows=41985 width=12)
   Group Key: p.id
   ->  Sort  (cost=621942.73..622047.70 rows=41985 width=30)
         Sort Key: p.id
         ->  Hash Join  (cost=771.80..618718.79 rows=41985 width=30)
               Hash Cond: ((ba.field_1)::text = (bi.field_1)::text)
               ->  Nested Loop  (cost=1.74..617371.44 rows=41985 width=11)
                     ->  Nested Loop  (cost=1.31..594470.96 rows=41985 width=11)
                           ->  Nested Loop  (cost=0.87..311668.09 rows=41985 width=11)
                                 ->  Index Scan using table_1_created_on_idx on table_1 dih  (cost=0.44..2708.33 rows=50156 width=8)
                                       Index Cond: (created_on > (now() - '30 days'::interval))
                                       Filter: (bar_type_id = 2)
                                 ->  Index Scan using table_2__pk_bar_id on table_2 ba  (cost=0.43..6.15 rows=1 width=11)
                                       Index Cond: (bar_id = dih.bar_id)
                           ->  Index Scan using customers_pkey on customers c  (cost=0.43..6.73 rows=1 width=8)
                                 Index Cond: (id = dih.customer_id)
                     ->  Index Only Scan using people_pkey on people p  (cost=0.43..0.54 rows=1 width=4)
                           Index Cond: (id = c.person_id)
               ->  Hash  (cost=547.25..547.25 rows=17825 width=33)
                     ->  Seq Scan on foo_info bi  (cost=0.00..547.25 rows=17825 width=33)
                           Filter: (customer_name IS NOT NULL)
(21 rows)

Here is another case.  Original query actually times out after 12 hours (lots of data here).  Obvious missing customer_id index in the left join lateral.  It has to do a seq scan in each loop:
select
	    ltrim(ba.foo_number :: text,'0'::text) as foo_number, ba.field_1::text
	    ,string_agg(distinct l.customer_id::text, '|') as value
	from bars.table_2 ba
	inner join customers c on c.person_id= ba.person_id
	left join lateral (select l.customer_id as customer_id
                      from oreos l
                      where l.customer_id = c.id
                      and l.status_cd in ('happy','happy_super','in_sad','in_sad_super','woohoo')
                      limit 1
                    ) l on true
	where nullif(ltrim(ba.foo_number :: text,'0'::text),'') is not null and ba.field_1 is not null
	group by 1,2;

Plan (dexter says no indexes found):
                                                                             QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
 GroupAggregate  (cost=632357813747.76..632358072383.43 rows=3497595 width=96)
   Group Key: (ltrim((ba.foo_number)::text, '0'::text)), ((ba.field_1)::text)
   ->  Sort  (cost=632357813747.76..632357848109.72 rows=13744783 width=68)
         Sort Key: (ltrim((ba.foo_number)::text, '0'::text)), ((ba.field_1)::text)
         ->  Nested Loop Left Join  (cost=417941.32..632355620388.12 rows=13744783 width=68)
               ->  Gather  (cost=417941.32..3380621.18 rows=13744783 width=20)
                     Workers Planned: 3
                     ->  Hash Join  (cost=416941.32..2005142.88 rows=4433801 width=20)
                           Hash Cond: (c.person_id = ba.person_id)
                           ->  Parallel Seq Scan on customers c  (cost=0.00..513188.08 rows=3443908 width=8)
                           ->  Hash  (cost=266275.53..266275.53 rows=8206463 width=20)
                                 ->  Seq Scan on table_2 ba  (cost=0.00..266275.53 rows=8206463 width=20)
                                       Filter: ((field_1 IS NOT NULL) AND (NULLIF(ltrim((foo_number)::text, '0'::text), ''::text) IS NOT NULL))
               ->  Limit  (cost=0.00..46006.69 rows=1 width=4)
                     ->  Seq Scan on oreos l  (cost=0.00..690100.31 rows=15 width=4)
                           Filter: ((customer_id = c.id) AND ((status_cd)::text = ANY ('{happy,happy_super,in_sad,in_sad_super,woohoo}'::text[])))
(16 rows)

After I manually create index on customer_id:
                                                                        QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------------
 GroupAggregate  (cost=71826098.56..72084734.24 rows=3497595 width=96)
   Group Key: (ltrim((ba.foo_number)::text, '0'::text)), ((ba.field_1)::text)
   ->  Sort  (cost=71826098.56..71860460.52 rows=13744784 width=68)
         Sort Key: (ltrim((ba.foo_number)::text, '0'::text)), ((ba.field_1)::text)
         ->  Nested Loop Left Join  (cost=417941.75..69632738.79 rows=13744784 width=68)
               ->  Gather  (cost=417941.32..3380624.29 rows=13744784 width=20)
                     Workers Planned: 3
                     ->  Hash Join  (cost=416941.32..2005145.89 rows=4433801 width=20)
                           Hash Cond: (c.person_id = ba.person_id)
                           ->  Parallel Seq Scan on customers c  (cost=0.00..513189.15 rows=3443915 width=8)
                           ->  Hash  (cost=266275.53..266275.53 rows=8206463 width=20)
                                 ->  Seq Scan on table_2 ba  (cost=0.00..266275.53 rows=8206463 width=20)
                                       Filter: ((field_1 IS NOT NULL) AND (NULLIF(ltrim((foo_number)::text, '0'::text), ''::text) IS NOT NULL))
               ->  Limit  (cost=0.43..4.80 rows=1 width=4)
                     ->  Index Scan using oreos_customer_id_idx on oreos l  (cost=0.43..65.87 rows=15 width=4)
                           Index Cond: (customer_id = c.id)
                           Filter: ((status_cd)::text = ANY ('{happy,happy_super,in_sad,in_sad_super,woohoo}'::text[]))
(17 rows)

Thanks @jfinzel, can you share the --log-level debug2 output for each of them?

It looks like you are close on both counts - would love if cost savings is configurable!  Very interested why the second query here shows the massive cost savings but doesn't do it.
Last analyze: cnu.foo_info : 2018-02-12T12:45:09-06:00
Last analyze: cnu.customers : 2018-02-12T12:44:40-06:00
Last analyze: bars.table_2 : 2018-02-12T12:44:59-06:00
Last analyze: bars.table_1 : 2018-02-12T12:44:56-06:00
Last analyze: john.people : 2018-02-12T12:45:52-06:00
No new indexes found
--------------------------------------------------------------------------------
Query 0200d1693157e91f1b595826c1df124ea9e56c5832
Start: 1464495.4
Pass1: 961150.04 : bars.table_1 (created_on)
Pass2: 961150.04 : bars.table_1 (created_on)
Final: 1464495.4 : None
Need 50% cost savings to suggest index

select
        p.id as person_id,
        count(distinct bi.customer_name) as value
from people p
join customers c on c.person_id=p.id
join bars.table_1 dih on dih.customer_id=c.id
join bars.table_2 ba on ba.bar_id=dih.bar_id
join foo_info bi on bi.field_1 = ba.field_1 and bi.customer_name is not null
where dih.bar_type_id=2
        and dih.created_on>current_timestamp-interval'30 days'
group by 1

;

Last analyze: cnu.customers : 2018-02-12T12:44:40-06:00
Last analyze: cnu.oreos : 2018-02-12T12:46:57-06:00
Last analyze: bars.table_2 : 2018-02-12T12:44:59-06:00
No new indexes found
--------------------------------------------------------------------------------
Query 022ca61698c1c6a1d725fd73d93db465275781dfdc
Start:<PHONE_NUMBER>48.52
Pass1: 61343598.12 : cnu.oreos (customer_id), bars.table_2 (person_id)
Pass2: 61343598.12 : cnu.oreos (customer_id), bars.table_2 (person_id)
Final:<PHONE_NUMBER>48.52 : None

select
            ltrim(ba.foo_number :: text,'0'::text) as foo_number, ba.field_1::text
            ,string_agg(distinct l.customer_id::text, '|') as value
        from bars.table_2 ba
        inner join customers c on c.person_id= ba.person_id
        left join lateral (select l.customer_id as customer_id
                      from oreos l
                      where l.customer_id = c.id
                      and l.status_cd in ('happy','happy_super','in_sad','in_sad_super','woohoo')
                      limit 1
                    ) l on true
        where nullif(ltrim(ba.foo_number :: text,'0'::text),'') is not null and ba.field_1 is not null
        group by 1,2;

For query 1, it may make sense to have an absolute cost savings in addition to a percentage, as 30% can be significant if a query has a very high cost.
For query 2, the cost savings is driven by two indexes, and Dexter doesn't have a good way to figure out if both are really needed at the moment. This has led to poor index suggestions in my experience, so it won't suggest for now. Definitely an area for improvement.

@ankane regarding case 2, I would suggest that dexter tries adding the indexes one at a time and checking cost.  I can tell you the customer_id index is 1000x more important than the person_id index here.  But you could tell that very easily if you added them in order.
Also, there are certainly going to be cases where a query could benefit from more than 1 index being added.  I haven't yet provided you with some of our queries that have 20+ joins :).
Interesting to note and perhaps worthy of documentation? - if I lower random_page_cost to 2, which is actually more appropriate for the system, it creates the index.  It is worth mentioning that because the indexes are cost-based, it is important that your cost settings are appropriately tuned.

@ankane any update or at least ETA on this?

Hey @jfinzel, both cases should be addressed now. There's now a --min-cost-savings-pct option.
dexter --min-cost-savings-pct 30 ...

Let me know how it goes.

Hey @jfinzel, have you had a chance to try the latest version?

@ankane I have been busy but am now getting around to this.  I have updated to latest version and will let you know how it goes.  Many thanks again!

Hey @jfinzel, going to close this out. Let me know if you find anything.


Recover illegible text, volume 1861, p. 98

vol. 1861, p. 98

https://www.e-rara.ch/bes_1/periodical/pageview/1395952

Here's the 1862 counterpart:

This resolves the first and third lines, but not the second (seems M. Ludwig, Schnd., relocated from Spitalgasse 168 to 167 during the year in question).
Perhaps the bookseller F. E. Ludwig is mentioned in a later volume.

Normaly there exist more than one print version of one adress book. Thomas Hayoz can check this out for us, as soon as we have collected some cases.


Words or links that are longer than the text box is wide don't wrap in message boxes

Repro steps: go to the demo page https://microsoft.github.io/BotFramework-WebChat/01.a.getting-started-full-bundle/ and for the user message type "https://subdomain.domain.com/pathname0/pathname1/pathname2/pathname3/pathname4/". The last part of the URL doesn't show up in the user or bot message boxes.
This could be fixed by adding "word-break: break-all;" as a style to .row.message elements

Thanks for reporting this find.

To clarify for the fixer, the string must have no spaces for it to repro on (a) word. There seems to be a max of about 70-80 characters before the string gets cut.

I tested the following HTML code:
<!DOCTYPE html>

https://subdomain.domain.com/pathname0/pathname1/pathname2/pathname3/pathname4/

It is not wrapped, but scrolled/clipped. I would prefer to follow default behavior of HTML.
So I would prefer to either:

Keep it as-is (clipped)
Add a scroll bar inside the bubble

On the other hand, if you prefer word-break: break-all, you can set it thru styleSet.

@mewa1024  and @DesignPolice, do we have a design preference on whether the text of URLs is clipped, scrolled, or wrapped? It looks like @compulim's preferred way is to keep it clipped.

@corinagum I don't have a strong preference off the top of my head, but I think enabling the user to word-break by customizing WebChat seems fine as a P1. Sometimes truncation has a tooltip that shows the full value, but that would only for links, not for reallylongwordsthatarenotlinksandthereforehavenohoverstatetooltips.

Thanks for the input. Temporarily assigning @compulim so he can add in a rebuttal, if he wishes.

Agree with @mewa1024, tooltip is tricky here:

Tooltip can be added everywhere in HTML using pneumonoultramicroscopicsilicovolcanoconiosis
But we can't easily differentiate which area need to add tooltip (no clear boundary)
Conclusion, can't add tooltip

I see Teams is also breaking up long words. Didn't check other messaging apps yet.
I am okay to add a styleOptions:

messageActivityWordBreak can be set to normal, break-all, or keep-all,  based on the equivalent CSS style. Default is normal.

Going with break-word -- better experience overall


Triage "Mvc" flaky tests

I need to go down the list of flaky tests belonging to the Mvc team and make a quick determination which ones are most likely to be product issues. Those items which we believe to be actual product bugs we should try for preview2, others will be rc.

Completed this, @mkArtakMSFT has the list.


Fix datepicker position

@willbarrett, Can you please review this PR? So we can get the updated changes here


--show-boot breaks the interactive shell

Hello,
fakemachine --show-boot execs an interactive shell but most characters typed-in get eaten by another process.
Things work correctly if --show-boot is not set.
To reproduce it, simply run
$ fakemachine --show-boot

Welcome to Arch Linux!

(...)
[  OK  ] Started fakemachine runner.
Running /bin/bash using kvm backend
bash-5.1#
(most of characters are eaten...)

tty appears to be /dev/console.
As you see, I am running this on Arch Linux. It may come from this; I wonder if Debian users reproduce the same issue.
Any idea?

The same thing happens in debos; see https://github.com/go-debos/debos/issues/191

Also the console output seems to clear itself, seems like it's since we start Plymouth during the machine boot...
[  OK  ] Started Show Plymouth Boot Screen.
[  OK  ] Started Forward Password R…s to Plymouth Directory Watch.

Also, this seems to only affect KVM/QEMU backends. UML (fakemachine --show-boot --backend=uml) is unaffected.

I was able to reproduce the issue without plymouth. If you'd like some output logs I'm happy to share next time I play with debos/fakemachine.

When the issue was reported there was no plymouth in Arch, so odds are Gaël and I are hitting the same not plymouth related issue.

Okay, logs or reproduction method would be great. It doesn't happen in Debian. I will unlink the other PR from closing this issue.

@evelikov I am still waiting for some instructions on the above. From my testing #162 fixes the remaining shell issues with --show-boot on Debian.

Right, I had them listed in the internal task as per your request a while back. Will cross check and copy/paste as time permits.

On a side note, I'm trying to move the Debos roadmap to GitHub in the clear. It will allow for community to understand and help with blockers.

Did anyone test this again under arch after the fix #162 was merged ?
cc @evelikov @gportay
I don't know how to use arch so I cannot test there.

Did anyone test this again under arch after the fix https://github.com/go-debos/fakemachine/pull/162 was merged ?

I am not using debos anymore, I am sorry and it is so old for me to remember the exact issue.

Not using debos any more either - migrated to mkosi instead.

Let's consider it closed, then. If others have issues we can reopen it.


Add cli command to terminate multiple instances

Currently there is only option to terminate one instance at a time. Modified cellery terminate command to have the capability to terminate multiple/all instances at once from the runtime.
Updated the docs with the command changes.

Resolves https://github.com/wso2-cellery/sdk/issues/329

Codecov Report

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

@@           Coverage Diff           @@
##           master     #512   +/-   ##
=======================================
  Coverage   64.45%   64.45%
=======================================
  Files          34       34
  Lines        1176     1176
  Branches       98       98
=======================================
  Hits          758      758
  Misses        365      365
  Partials       53       53

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 9910e00...8a5692b. Read the comment docs.


Added specific Errno exceptions (Errno::ENOENT, ...)

I love that Ruby raises specific Errno exceptions, so we can rescue only selected and let others go through:
begin
  File.open("whatever") { ... }
rescue Errno::ENOENT
  ...
end

This is nicer to read than the current Crystal way, and avoids useless catches:
begin
  File.open("whatever") { ... }
rescue ex : Errno
  if ex.errno == Errno::ENOENT
    ...
  else
    raise ex
  end
end

The drawback is that Errno.find_exception_class(errno) references all the specific exceptions, which in turn requires them all in the compiled binary, even if we only need a few of them. Maybe there is a better way than having a big case. Maybe this isn't even a problem.

I wanted to keep a compatibility layer with the current implemetation, by setting #errno to the class instead of the errno value, but it wouldn't work because of #443

Nice! Did you notice any performance difference in compilation times with this change?

I just tried with Prax using current behavior or errno classes, and I'm noticing a slower compilation time (build --release, with a cleared .crystal folder):
master:
real    0m2.322s
user    0m2.252s
sys     0m0.146s

std-errno-classes:
real    0m2.973s
user    0m2.945s
sys     0m0.172s

What about without the --release flag?

Also, please, could you send the output of running crystal build prax.cr -s, so we can see where the time gets increased?

master:
real    0m1.010s
user    0m1.222s
sys     0m0.626s

Parse: 00:00:00.0836840
Type inference: 00:00:00.5924300
Codegen (crystal): 00:00:00.0725770
Codegen (bc+obj): 00:00:00.2505870
Codegen (clang): 00:00:00.0496720

std-errno-classes:
real    0m1.594s
user    0m1.863s
sys     0m1.028s

Parse: 00:00:00.0821350
Type inference: 00:00:00.9659820
Codegen (crystal): 00:00:00.0917940
Codegen (bc+obj): 00:00:00.3501700
Codegen (clang): 00:00:00.0590350

Don't worry, that's something to fix on our side, but I guessed it would be slow.

We think we'll implement #1124, or at least it's a more general solution.


MultilineParser achieve an effect similar to embedding by using anonymous structs

What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #1131 #1132
Does this PR introduced a user-facing change?
None
MultilineParserSpec achieve an effect similar to embedding by using anonymous structs
add MultilineParser resource role in helm chart

Additional documentation, usage docs, etc.:

Thanks @onecer , you may need to run:
make manifests generate docs-update

Thanks @onecer , you may need to run: make manifests generate docs-update

done


Typo in StabilizerInterface

Link
looks should be stabilize()

Yes, I think you're right about that. For some reason I even wrote the example concrete class in util/SimplePingStabilizer.java and didn't notice the awkwardness of the name!


Revert "Revert "feat: add rediscloud""

Reverts pulumi/registry#2488
@rawkode this failed our build in docs

i think ur gonna have to put the URLs in quotes

ill try and update for ya

@susanev Can you change version to 1.2.5, please?
I think the build metadata is causing problems

That seems more promising :)

@susanev let me know if there's anything else you need me to do.
Thanks for your help

@rawkode i need to move this over to the community packages, but i can handle it. will let ya know if i need anything else from ya.


Add March 2024 Patch Releases, Update April Dates, Propose June Dates

Add March 2024 patch releases to the calendar
Modify April Dates so we can send an announcement to k-dev
Modify May Release Date to align with Tuesday Releases
Propose dates for June patch releases

/assign @puerco @xmudrii
cc @kubernetes/release-engineering

/lgtm


Review my last project from the last week

I am grateful for every comment.

Please put the javascript files in the bottom section of the HTML file. That helps your page to load faster.

Neat code outline in your HTML file, I think it will be more clear if you move the stylesheet reference from line 24 to between lines 20 and 21. This will put all CSS-related links in one place.

CSS responsive design is crucial in today's digital landscape because it allows websites and applications to adapt and provide optimal user experiences across various devices and screen sizes. Here are some important reasons why CSS responsive design is significant:

Multi-device compatibility: With the proliferation of smartphones, tablets, laptops, and desktops, users access websites and applications from different devices. CSS responsive design ensures that your content is accessible and displays correctly regardless of the device, providing a consistent user experience.

Improved user experience: Responsive design enhances user experience by automatically adjusting the layout, font sizes, and images to fit the screen size. It eliminates the need for users to zoom in or scroll horizontally, making it easier for them to navigate and consume content. A positive user experience leads to increased engagement and reduces bounce rates.

Mobile-friendliness: Mobile devices account for a significant portion of internet traffic. Responsive design makes your website mobile-friendly, allowing it to adapt seamlessly to smaller screens. It ensures that buttons, menus, and other interactive elements are easily tappable, improving usability and reducing frustration for mobile users.

Search engine optimization (SEO): Responsive design is favored by search engines like Google. Having a single, responsive website instead of separate desktop and mobile versions helps with SEO efforts. It eliminates the need for duplicate content and ensures that all traffic is directed to a single URL, improving your website's search engine rankings.

Future-proofing: As new devices with different screen sizes and resolutions emerge, responsive design provides a flexible framework that can adapt to these changes. It saves time and effort compared to building separate versions for each new device, ensuring your website remains accessible and functional in the future.

Cost-effectiveness: Implementing responsive design eliminates the need to create and maintain multiple versions of your website or application. It streamlines development and reduces ongoing maintenance costs, making it a cost-effective approach in the long run.

In summary, CSS responsive design is essential for creating user-friendly, accessible, and future-proof websites and applications. It ensures that your content looks great and functions well across various devices, leading to improved user experiences, increased engagement, and better search engine visibility.


chore(deps:)update dependency mocha and ts-mocha to v7

Which problem is this PR solving?
-upgrade "mocha" and "ts-mocha" to v7
Short description of the changes
-updated dependency "mocha" and "ts-mocha" to v7

Codecov Report

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

@@           Coverage Diff           @@
##           master      #32   +/-   ##
=======================================
  Coverage   94.24%   94.24%
=======================================
  Files          57       57
  Lines        3252     3252
  Branches      345      345
=======================================
  Hits         3065     3065
  Misses        187      187

@dyladan Please review and approve, easy to merge.


Use sudoers.d instead of sudoers

Adding a new file to /etc/sudoers.d is a preferred method of changing sudoers configuration in RedHat and CentOS.
Changing kickstart configuration to create /etc/sudoers.d/veewee | vagrant file instead of appending veewee user to /etc/sudoers.

Thanks for pointing that out, it make it much clearer to remove/add users

Sure thing.
Did you mean to merge the pull request?


Apparently there are targets sharing dependencies and I can't run my commands

The following targets share dependencies and must be run together

That's what sake says. I don't know how to run them together. I have already grouped my formulas, but still they won't run. How am I supposed to do it?

You don't have to do any extra work. It's just letting you know that it's running both of them together.
Is it exhibiting behavior you don't expect. Is it not building?

I have encountered this error again, but this time I could see that it was caused by a bad declaration of dependencies in the Sakefile.

Glad you were able to sort it out!

I'm having a similar issue. My use case is an experimental workflow that has a few root dependencies, and then a number of leaf targets that each take 10-30 minutes to run. I was hoping to be able to run these targets selectively, but it seems that sake insists on building them all at once.

@damiendr So this has to do with how sake updates files marked for rebuilding and avoiding unstable states.
When a dependency's sha hash doesn't match the one stores in .shastore, all targets with that dependency are marked as "need to rebuild". If you run one of those targets, the dependency's sha hash in the .shastore is updated (so that it's congruent with the one from the actual filesystem. Once this is completed, the targets that also have this dependency are no longer "need to rebuild" because everything checks out. So allowing the target in question to run can lead to errors/unstable states.
In an unstable state, the onus of remembering which targets need to be updated is now on the user, rather that sake which is antithetical to the goal of the project.
I do, however, see the value in allowing this sort of behavior... it's something that I'd like, too
So we have a couple of options....

if you force run a target with shared dependencies, all of the sha hashes of the shared dependencies can be marked as unstable for a particular set of targets and that they need to be rebuilt, even if the sha hash matches the one from the file on the filesystem
The .shastore file can switch from being "file" based, to being "target"-based. This has a number of advantages, but non-trivially changes the logic of a lot of the codebase. The advantages include: (a) if a new target is added, the target with always run next time sake is run, (b) when a specific target successfully terminates, the output and dependency shas of only that particular target can be updated_ meaning that target is up to date, but the shas of the dependencies of the targets that share those dependencies will still be incongruent with the shas from the filesystem and, hence, will be marked for rebuilding.

I'm leaning towards the later. Do you have an opinion on this? Sorry if my explanation is confusing (my fault). Let me know if there's something I can clear up

The latter sounds best, I agree — that's what I would expect without knowing about the internals.


[Feature] Multiple right icon elements in AppBar

This feature will make it possible to set iconElementRight
property to an array of supported elements.

@oliviertassinari New feature PR, anything of interest? I have seen that on Android devices you have the possibility to have multiple action icon/button/menus to the right in the AppBar. I thought that this would be nice to have that possibility in material-ui implementation as well.

Good idea, it is part of the spec as well.
https://www.google.com/design/spec/layout/structure.html#structure-app-bar

@fredriklindell Sorry we haven't gotten back to you. We've been super busy refactoring/cleaning up code and reviewing tons of PRs. This feature is a great idea and something we should support, but I think we're going to move away from adding additional logic / features to the AppBar and just try to make the existing <Toolbar /> component better.
The reason for this is because the plan is to make the <Toolbar /> component what developers use to make everything related to toolbars, and the <AppBar />  a component that can compose a <Toolbar /> (among other things likes tabs and flexible space). See this readme for an example of what the future <AppBar /> api make look like.
If you have time to explore improving the  api, I'd be more than happy to look at what you have in mind. Maybe could create an issue for a new API that we can review before implementing.

@fredriklindell If you're on gitter by any chance, feel free to shoot me a message if you have any questions. I really like that scrollable tabs feature that you started at #2861 and I want to see what we can do to get that merged as well. :+1:

+1

@fredriklindell I'm going to close this PR for now (mostly for the reasons pointed out in this comment). Supporting multiple icons is something we will support with new/modified components that are being written and should be available for our next release.
Thanks!


feat: Write up an article on Shorebird Security

e.g. what does someone need to create a patch to your app.
How are we protecting your app data, etc.

Another question from a customer:

Encryption related to the binaries stored if any !!```


Add Advanced Tutorial

Rounding out the trilogy, here's the WIP for the "Advanced Tutorial" page, which covers use with TS, thunks, and React-Redux hooks.

This tutorial is really helpful, thanks.


Asyncio Error when trying to Initialise a mock device

When trying to use --ssh option on the mock_device_cli I get a strange asyncio error. I've tried this on my local machine as well as the latest container based version of pyATS. It does seem to work fine on earlier versions of pyATS as a colleague has this working.
root@12231b0615b0:/pyats# mock_device_cli --os nxos --mock_data_dir /shared_volume/mock_test  --state connect --ssh
Traceback (most recent call last):
  File "/pyats/bin/mock_device_cli", line 8, in <module>
    sys.exit(main())
  File "src/unicon/mock/mock_device.py", line 1075, in unicon.mock.mock_device.main
  File "src/unicon/mock/mock_device.py", line 994, in unicon.mock.mock_device.MockDeviceSSHWrapper.run
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 595, in run_until_complete
    future = tasks.ensure_future(future, loop=self)
  File "/usr/local/lib/python3.8/asyncio/tasks.py", line 684, in ensure_future
    raise TypeError('An asyncio.Future, a coroutine or an awaitable is '
TypeError: An asyncio.Future, a coroutine or an awaitable is required
root@12231b0615b0:/pyats#

Hi Gary,
Could you please ensure that all packages are the latest version? We've released a few minor versions and I'd like to make sure that this hasn't been already fixed by one of them.
In addition would it be possible for you to try one of the examples from https://github.com/CiscoTestAutomation/examples ? If this issue can be replicated on a mock device that we have access to it will be easier to troubleshoot any issues.

Hi Liam, I used the latest containerized version of pyATS so that I could prove the issue was not a local install. The state connect works fine it's only when trying to use the --ssh option does the traceback occur. I will try it with other mock devices to see if I can replicate it against specific mock files.

Hi Gary,
Any update?

Hi Liam, I haven't finished doing some further testing yet. Will update you in a couple of days with my findings.

I've updated all my packages to the latest version on my local machine plus this is the same outcome when using the latest docker image of pyATS. I have created a new mock device on Junos plus I have also used the one located here:
https://github.com/CiscoTestAutomation/examples/tree/master/blitz/config_interface/mock_device
This is one of your own and which I converted from the pickle to yaml file output using the command line conversion but still get the same TypeError: An asyncio.Future error whenever I use the --ssh argument in the command line. The --connect arguement works fine. Could you try and replicate this with the docker version of pyATS and this specific mock device on the cisco test automation examples?

For your reference this is the output when using your mock device example (same error and issue).
(mock_demo) gary@gary-MS-7B17:~/mock_demo$ mock_device_cli --os iosxe --mock_data_dir mock/iosxe_demo --state connect --ssh
Traceback (most recent call last):
  File "/home/gary/mock_demo/bin/mock_device_cli", line 8, in <module>
    sys.exit(main())
  File "src/unicon/mock/mock_device.py", line 1075, in unicon.mock.mock_device.main
  File "src/unicon/mock/mock_device.py", line 994, in unicon.mock.mock_device.MockDeviceSSHWrapper.run
  File "/usr/lib/python3.9/asyncio/base_events.py", line 621, in run_until_complete
    future = tasks.ensure_future(future, loop=self)
  File "/usr/lib/python3.9/asyncio/tasks.py", line 680, in ensure_future
    raise TypeError('An asyncio.Future, a coroutine or an awaitable is '
TypeError: An asyncio.Future, a coroutine or an awaitable is required

TypeError: An asyncio.Future, a coroutine or an awaitable is required

error might not be friendly. but I'm guessing you might not have asyncssh package. please check pip list | grep asyncssh
if not there, please install by pip install asyncssh

Hi Taskahi, You nailed the problem it was asyncssh being missing. All working now.
(mock_demo) gary@gary-MS-7B17:~/mock_demo$ mock_device_cli --os junos --mock_data_dir mock/iosxe_demo --state connect --ssh
Traceback (most recent call last):
  File "/home/gary/mock_demo/bin/mock_device_cli", line 8, in <module>
    sys.exit(main())
  File "src/unicon/mock/mock_device.py", line 1075, in unicon.mock.mock_device.main
  File "src/unicon/mock/mock_device.py", line 994, in unicon.mock.mock_device.MockDeviceSSHWrapper.run
  File "/usr/lib/python3.9/asyncio/base_events.py", line 621, in run_until_complete
    future = tasks.ensure_future(future, loop=self)
  File "/usr/lib/python3.9/asyncio/tasks.py", line 680, in ensure_future
    raise TypeError('An asyncio.Future, a coroutine or an awaitable is '
TypeError: An asyncio.Future, a coroutine or an awaitable is required
(mock_demo) gary@gary-MS-7B17:~/mock_demo$ pip install asyncssh
Collecting asyncssh
  Downloading asyncssh-2.9.0-py3-none-any.whl (334 kB)
     |████████████████████████████████| 334 kB 9.7 MB/s
Collecting typing-extensions>=3.6
  Downloading typing_extensions-4.1.1-py3-none-any.whl (26 kB)
Requirement already satisfied: cryptography>=2.8 in ./lib/python3.9/site-packages (from asyncssh) (36.0.1)
Requirement already satisfied: cffi>=1.12 in ./lib/python3.9/site-packages (from cryptography>=2.8->asyncssh) (1.15.0)
Requirement already satisfied: pycparser in ./lib/python3.9/site-packages (from cffi>=1.12->cryptography>=2.8->asyncssh) (2.21)
Installing collected packages: typing-extensions, asyncssh
Successfully installed asyncssh-2.9.0 typing-extensions-4.1.1
(mock_demo) gary@gary-MS-7B17:~/mock_demo$ mock_device_cli --os junos --mock_data_dir mock/iosxe_demo --state connect --ssh
2022-03-05 13:05:07,004 [    INFO]:  Creating SSH listener on <IP_ADDRESS>, port 8266
2022-03-05 13:05:07,004 [    INFO]:  Server 0 listening on port 8266
^C2022-03-05 13:05:21,951 [    INFO]:  Shutting down.
2022-03-05 13:05:21,952 [    INFO]:  Closing server 1
(mock_demo) gary@gary-MS-7B17:~/mock_demo$

thanks @gwoodwa1 ! closing the issue. (we will see if we can improve the error to tell the issue exactly).


Use pocketbase for compatibility with website

Works! https://github.com/hirusha-adi/Near/commit/a57ef526bd1f4fa39357406e51aa63fb787565a2

Completed in https://github.com/hirusha-adi/Near/pull/33


fix value of pricePerDealUnit

Coverage increased (+0.08%) to 39.704% when pulling 8d5a411fa4fe09ed13602071bc1c4a4b2da241c9 on indriHutabalian:dev into 2d37f56d89daf518687d803dd1965044768ef7db on danliris:dev.


crypto/x509: any plans to implement RID and dirName SANs?

Hi
Is there any plans to implement RID (a registered ID: OBJECT IDENTIFIER) and dirName (a distinguished name) alongside to DNS, IP, etc,  on crypto/x509?
Thanks

Hi there,
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.
For asking questions, see:

Stack Overflow with questions tagged "go"

The Go Forum, a web-based forum

Gophers Slack, use the invite app for access. The #general channel is a good starting point.

Go Community on Hashnode with questions and posts tagged with "go"

The golang-nuts mailing list

IRC channel #go-nuts on Freenode

Please ask the question on one of the above forums.
(Quoted from https://golang.org/wiki/Questions)


[Question] After installation get stuck with "Setting up harvester"

Hello,
I'm in process of evaluating Harvester. I've install harvester v0.3.0 in a Proxmox VM with Nested virtualisation enabled.
On console, I get stuck with "Setting up harvester". I'm not sure if that normal and how to go further with the installation.

Then latter on ...

Hi, could you log in to the node as root and capture these command outputs?
sudo -i
kubectl logs -n kube-system jobs/helm-install-harvester
kubectl get no
kubectl get all -A

It might help.

I'm running into this issue too, but under management url I am presented with https://<IP_ADDRESS>:30443 - However nothing is being served here, the port is closed.
kubectl logs -n kube-system jobs/helm-install-harvester
Error from server (NotFound): jobs.batch "helm-install-harvester" not found

kubectl get no
NAME           STATUS   ROLES                       AGE   VERSION
harvester-01   Ready    control-plane,etcd,master   36m   v1.21.7+rke2r1

kubectl get all -A
NAMESPACE       NAME                                                        READY   STATUS              RESTARTS   AGE
cattle-system   pod/rancher-687c67f9c7-vhg5v                                0/1     ContainerCreating   0          35m
kube-system     pod/cloud-controller-manager-harvester-01                   1/1     Running             1          35m
kube-system     pod/etcd-harvester-01                                       1/1     Running             1          35m
kube-system     pod/helm-install-rke2-canal-g8542                           0/1     Completed           0          35m
kube-system     pod/helm-install-rke2-coredns-wxq67                         0/1     Completed           0          35m
kube-system     pod/helm-install-rke2-ingress-nginx-lcqch                   0/1     ContainerCreating   0          35m
kube-system     pod/helm-install-rke2-metrics-server-ss8c7                  0/1     ContainerCreating   0          35m
kube-system     pod/helm-install-rke2-multus-v27qh                          0/1     Completed           0          35m
kube-system     pod/kube-apiserver-harvester-01                             1/1     Running             1          35m
kube-system     pod/kube-controller-manager-harvester-01                    1/1     Running             1          35m
kube-system     pod/kube-multus-ds-6xnm6                                    1/1     Running             0          35m
kube-system     pod/kube-proxy-harvester-01                                 1/1     Running             1          28m
kube-system     pod/kube-scheduler-harvester-01                             1/1     Running             1          35m
kube-system     pod/rke2-canal-4955f                                        0/2     CrashLoopBackOff    21         35m
kube-system     pod/rke2-coredns-rke2-coredns-5679c85bbb-rdgkh              0/1     ContainerCreating   0          35m
kube-system     pod/rke2-coredns-rke2-coredns-autoscaler-6889866896-ns9vd   0/1     ContainerCreating   0          35m

NAMESPACE       NAME                                TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
cattle-system   service/rancher                     ClusterIP   <IP_ADDRESS>   <none>        80/TCP,443/TCP   35m
default         service/kubernetes                  ClusterIP   <IP_ADDRESS>       <none>        443/TCP          36m
kube-system     service/rke2-coredns-rke2-coredns   ClusterIP   <IP_ADDRESS>      <none>        53/UDP,53/TCP    35m

NAMESPACE     NAME                            DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
kube-system   daemonset.apps/kube-multus-ds   1         1         1       1            1           kubernetes.io/os=linux   35m
kube-system   daemonset.apps/rke2-canal       1         1         0       1            0           kubernetes.io/os=linux   35m

NAMESPACE       NAME                                                   READY   UP-TO-DATE   AVAILABLE   AGE
cattle-system   deployment.apps/rancher                                0/1     1            0           35m
kube-system     deployment.apps/rke2-coredns-rke2-coredns              0/1     1            0           35m
kube-system     deployment.apps/rke2-coredns-rke2-coredns-autoscaler   0/1     1            0           35m

NAMESPACE       NAME                                                              DESIRED   CURRENT   READY   AGE
cattle-system   replicaset.apps/rancher-687c67f9c7                                1         1         0       35m
kube-system     replicaset.apps/rke2-coredns-rke2-coredns-5679c85bbb              1         1         0       35m
kube-system     replicaset.apps/rke2-coredns-rke2-coredns-autoscaler-6889866896   1         1         0       35m

NAMESPACE     NAME                                         COMPLETIONS   DURATION   AGE
kube-system   job.batch/helm-install-rke2-canal            1/1           11s        35m
kube-system   job.batch/helm-install-rke2-coredns          1/1           10s        35m
kube-system   job.batch/helm-install-rke2-ingress-nginx    0/1           35m        35m
kube-system   job.batch/helm-install-rke2-metrics-server   0/1           35m        35m
kube-system   job.batch/helm-install-rke2-multus           1/1           10s        35m

Seems ur server doesn't have enough resources to run all the services properly, can u please help to check and share the event of the following services:
$ kubectl describe pod -n kube-system rke2-canal-4955f
$ kubectl describe pod -n kube-system rancher-687c67f9c7-vhg5v

@ikus060 Do you have any new updates?
As @guangbochen  said, it's quite possible that the NODE does not have enough resources (CPU core, memory, storage). Please refer https://docs.harvesterhci.io/v1.0/#hardware-requirements to check.
BTW, the latest Harvester release also brings more improvments and features.
https://github.com/harvester/harvester/releases/tag/v1.0.2


Adding meteor methods to Class

What about allowing to add methods to a Class that are automatically wrapped as a Meteor Method:
const Post = Class.create({
  name: 'Post',
  /* ... */
  methods: {
    rename(title) {
      // Check if a given user can rename this post.
      if (this.ownerId !== Meteor.userId()) {
        throw new Meteor.Error(403, 'You are not an owner');
      }
      this.title = this;
      this.save();
     }
  }
});

Meteor.methods({
  renamePost(postId, title) {
    const post = Post.findOne(postId);
    post.rename(title);
  }});

becomes:
Post.extend({
meteorMethods: {
  renamePost(title) {
    // Check if a given user can rename this post.
      if (this.ownerId !== Meteor.userId()) {
        throw new Meteor.Error(403, 'You are not an owner');
      }
      this.title = this;
      this.save()
  }});

Where this code is automatically wrapped in a Meteor method that fetches the relevant document using the _id and sets the function context accordingly.

I was thinking about this feature as it's very common to just execute single function in a meteor method. So I will probably add this soon.

But what would be the benefit? Does it matter if you do ``Meteor.call({...})ordoc.()`?

@jhuenges less code to write. When you define Astronomy method, appropriate Meteor wrapper method gets created so you don't have to define it by yourself. It's not about calling method, it's about defining it.

What do you think about creating a naming convention for Meteor methods on Class objects, so you now if that call triggers a meteor method or not?

@Faberle You can use @server Serrurier decorator meanwhile

I think this is the missing piece of Astronomy.
I feel hesitant to allow updates from the client (maybe for no reason?), but find it annoying having to define these meteor methods all over the place, like loop I have to jump through.

This feature will appear in the next Astronomy version

@jagi Any idea when that would be? I just poured myself a large cup of coffee and was about to start refactoring my code base from Astronomy V1 => V2 :)

I can't tell right now because I have some extra work to do. I hope it won't take to much time.

@Faberle lets just move discussion from PR to this thread.
Feature is almost ready. Big thanks for @Faberle for great help with implementation of this module. I want to discuss how it works right now and what can still be improved/changed.

Ok, so at first, we can define meteor methods in the following way:

const User = Class.create({
  name: 'User',
  collection: Users,
  fields: {
    firstName: String,
    lastName: String
  },
  meteorMethods: {
    changeName(firstName, lastName, invocation) {
      check(firstName, String);
      check(lastName, String);
      this.firstName = firstName;
      this.lastName = lastName;
      return this.save();
    }
  }
});

// Invocation
const user = User.findOne();
user.changeName('John', 'Smith', function(err, result) {
});

As you can see there is a new section in class definition called meteorMethods. We define this methods in the same way as regular methods. The only difference is that the last argument of method is meteor method invocation object which is just the this context of regular Meteor method. So we can access such properties like this.isSimulation, this.unblock()orthis.userId`. We still have to directly save document if it's needed.
On method execution, we can pass callback function as the last argument.

Server only method. There may be situations when we want to hide some logic and put in server only method. Because of that it's not possible to invoke method from the client without messy workarounds like this:

// both.js
const User = Class.create({
  name: 'User',
  collection: Users,
  fields: {
    firstName: String,
    lastName: String
  }
});
// client.js
User.extend({
  meteorMethods: {
    changeName() {}
  }
})
// server.js
User.extend({
  meteorMethods: {
    changeName(firstName, lastName, invocation) {
      check(firstName, String);
      check(lastName, String);
      this.firstName = firstName;
      this.lastName = lastName;
      return this.save();
    }
  }
});

As you can see, we had to create dummy function on the client to have "access point" for calling method. If someone wants to use this approach, he/she is free to go. However I've also introduces two helper methods callMethod and applyMethod. Using them, we don't have to create dummy client side method. Let's take a look at the example:
// Invocation
const user = User.findOne();
user.callMethod('changeName', 'John', 'Smith', function(err, result) {
});
// or
user.applyMethod('changeName', ['John', 'Smith'], function(err, result) {
});

3. What do you think?
I'm a little bit worried about naming. Meteor methods and regular methods, it might be confusing. I was thinking that maybe regular methods should be actually Meteor methods from the beginning of Astronomy. And regular methods in the current form should be renamed to helpers or something similar. I'm considering introducing some option in Astronomy that would allow this naming change without breaking backward compatibility. This option would be per class, to make switching to new convention easier (class by class migration).
const User = Class.create({
  name: 'User',
  collection: Users,
  fields: {
    firstName: String,
    lastName: String
  },
  options: {
    newMethods: true
  },
  helpers: {
    fullName() {
      return `${this.firstName} ${this.lastName}`;
    }
  },
  methods: {
    changeName(firstName, lastName, invocation) {
      check(firstName, String);
      check(lastName, String);
      this.firstName = firstName;
      this.lastName = lastName;
      return this.save();
    }
  }
});

I like the renaming suggestion. In my current project I use methods more like helpers (getFullname() etc.). They feel more like helpers than actual methods.

I also like the renaming suggestion! And good point with the sever only methods.

Ok, glad that you like this change. I've already prepared a fix that will suggest using helpers instead methods. However, for backward compatibility methods will become helpers and Meteor methods will be defined under meteorMethods and NOT methods. It can be changed in Astronomy 3.0.

Thank you for this great evolution! :)

Feature implemented in 2.2.0. Closing this issue.


infer R extends in template literal does not narrow correctly when extending union of literals

Bug Report

🔎 Search Terms
template literal infer extends union narrowing
🕗 Version & Regression Information

This is the behavior in every version I tried, and I reviewed the FAQ for entries about infer extends in template literals.

⏯ Playground Link
Playground link with relevant code
💻 Code
// Works as expected.
type GetGenericPrefix<Str extends string> = Str extends `${infer pre extends string}${'!' | '?'}` ? pre : '';
type someString = GetGenericPrefix<'foo?'>; // The expected literal type 'foo'.

// Compact, but doesn't work.
type GetKnownSuffix1<Str extends string> = Str extends `${string}${infer suf extends '!' | '?'}` ? suf : '';
type knownSuffix1 = GetKnownSuffix1<'foo?'>; // The union '!' | '?' instead of the expected literal type '?'.

// Works, but not scalable.
type GetKnownSuffix2<Str extends string> =
  Str extends `${string}${infer suf extends '!'}`
  ? suf
  : Str extends `${string}${infer suf extends '?'}`
  ? suf
  : '';
type knownSuffix2 = GetKnownSuffix2<'foo?'>; // The expected literal type '?'.

🙁 Actual behavior
Type GetKnownSuffix1 returns the entire extended union ('!' | '?') instead of the matching literal ('?').
🙂 Expected behavior
Type GetKnownSuffix1 should return just the matching literal ('?'), the same way infer pre extends string in GetGenericPrefix returns the literal type 'foo' and not the extended type string.

Related: https://github.com/microsoft/TypeScript/issues/49839#issuecomment-1411863333

Workaround: use distribution behavior to simplify the "not scalable" code
type GetKnownSuffix<Str extends string, Suffix extends string> =
  (Suffix extends infer S extends string
    ? Str extends `${string}${infer R extends S}`
      ? R
      : never
    : never
  ) extends infer T ? [T] extends [never] ? '' : T : never;

type knownSuffix = GetKnownSuffix<'foo?', '!' | '?'>
//   ^?  "?"
type knownSuffix2 = GetKnownSuffix<'foo', '!' | '?'>
//   ^?  ""

This seems to be a manifestation of the same problem described at https://github.com/microsoft/TypeScript/issues/49839#issuecomment-1416418581


Add useRouter Hook

Hi guys,
at current React Conf Hooks have been announced for React v16.7. What's the plan for supporting them? Will there be a useRouter() any time soon?
https://reactjs.org/docs/hooks-faq.html#what-do-hooks-mean-for-popular-apis-like-redux-connect-and-react-router

While I don't know any details about what Michael is planning, when React Router supports them largely depends on the timeline of how fast React 16.7 is released.
React Router currently has its 4.4 beta out, which will probably become final sooner than 16.7 becomes final. In that case, hooks would be a 4.5 feature. RR can put out an alpha/beta build of 4.5, but it shouldn't become "official" until hooks get a final release.

It looks like __RouterContext is exposed in v4.4.0-beta.5 - so you could probably just do something like:
import {useContext} from "react"
export default function useRouter() {
  return useContext(__RouterContext)
}

Might be a horrible idea though. 🤷♂

Yes, we don't intend to make our context instance public. You should use our public APIs to access it, which allows us to warn you when it's used incorrectly and things like that.

You could also create your own wrapper to get access:
import React from "react";
import { BrowserRouter, Route } from "react-router-dom";

export const RouterContext = React.createContext({});

const CustomBrowserRouter = ({ children }) => (
  <BrowserRouter>
    <Route>
      {(routeProps) => (
        <RouterContext.Provider value={routeProps}>
          {children}
        </RouterContext.Provider>
      )}
    </Route>
  </BrowserRouter>
);

export default CustomBrowserRouter;

Then wrap this around your App instead of the normal <BrowserRouter />
import React from "react";
import CustomBrowserRouter from "./CustomBrowserRouter";

function App() {
  return (
    <CustomBrowserRouter>

        {/* The rest of your app  */}

    </CustomBrowserRouter>
  );
}

export default App;

Then you can make a useRouter hook:
import {useContext} from "react"
import {RouterContext} from "./CustomBrowserRouter"

export default function useRouter() {
  return useContext(RouterContext)
}

@timdorr But in that case, you need to export custom hook that would wrap around the context because useContext(Consumer) is not supported way.

@FredyC RR can export a hook (useRouter) to provide its context data without the context being public. I only mentioned the consumer to note that the currently exported context can theoretically be removed, which would break the code of anyone relying on it.

Ya, I think a useRouter hook makes a lot of sense. It'll probably work just like a path-less <Route> currently does, and just pass along the current match object at that point in the tree.
We won't be able to include this feature in the 4.x branch though without shipping some kind of hooks polyfill, which I'd rather not do. We should be able to safely assume that anybody using hooks is also using React 16.7+ which will be our dependency in version 5.

@mjackson can't you do something like
import React, { useContext } from 'react';

export function useRouter () {
  if (!useContext) {
    throw new Error('React >= 16.7 required');
  }
  return useContext(...);
}

No polyfill required, you just can't use useRouter unless you're on 16.7 or higher. This means it can go on a react-router minor version.

import { useContext }from 'react'
import { RouteComponentProps, StaticContext } from 'react-router';
import * as H from 'history';

const RouterContext =  require('react-router').__RouterContext;

// FIXME:  use official API when https://github.com/ReactTraining/react-router/pull/6453 merged

export function useRouter<Params extends { [K in keyof Params]?: string } = {}, C extends StaticContext = StaticContext, S = H.LocationState>() {
  return useContext(RouterContext) as RouteComponentProps<Params,C,S>
}

@mjackson I am doing the same since you don't want to release version with unstable_useRouter for whatever reasons :) It's too good to live without that anymore :)

I also use the same workaround with @xiaoxiangmoe. Of course it's only temporary, as noted in the snippet, will replace it with unstable_useRouter, and eventually, hopefully useRouter as the official way.

Used the same workaround initially since unstable_useRouter still has yet to be released, but then I found https://github.com/CharlesStover/use-react-router which does the workaround for you, allowing const {history, match, location} = useReactRouter(). Figured I should post it here in case it might help anyone because I only found it a few days after implementing the workaround manually (surprised no one else has linked it!)
It does implement pub-sub, which may be different from expected behavior; the implementation details are described in https://medium.com/@Charles_Stover/how-to-convert-withrouter-to-a-react-hook-19bb02a29ed6

Not sure if anyone run into the same issue but when I run it in a browser, useContext(__RouterContext) returns { match, location, history } objects correctly, but when I'm running my tests and mocking my router, let's say <MemoryRouter initialEntries={['/something/here']}> then location and history object are correct but match is always { path: '/', url: '/', params: {}, isExact: false }. It doesn't represent what it should be.

@mateusznowosielski Shouldn't you also specify initialIndex? Either way, you can try <Route>{({ match }) => ...</Route> just to see if it's working. I don't think it's a hook related.

@FredyC initialIndex wasn't necessary when I had only 1 initialEntry, but I had to wrap my component within <Route component={ui} path={path} />. Thanks for the suggestion.

Instead of a useRouter hook, could we consider a useRoute instead? I've always been bothered that withRouter doesn't allow passing in a path.
Would anyone be opposed to useRoute like so:
import { useRoute } from 'react-router';

export default function SomeComponent() {
  const { match } = useRoute({ path: '/:something/:to/:match' });
}

The idea is that the useRoute would take in all the props a <Route /> would take in and pass them to the second argument of matchPath.
@mjackson, what do you think?

@ricokahler There is already a PR that does that.  It just needs a little update as @mjackson managed to stall it until hooks became an official :D

@FredyC I did not realize the PR already did this! I think I just assumed since withRouter didn't take any props that useRouter wouldn't either.
@mjackson  Forget I said anything and release this ha! 🎉

Hello dear people - how is the "useRouter" situation?

exporting react-router context api would make it easy to user build their own hooks on top of it
so, we don't need to wait until the final hook solution lands

@sibelius There is a context exported in 4.4 beta ... https://github.com/ReactTraining/react-router/issues/6430#issuecomment-439056692

Here's what I had with typescript if it helps anyone viewing this thread:
First added some module augmentation to expose the __RouterContext as a type.
// types/react-router-dom.d.ts
import { RouteComponentProps } from 'react-router-dom';
import { Context } from 'react';

declare module 'react-router-dom' {
  export const __RouterContext: Context<RouteComponentProps<{}>>;
}

Then I made a custom hook around that.
import { useContext } from 'react';
import { __RouterContext, RouteComponentProps } from 'react-router-dom';

export default function useRouter<TParams = {}>() {
  return useContext(__RouterContext) as RouteComponentProps<TParams>;
}

And in use it would be like:
const { match: { params: { id } } } = useRouter<{ id: string }>();

Hi, do we still not have any implementation of hooks merged yet as of 5.0.0?

@ms-ww 5.0 wasn't actually a feature release, just a synchronization of versions.

Looking at withRouter and stripping out the HOC stuff, it seems like a useRouter implementation would just be:
import { useContext } from 'react';
import RouterContext from './RouterContext';
import invariant from 'tiny-invariant';

/**
 * A public hook to access the imperative API
 */
export default function useRouter() {
  invariant(useContext, 'React >= 16.8 required');

  const context = useContext(RouterContext);
  invariant(context, `You should not use useRouter outside a <Router>`);

  return context;
}

@dantman That's basically what this library is doing, but it has an added forceUpdate effect in it to make sure your buried component re-renders.

You could also create your own wrapper to get access:
import React from "react";
import { BrowserRouter, Route } from "react-router-dom";

export const RouterContext = React.createContext({});

const CustomBrowserRouter = ({ children }) => (
  <BrowserRouter>
    <Route>
      {(routeProps) => (
        <RouterContext.Provider value={routeProps}>
          {children}
        </RouterContext.Provider>
      )}
    </Route>
  </BrowserRouter>
);

export default CustomBrowserRouter;

Then wrap this around your App instead of the normal <BrowserRouter />
import React from "react";
import CustomBrowserRouter from "./CustomBrowserRouter";

function App() {
  return (
    <CustomBrowserRouter>

        {/* The rest of your app  */}

    </CustomBrowserRouter>
  );
}

export default App;

Then you can make a useRouter hook:
import {useContext} from "react"
import {RouterContext} from "./CustomBrowserRouter"

export default function useRouter() {
  return useContext(RouterContext)
}

This is a poor conclusion, it doesn't help anyone willing to learn from your explanation. "Then you can make a useRouter hook:" what is the purpose? Where is it used? What does it do?

I implemented a file called routerHooks.ts that looks like:
import { __RouterContext, RouteComponentProps } from 'react-router';
import { useContext } from 'react';

export const useLocation = () => {
  const context = useContext(__RouterContext);
  return context.location;
};

export function useMatch
() {
  const context = useContext(__RouterContext) as RouteComponentProps
;
  return context.match;
}

Our team has a set of more powerful router related hooks works fine in tens of projects:
import {useContext, useMemo, useCallback} from 'react';
import {__RouterContext as RouterContext, RouteComponentProps} from 'react-router';
import {Location} from 'history';
import * as queryString from 'query-string';
import uriTemplate, {URITemplate} from 'uri-templates';

type ParsedQuery = queryString.ParsedQuery;

export const useRouter = <T>(): RouteComponentProps<T> => useContext(RouterContext) as RouteComponentProps<T>;

export const useLocation = (): Location => {
    const {location} = useRouter();
    return location;
};

export const useParams = <T>(): T => {
    const {match} = useRouter<T>();
    return match.params;
};

export const useQuery = <T extends ParsedQuery>(): T => {
    const {search} = useLocation();
    const query = useMemo(
        () => queryString.parse(search),
        [search]
    );
    return query as T;
};

interface UpdateQueryOptions {
    replace: boolean;
}

type UpdateQuery<T> = (patch: Partial<T>) => void;

type Visit<T> = (params: T) => void;

const USE_PUSH = {replace: false};

export const useUpdateQuery = <T extends ParsedQuery>(options: UpdateQueryOptions = USE_PUSH): UpdateQuery<T> => {
    const {history} = useRouter();
    const query = useQuery<T>();
    const {replace} = options;
    const updateQuery = useCallback(
        (patch: Partial<T>): void => {
            const newQuery = {...query, ...patch};
            const newSearch = queryString.stringify(newQuery);
            if (replace) {
                history.replace({search: newSearch});
            }
            else {
                history.push({search: newSearch});
            }
        },
        [history, query, replace]
    );
    return updateQuery;
};

export const useNavigate = <T>(to: string | URITemplate, options: UpdateQueryOptions = USE_PUSH): Visit<T> => {
    const {history} = useRouter();
    const {replace} = options;
    const template = useMemo(
        () => {
            if (typeof to === 'string') {
                return uriTemplate(to);
            }
            return to;
        },
        [to]
    );
    const visit = useCallback(
        (params: T): void => {
            const newLocation = template.fill(params as any);
            if (replace) {
                history.replace(newLocation);
            }
            else {
                history.push(newLocation);
            }
        },
        [template, history, replace]
    );
    return visit;
};

@otakustay what version of react-router are u using? I just installed 5.0 and I can't find __RouterContext

I guess this idea works if you are using <= 4.3.1,  but, it would be better to wait for this https://github.com/ReactTraining/react-router/pull/6453#issuecomment-474600561 because if something changes (https://github.com/ReactTraining/react-router/pull/6753)  then your code might breaks

Our team has a set of more powerful router related hooks works fine in tens of projects:
import {useContext, useMemo, useCallback} from 'react';
import {__RouterContext as RouterContext, RouteComponentProps} from 'react-router';
import {Location} from 'history';
import * as queryString from 'query-string';
import uriTemplate, {URITemplate} from 'uri-templates';

type ParsedQuery = queryString.ParsedQuery;

export const useRouter = <T>(): RouteComponentProps<T> => useContext(RouterContext) as RouteComponentProps<T>;

export const useLocation = (): Location => {
    const {location} = useRouter();
    return location;
};

export const useParams = <T>(): T => {
    const {match} = useRouter<T>();
    return match.params;
};

export const useQuery = <T extends ParsedQuery>(): T => {
    const {search} = useLocation();
    const query = useMemo(
        () => queryString.parse(search),
        [search]
    );
    return query as T;
};

interface UpdateQueryOptions {
    replace: boolean;
}

type UpdateQuery<T> = (patch: Partial<T>) => void;

type Visit<T> = (params: T) => void;

const USE_PUSH = {replace: false};

export const useUpdateQuery = <T extends ParsedQuery>(options: UpdateQueryOptions = USE_PUSH): UpdateQuery<T> => {
    const {history} = useRouter();
    const query = useQuery<T>();
    const {replace} = options;
    const updateQuery = useCallback(
        (patch: Partial<T>): void => {
            const newQuery = {...query, ...patch};
            const newSearch = queryString.stringify(newQuery);
            if (replace) {
                history.replace({search: newSearch});
            }
            else {
                history.push({search: newSearch});
            }
        },
        [history, query, replace]
    );
    return updateQuery;
};

export const useNavigate = <T>(to: string | URITemplate, options: UpdateQueryOptions = USE_PUSH): Visit<T> => {
    const {history} = useRouter();
    const {replace} = options;
    const template = useMemo(
        () => {
            if (typeof to === 'string') {
                return uriTemplate(to);
            }
            return to;
        },
        [to]
    );
    const visit = useCallback(
        (params: T): void => {
            const newLocation = template.fill(params as any);
            if (replace) {
                history.replace(newLocation);
            }
            else {
                history.push(newLocation);
            }
        },
        [template, history, replace]
    );
    return visit;
};

I've been using this code successfully for a few months now:
import * as React from "react";
import { BrowserRouter, Route } from "react-router-dom";

const RouterContext = React.createContext(null);

export const HookedBrowserRouter = ({ children }) => (
  <BrowserRouter>
    <Route>
      {(routeProps) => (
        <RouterContext.Provider value={routeProps}>
          {children}
        </RouterContext.Provider>
      )}
    </Route>
  </BrowserRouter>
);

export function useRouter() {
  return React.useContext(RouterContext);
}

But either way, I don't understand why this issue is still open? Is there a complication to adding any of these variations of useRouter code?

I also don't understand why there is still no useRouter hook that comes with react-router OOTB

I moved from react-router to https://www.npmjs.com/package/hookrouter and very happy with it. Code becomes a lot simpler, easier to understand, shorter, size bundle is also smaller.

@avkonst how does that handle nested routes?

Seems all right. There are docs with examples on nested routes. The only
component I added on top of hookrouter is Redirect (3 lines of code). This
allowed to replace react router completely.
On Thu, 27 Jun 2019, 12:46 japrogramer<EMAIL_ADDRESS>wrote:

@avkonst https://github.com/avkonst how does that handle nested routes?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ReactTraining/react-router/issues/6430?email_source=notifications&email_token=AA6JSVMJLVELCDJ44WOTL63P4QEW5A5CNFSM4F7XI2V2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYVGMUA#issuecomment-506095184,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA6JSVM6JHM37IT6ALVJ6U3P4QEW5ANCNFSM4F7XI2VQ
.

@maxparelius : Shipping hooks would have meant dropping support for older react versions. That's quite a big breaking change. We'll probably get there in 6.0, but that's apparently quite the big release with more than just hooks.
(And remember that 5.0 wasn't intended as a major release, so no intentional breaking changes like this made it in)

@StringEpsilon Definitely, but we could introduce a Router hook with a version switch. What I mean, is, that for React versions lower than the needed version there will be an error, that this React version is not supported. For other React versions it should just work. This would be a compromise.

That seems reasonable.  Why aren't we doing that?

Good question. I will push a proposal later that day.

@StringEpsilon Here we go!

I'm using react-router 5.0.1 here, does it mean I have the useRouter hook? Why this issue is even open if it's true?

@jayarjo Because there is no useRouter() hook right now. My draft was rejected, because currently there seems to be no clear direction about how this hook should work and what it should return. There is also no clear opinion if there will be this hook at all or only hooks returning values from the context (e.g. params, location, history).

We're not making any progress here, so I'm going to close this. We will have a few hooks in the next major release, maybe even in a minor release. If you absolutely cannot wait, please be my guest and use some other router that ships with hooks.

@mjackson definitely understand that settling on hook API/behavior will take time and patience. However, can we keep this or a related issue open so folks can track when hooks have been added to the library? I often use Github's "closed" PR notifications to know when features are available, especially features that don't have a specific release designation.

@dpikt — perhaps instead you could watch the repo for releases?

While waiting what seems like an unusually long time for this Hooks-based API, it occurred to me that a few decisions React Router made have evolved in in a way that doesn't fully make sense for my use-cases. For example, you always get the full path when you create a route, instead of just the portion that the parent route didn't consume. And remembering that HTML5's History API isn't that hard, I figured I'd take a shot at a simplistic proof of concept at a simpler alternative. This is what I ended up with:
import * as React from "react";

// The context is just the current path and navigation functions.
const RouterContext = React.createContext({
  path: '',
  pushPath: (path: string) => { },
  replacePath: (path: string) => { },
});

// This has to go around everything like in React Router.
function Router({ children }: { children: React.ReactNode }) {
  const [path, setPath] = React.useState(window.location.pathname);

  // Navigation functions.
  const pushPath = (newPath: string) => {
    if (newPath === path) return;
    window.history.pushState(null, '', newPath);
    setPath(newPath);
  }
  const replacePath = (newPath: string) => {
    if (newPath === path) return;
    window.history.replaceState(null, '', newPath);
    setPath(newPath);
  }

  // Navigation event handler that just updates React's state.
  function eventHandler() {
    setTimeout(() => {
      setPath(window.location.pathname);
    }, 0); // (MDN says this is probably needed)
  }

  // Listen to events as long as <Router> is mounted.
  React.useEffect(() => {
    window.addEventListener('popstate', eventHandler);
    return () => {
      window.removeEventListener('popstate', eventHandler);
    };
  }, []);

  // Pass down the initial path and navigation functions to everyone.
  return (
    <RouterContext.Provider value={{ path, pushPath, replacePath }}>
      {children}
    </RouterContext.Provider>
  );
}

// A simplified version of the React Router's <Route> component.
function Route({ path, render }: { path: string, render: () => JSX.Element }) {
  const context = React.useContext(RouterContext);

  // Render IFF this path matches the current path.
  if (!context.path.startsWith(path)) return null;

  // NB:
  // Remove the matched part of the path!
  // Only pass down the unmatched part.
  // Also pass down the navigation functions as-is.
  const newPath = context.path.substr(path.length);
  return (
    <RouterContext.Provider value={{ ...context, path: newPath }}>
      {render()}
    </RouterContext.Provider>
  );
}

// Simplistic demo of using the context to access the navigation functions.
// All you need is the built-in useContext hook! Nothing else needed.
function ButtonArea() {
  const context = React.useContext(RouterContext);
  return (<>

      {/* This shows that you can access the unmatched portion fo the path. */}
      {/* If you want the full path, I suppose window.location.pathname works. */}
      {context.path}

      <button onClick={() => context.pushPath('/foo')}>/foo</button>
      <button onClick={() => context.pushPath('/foo/bar')}>/foo/bar</button>
      <button onClick={() => context.pushPath('/foo/qux')}>/foo/qux</button>
      <button onClick={() => context.pushPath('/foo/qux/bla')}>/foo/qux/bla</button>

  </>)
}

// Further demo of using useContext to get the unconsumed path.
function DeepInnerRoute() {
  const context = React.useContext(RouterContext);
  return bla ({context.path});
}

// The full demo.
// Notice the nested paths! This is *much* more intuitive to me.
export function NewRoutesTester() {
  return (
    <Router>

        <Route path="/foo" render={() => <>
          foo
          <Route path="/bar" render={() => <>
            bar
          </>} />
          <Route path="/qux" render={() => <>
            qux
            <Route path="/bla" render={() => <DeepInnerRoute />} />
          </>} />
        </>} />
        <ButtonArea />

    </Router>
  );
}

Obviously there's more features left to add, such as path-parameters, but these things are orthogonal to the basic architectural concepts laid out in this proof of concept.
That said, I'm not sure this architecture is compatible with React Router's current API or features, and it may not be something that can be integrated without a major version change, assuming it even matches the philosophy.

@MeiKatz submitted a PR for hooks that I found helpful, so I copied the gist below. It wasn't merged due to some uncertainty about the api, but these will work for me until react-router gets official hooks.
Caveat: it uses __RouterContext, which is a private api, so these hooks are unsupported.
// react-router-hooks.js

import { useContext } from 'react';
import { __RouterContext as RouterContext } from 'react-router';

export function useRouter() {
    return useContext(RouterContext);
};

export function useParams() {
    const { match } = useRouter();
    return match.params;
}

export function useLocation() {
    const { location, history } = useRouter();

    function navigate(to, { replace = false } = {}) {
        if (replace) {
            history.replace(to);
        } else {
            history.push(to);
        }
    }

    return {
        location,
        navigate
    };
}

@sdegutis do you have it as a repo somewhere?

@jayarjo I don't currently have the luxury of maintaining an open source project, but here's a quick copy of the code I ended up with so far: https://github.com/sdegutis/simple-react-router. I'd love to see an API somewhat more like this for future React Router versions if possible.

I solved it by creating a withUseRouteHandler HOC that passes useRouteHandler as a prop to the wrapped component. useRouteHandler returns a function that takes additional props.
export default function withUseRouteHandler(WrappedComponent) {
  return withRouter(({ history, location, match, ...props }) => (
    <WrappedComponent
      {...props}
      useRouteHandler={handler => {
        return handler({ match, location, history });
      }}
    />
  ));
};

Did someone try this one?
https://github.com/CharlesStover/use-react-router

Did someone try this one?
https://github.com/CharlesStover/use-react-router

I have.  It worked fine as long as you're not too fussy on unit testing - we struggled to get it to play ball with RTL / renderHooks

To be honest, the router context is exposed, but only in a way that tells the people, "watch out, maybe we will rename it in the future, so your own code might not work in the future". You can easily import it via
import { __RouterContext as RouterContext } from "react-router";

I've been using this code successfully for a few months now:
import * as React from "react";
import { BrowserRouter, Route } from "react-router-dom";

const RouterContext = React.createContext(null);

export const HookedBrowserRouter = ({ children }) => (
  <BrowserRouter>
    <Route>
      {(routeProps) => (
        <RouterContext.Provider value={routeProps}>
          {children}
        </RouterContext.Provider>
      )}
    </Route>
  </BrowserRouter>
);

export function useRouter() {
  return React.useContext(RouterContext);
}

But either way, I don't understand why this issue is still open? Is there a complication to adding any of these variations of useRouter code?

Thanks for the solution! Easy and simple. I hope we will soon have this Hook. It'll be incredibly handy.

podrias poner algo asi en tu

"react-router-dom": "latest",

package.json y luego yarn install o npm i

Is there a discussion somewhere about the decision to expose 3 separate hooks, rather than a single useRouter hook?
If I'm understanding this correctly, the current hooks api will require reading the router context twice, whereas a single useRouter hook would've afforded us the opportunity to just consume the context in one place.

Found this comment from @mjackson in a related PR:

Just for posterity, we released some hooks in React Router 5.1
https://github.com/ReactTraining/react-router/releases/tag/v5.1.0


xcode11 Archive and remind a error "IPA processing failed"

And I Found the log

it seems like Flutter.framework include x86_64
My project is swift mixed flutter

https://www.darrenblog.cn/#/detail/5dbf9a8a7bb725236692b6d4

https://www.darrenblog.cn/#/detail/5dbf9a8a7bb725236692b6d4

When you remove the x86 from Flutter.framework and rebuild the project, it will generate a new Flutter.framework contains x86.

Try to use the Xocde 10 to archive the project.
I'm trying this way too. If I have some good news, I will share for you.

I found the way to solve this problem

2.cd your architecture floder like this
/Users/luozugen/Library/Developer/Xcode/Archives/2019-10-17/Portal 2019-10-17, 11.06 AM.xcarchive/Products/Applications/Utrack.app/Frameworks/Flutter.framework
3.lipo -remove x86_64 Flutter -o Flutter
4.back to 'organizer window' to do next

Did you running flutter build ios on the command line before archiving?
https://flutter.dev/docs/deployment/ios#create-a-build-archive
Looks like some form of https://github.com/flutter/flutter/issues/37850.  Hopefully this was fixed by https://github.com/flutter/flutter/pull/42029.  If you're still seeing this, can we get the output of flutter doctor -v?

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.


Writing to CSV buffer with default float format causes numerical overflow in BigQuery

I'm using to_gbq() to load a local DataFrame into BigQuery. I'm running into an issue where floating point numbers are gaining significant figures and therefore causing numerical overflow errors when loaded to BigQuery.
The load.py module's encode_chunk() function writes to a local CSV buffer using Pandas' to_csv() function, which has a known issue regarding added significant figures on some operating systems (read more here).
In my case, 0.208 was transformed to 0.20800000000000002.
I've been able to solve the issue locally by changing the float_format parameter to '%g' in the encode_chunk() function's pd.to_csv() call:
dataframe.to_csv(
    csv_buffer, index=False, header=False, encoding='utf-8',
    float_format='%g', date_format='%Y-%m-%d %H:%M:%S.%f')

Can this be safely applied as a default?
Versions:
pandas==0.22.0
pandas-gbq==0.5.0

OS details:
MacOS 10.13.4

Thanks for the report @anthonydelage
Without being an expert in floats, that looks very reasonable. How would you feel about doing a pull-request?

@max-imlian yes, it's in #193.
In it, I made one change to the proposal above: increasing the number of significant figures to 15 (decimal), the max safely allowed under IEEE-754 double formatting.

Fixed in https://github.com/pydata/pandas-gbq/commit/993fe55f7e1f44a15b282b415284774310fc530c