[bug] HuggingFace Model Parser in Python is missing the dependency to resolve_prompt

resolved_prompt = resolve_prompt(prompt, params, aiconfig) - resolve_prompt is undefined. resolve_prompt was moved into python/src/aiconfig/util/params.py, but the import is still referencing aiconfig.util.config_utils.

Should be a quick 5 minute change -- @Ankush-lastmile?

Thanks @Ankush-lastmile. Did we blame the removed import?

@andrew-lastmile , how did you discover this?

@jonathanlastmileai, Andrew was making a cookbook.
This has been fixed now


Basic Pacemaker cluster without any SAP software or resources installed -- detection failed

We have a tiny cluster on AWS with stonith and VIP resource installed only.
# crm_mon -1
Stack: corosync
Current DC: node2 (version 2.0.1+20190417.13d370ca9-3.24.1-2.0.1+20190417.13d370ca9) - partition with quorum
Last updated: Wed Mar 30 12:49:22 2022
Last change: Thu Mar 24 15:27:49 2022 by root via crm_resource on node1

2 nodes configured
2 resources configured

Online: [ node1 node2 ]

Active resources:

 res_AWS_IP	(ocf::suse:aws-vpc-move-ip):	Started node1
 res_AWS_STONITH	(stonith:external/ec2):	Started node2

The agent journal look like this:
# journalctl -f -u trento-agent
-- Logs begin at Wed 2022-03-30 11:50:21 UTC. --
Mar 30 12:12:51 node2 trento[2340]: time="2022-03-30 12:12:51" level=info msg="Identifying if the VM is running in a cloud environment..."
Mar 30 12:12:51 node2 trento[2340]: time="2022-03-30 12:12:51" level=info msg="VM is running on aws"
Mar 30 12:12:51 node2 trento[2340]: time="2022-03-30 12:12:51" level=info msg="Identifying the SUSE subscription details..."
Mar 30 12:12:53 node2 trento[2340]: time="2022-03-30 12:12:53" level=info msg="Subscription (7 entries) discovered"
Mar 30 12:12:53 node2 trento[2340]: time="2022-03-30 12:12:53" level=info msg="Discovery tick output: No HA cluster discovered on this host\n\nNo SAP system discovered on this host\n\nCloud provider aws discovered\n\nSubscription (7 entries) discovered\n\nHost with name: node2 successfully discovered"
...

We found the reason why the cluster was not detected.
After adding:
cluster_name: testcluster
in the corosync.conf the cluster has been detected by trento.
However the "cluster_name" option is not mentioned in any Best Practice papers. This means if customer following our papers it could most likely happen that this option will never be set.


TFlite conversion of tf.keras model fails

System information

Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 18.04
Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: No
TensorFlow installed from (source or binary): pip install
TensorFlow version (use command below):v2.0.0-beta1-0-g8e423e3d56 2.0.0-beta1
Python version: 3.6.8
Bazel version (if compiling from source):
GCC/Compiler version (if compiling from source): 7.4.0
CUDA/cuDNN version: No
GPU model and memory: Nvidia titan-Xp

Describe the current behavior
import tensorflow as tf
model = tf.keras.models.load_model('keras_model.h5')
model.summary()
Model: "model"
__________________________________________________________________________________________________
Layer (type)                    Output Shape         Param #     Connected to
==================================================================================================
input_1 (InputLayer)            [(None, 1048576)]    0
__________________________________________________________________________________________________
embedding (Embedding)           (None, 1048576, 8)   2056        input_1[0][0]
__________________________________________________________________________________________________
conv1d (Conv1D)                 (None, 2097, 128)    512128      embedding[0][0]
__________________________________________________________________________________________________
conv1d_1 (Conv1D)               (None, 2097, 128)    512128      embedding[0][0]
__________________________________________________________________________________________________
multiply (Multiply)             (None, 2097, 128)    0           conv1d[0][0]
                                                                 conv1d_1[0][0]
__________________________________________________________________________________________________
global_max_pooling1d (GlobalMax (None, 128)          0           multiply[0][0]
__________________________________________________________________________________________________
dense (Dense)                   (None, 128)          16512       global_max_pooling1d[0][0]
__________________________________________________________________________________________________
dense_1 (Dense)                 (None, 1)            129         dense[0][0]
==================================================================================================
Total params: 1,042,953
Trainable params: 1,042,953
Non-trainable params: 0
__________________________________________________________________________________________________
converter = tf.lite.TFLiteConverter.from_keras_model(model)

The converter fails to convert the model
>>> converter.convert()
2019-09-26 14:39:27.048354: I tensorflow/core/grappler/devices.cc:60] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA support)
2019-09-26 14:39:27.048553: I tensorflow/core/grappler/clusters/single_machine.cc:359] Starting new session
2019-09-26 14:39:27.065544: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:716] Optimization results for grappler item: graph_to_optimize
2019-09-26 14:39:27.066324: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   function_optimizer: function_optimizer did nothing. time = 0.002ms.
2019-09-26 14:39:27.066655: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:718]   function_optimizer: function_optimizer did nothing. time = 0ms.
Traceback (most recent call last):
  File "/home/sridhar/PE_CSV/malenv3/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 427, in import_graph_def
    graph._c_graph, serialized, options)  # pylint: disable=protected-access
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input 0 of node model/embedding/embedding_lookup was passed float from model/embedding/embedding_lookup/Read/ReadVariableOp/resource:0 incompatible with expected resource.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sridhar/PE_CSV/malenv3/lib/python3.6/site-packages/tensorflow/lite/python/lite.py", line 348, in convert
    self._funcs[0])
  File "/home/sridhar/PE_CSV/malenv3/lib/python3.6/site-packages/tensorflow/python/framework/convert_to_constants.py", line 252, in convert_variables_to_constants_v2
    new_output_names)
  File "/home/sridhar/PE_CSV/malenv3/lib/python3.6/site-packages/tensorflow/python/eager/wrap_function.py", line 607, in function_from_graph_def
    wrapped_import = wrap_function(_imports_graph_def, [])
  File "/home/sridhar/PE_CSV/malenv3/lib/python3.6/site-packages/tensorflow/python/eager/wrap_function.py", line 585, in wrap_function
    collections={}),
  File "/home/sridhar/PE_CSV/malenv3/lib/python3.6/site-packages/tensorflow/python/framework/func_graph.py", line 716, in func_graph_from_py_func
    func_outputs = python_func(*func_args, **func_kwargs)
  File "/home/sridhar/PE_CSV/malenv3/lib/python3.6/site-packages/tensorflow/python/eager/wrap_function.py", line 80, in __call__
    return self.call_with_variable_creator_scope(self._fn)(*args, **kwargs)
  File "/home/sridhar/PE_CSV/malenv3/lib/python3.6/site-packages/tensorflow/python/eager/wrap_function.py", line 86, in wrapped
    return fn(*args, **kwargs)
  File "/home/sridhar/PE_CSV/malenv3/lib/python3.6/site-packages/tensorflow/python/eager/wrap_function.py", line 605, in _imports_graph_def
    importer.import_graph_def(graph_def, name="")
  File "/home/sridhar/PE_CSV/malenv3/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "/home/sridhar/PE_CSV/malenv3/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 431, in import_graph_def
    raise ValueError(str(e))
ValueError: Input 0 of node model/embedding/embedding_lookup was passed float from model/embedding/embedding_lookup/Read/ReadVariableOp/resource:0 incompatible with expected resource.

I'm able to use the model on a python based inference engine. I'm trying to just compress the model to deploy it on smaller setup and consume via a c/c++ wrapper.

any update on this Were you able to fix this issue

@codeyman I don't see any issue with tf_lite conversion of keras model in TF2.0. [Here] is the gist.
!pip install tensorflow==2.0.0
import tensorflow as tf
mnist = tf.keras.datasets.mnist

(x_train, y_train),(x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0

model = tf.keras.models.Sequential([
  tf.keras.layers.Flatten(input_shape=(28, 28)),
  tf.keras.layers.Dense(128, activation='relu'),
  tf.keras.layers.Dropout(0.2),
  tf.keras.layers.Dense(10, activation='softmax')
])

model.compile(optimizer='adam',
              loss='sparse_categorical_crossentropy',
              metrics=['accuracy'])

model.fit(x_train, y_train, epochs=5)
model.evaluate(x_test, y_test)
model.save("keras_model.h5")

new_model=tf.keras.models.load_model("keras_model.h5")
new_model.summary()

converter = tf.lite.TFLiteConverter.from_keras_model(new_model)
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)

I am closing this issue. Please feel free to open it if the issue persists with TF2.0. Thanks!

Could you please use the model from the summary that I provided? I understand that it works on the sample code. Can you please try with the same layers?

@codeyman Can you please create the model and follow the steps I mentioned in the code I shared. If there is any issue, please create a colab gist and share it here. Thanks!

@jvishnuvardhan Please look at my bug creation code. It is exactly the same:
import tensorflow as tf
model = tf.keras.models.load_model('keras_model.h5')
model.summary()
converter.convert() <-- This throws the error

@jvishnuvardhan Please see the standalone code Here.

@jvishnuvardhan Can you please reopen this issue?

@jvishnuvardhan Yeah, no issues while training. Note that is the standard malconv model: https://arxiv.org/pdf/1710.09435.pdf

Any news on this? We are running into the same issue with a network using an embedding layer.

We encountered a very similar issue in our model and it is consistent in tf2.0 official release, but it looks it is gone in the latest TF-nightly build.

Closing this issue because the code snippet in https://github.com/tensorflow/tensorflow/issues/32849#issuecomment-539646714 works on the nightly (pip install tf-nightly).
@codeyman Please request to reopen if you experience additional problems.

@gargn Could you please provide the bug that fixes this issue? I have to compile tensorflow on my setup and I'd like to just cherry-pick just this changeset over the tf-2.0 release.

Closing this issue because the code snippet in #32849 (comment) works on the nightly (pip install tf-nightly).
@codeyman Please request to reopen if you experience additional problems.

what if I need Tensorflow 1.11.0 for example? I cannot just pip install tf-nightly, because my customer's code is not compatible with tf 2.x.

I am getting this exception in 2.3.0. There seems to be a workaround (see https://github.com/usimarit/TiramisuASR/blob/main/tiramisu_asr/models/layers/embedding.py) but I am not a big fan of having my own Embedding-layer implementation in my code. Is there another way?

Any exact solutions? Meet the same issue for LSTM.


workflows: esr: pass input parameters to workflow_call

Change-type: patch
Signed-off-by: Alex Gonzalez<EMAIL_ADDRESS>

lgtm

@resin-jenkins test this please


<EMAIL_ADDRESS>icu4c version error

Describe the bug
If pecl_http is endabled php throwing erro:
PHP Warning:  PHP Startup: Unable to load dynamic library<EMAIL_ADDRESS>(tried<EMAIL_ADDRESS><EMAIL_ADDRESS>0x0009): Library not loaded: /opt/homebrew/opt/icu4c/lib/libicui18n.73.dylib   Referenced from: <25749073-7EF8-3A72-9EC0-B9ECD1AB2E7A><EMAIL_ADDRESS> Reason: tried: '/opt/homebrew/opt/icu4c/lib/libicui18n.73.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/icu4c/lib/libicui18n.73.dylib' (no such file), '/opt/homebrew/opt/icu4c/lib/libicui18n.73.dylib' (no such file), '/opt/homebrew/Cellar/icu4c/74.2/lib/libicui18n.73.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/icu4c/74.2/lib/libicui18n.73.dylib' (no such file), '/opt/homebrew/Cellar/icu4c/74.2/lib/libicui18n.73.dylib' (no such file<EMAIL_ADDRESS><EMAIL_ADDRESS>0x0009): tried<EMAIL_ADDRESS>(no such file<EMAIL_ADDRESS>(no such file<EMAIL_ADDRESS>(no such file))) in Unknown on line 0
PHP versions
PHP 8.3
To Reproduce

install<EMAIL_ADDRESS>install<EMAIL_ADDRESS>3 run php -v

Expected behavior

Screenshots/Logs

Additional context

Are you willing to submit a PR?

I have added new builds to fix this. Will update once they are completed.

good job. thank you

It should work now
brew update
brew reinstall<EMAIL_ADDRESS>


Getting the error:TypeError: Cannot assign to read only property 'port' of SMTP when using nodemailer with protractor

This is the code i have in the Config file
 onComplete: function () {
        // create reusable transport method (opens pool of SMTP connections)
        var smtpTransport = nodemailer.createTransport("SMTP",{
            host: 'smtp.companyemail.com',
            port: '110',
            auth: {
                user<EMAIL_ADDRESS>                pass: 'userpass'
            },
        });

        console.log('SMTP configured');
        // setup e-mail data with unicode symbols
        var mailOptions = {
            from<EMAIL_ADDRESS>// sender address
            to<EMAIL_ADDRESS>// list of receivers
            subject: "Hello ✔", // Subject line
            text: "Hello world ✔", // plaintext body
            html: "<b>Hello world ✔</b>" // html body
        }

        // send mail with defined transport object
        smtpTransport.sendMail(mailOptions, function (error, response) {
            if (error) {
                console.log(error);
            } else {
                console.log("Message sent: " + response.message);
            }

    // if you don't want to use this transport object anymore, uncomment following line
    smtpTransport.close(); // shut down the connection pool, no more messages
        });

    }

This is likely an error with the way you're using nodemailer, not with protractor, so I'm closing the issue.  I found this discussion, which might help you: https://github.com/andris9/Nodemailer/issues/316


Add German translations

@normanjaeckel can you translate the missing (176) strings in transifex?

Added a lot of strings. Some are still open. We have to do them during release process.


Connection refused

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

Anybody know that?
ubuntu@VM-0-12-ubuntu:~/soft$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to raw.githubusercontent.com:443

You need the ssl certs to make requests to github.


Add symbolic support to Bloqs that expect control values as cvs: Tuple[int, ...]

Many bloqs (like MultiAnd, MultiControlPauli etc.) currently expect a control values object as a Tuple[int, ...]. This has a consequence that we cannot instantiate these objects symbolically.
We should replace cvs: Tuple[int, ...] with CtrlSpec object that can be instantiated symbolically as well.

Would we want some sort of CtrlSpec that takes a parameter n for the number of controls and doesn't fully specify what the control values actually are? Usually during costing the difference between a positive and negative control is negligible

Yes, that's the idea.

The newly-added Shaped symbolic utility #867 would be good here

Is there a list of high priority bloqs that need this


[Suggestion] Allow for setting a cp/iv threshold and a number of duplicate pokemons below it for keeping

It seems like a nice feature to be able to set the following logic:
Set a cp/iv threshold
Do not transfer pokemons above it
Keep a configurable amount of strongest (by iv/cp) pokemons below it.

In the Dev-Branch u can set to not transfer the best pokemon of a kind.

It's not what I am suggesting.
The point is - any pokemon above iv 0.95 is worth keeping. 10 0.95 vaporeons, for example. But say you encounter something rare, and you do not know what. If your setting for "any" is release below 0.95 that rare pokemon would be released. At the same time, if you configure the bot for keeping the best 10 pokemons, you would quickly use all pokemon storage.


App not clear which format vaccination certificate acceptable

Avoid duplicates

[ ] Bug is not mentioned in the FAQ
bug relates to FAQ article https://www.coronawarn.app/en/faq/#vac_cert_invalid
[X] Bug affects both Android and iOS, for specific issues / questions that apply only to one operating system, please raise them in the respective repositories:

Android repository
iOS repository

[X] Bug is not already reported in another issue

Technical details

Device name: Google Pixel 3a emulator
Android version: 11
App version: 2.4.1-RC2

Describe the bug
The introduction to scanning certificates does not clearly describe that only EU compatible vaccination certificates can be successfully scanned. Instead users are scanning QR codes that they received after being vaccinated, before the new format was introduced, and they receive the app error 'This QR code is not a valid vaccination certificate. (VC_PREFIX_INVALID)'.
Steps to reproduce the issue

On Start Screen, tap "Certificates"
Read text on screen "Add Certificates"
Tap "CONTINUE"
Read tile "Add Digital Proof of Vaccination"

Expected behavior
The app should be clear about what type of digital proof of vaccination it can accept.
Possible Fix
Add text to the screens leading up to the QR-Code Scan so that the user is able to recognize if the QR-Code they plan to scan is likely to be accepted by the app. If the app is only able to scan in an "EU Digital Covid Vaccination Certificate", then this term should explicitly appear in the text.
Additional context
The document https://ec.europa.eu/health/sites/default/files/ehealth/docs/covid-certificate_paper_guidelines_en.pdf shows an EU example of a typical EU Digital Covid Vaccination Certificate in paper and digital form.

Internal Tracking ID: EXPOSUREAPP-8029

@MikeMcC399 Thanks! Internally tracked.

Internal Tracking ID: EXPOSUREAPP-8029
Corona-Warn-App Open Source Team

The certificate specification https://ec.europa.eu/health/sites/default/files/ehealth/docs/digital-green-certificates_v1_en.pdf describes in "4.2.2 QR 2D Barcode" that "..the base45 encoded data (as per this specification) SHALL be prefixed by the Context Identifier string "HC1:"."
To check if you are scanning a compatible code, use a regular QR reader to see if the QR code starts with HC1:
There is an example on https://github.com/Digitaler-Impfnachweis/certification-apis/blob/master/examples/README.md

In CWA Android 2.5.0-RC3 (not yet released) I see the improved text.
Certificates > three-dot symbol > Information
"Add your EU digital COVID certificates in the app. This will enable you to prove your vaccination protection, a negative test result, or your recovery from an infection with the app."
"You can add EU digital COVID vaccination certificates, COVID test certificates, and COVID certificates of recovery in the app."
When 2.5.x is released, the texts above will solve the issue reported here. 👍🏻

Thanks @MikeMcC399.


[BUG]: Incompatible PostgreSQL database union types

What version of drizzle-orm are you using?
0.35.3
What version of drizzle-kit are you using?
No response
Describe the Bug
My goal is to support both the node-postgres and neon-http drivers. My db object is therefore defined as a union type of the two drivers.
This gives a Typescript error when using the partial insert returning (https://orm.drizzle.team/docs/insert#insert-returning). All of a sudden, it's not expecting a parameter, even though it's supported by both drivers (they're both PostgreSQL).
Small repo to reproduce the issue: https://github.com/JakobLierman/drizzle-union-type-bug.
Expected behavior
No Typescript errors should occur on functionality supported by both database types.
Environment & setup
Both on Webstorm and Visual Studio Code, not that it matters all that much.
You can also test it out bare bones by running npm run check-types (tsc --noEmit) and see where it fails.

For anyone trying the same. I've changed my driver from Neon HTTP to the Neon serverless one (using WebSockets). Works perfectly now.

Figured out a solution:
// Do this
const db: PgDatabase<NodePgQueryResultHKT | NeonHttpQueryResultHKT, Schema>;
// Instead of this
const db: NodePgDatabase<Schema> | NeonHttpDatabase<Schema>;


Update Configure-AD-FS-Extranet-Smart-Lockout-Protection.md

Update above changes on the doc as it's a bit confusing and contradicting.
Thanks

@gagz02 : Thanks for your contribution! The author(s) have been notified to review your proposed change.

#sign-off

@illfated: I'm sorry - only the author of this article, @billmath, can sign off on your changes. But we do have an exception process - if you are on the Microsoft content or product team for this product area, you can ask the PR review team to review and merge it by sending mail to the techdocprs alias.

Yes, I know. My sign-off comment is based on an agreement with the team.

Thanks for your dedication to our documentation. Unfortunately, at this time we have been unable to review your pull request in a timely manner and we sincerely apologize for the delayed response. The requested updates have not been made, although there have been further updates with subsequent releases which supersede the updates in your pull request. We are closing this issue for now, but if you feel that it's still a concern, please respond and let us know. If you determine another possible update to our documentation, please don't hesitate to reach out again. #please-close

#assign=robinharwood

The following users don't have valid GitHub IDs, or are not collaborators on this repo: =robinharwood


Set requests and limits to hardcoded values in templates as workaround

Description
This is a workaround for issue #239.
The next version of the API should make this a configurable option. Issue #244 has been created to track the work.
Fixes #239
Type of change

Bug fix (non-breaking change which fixes an issue)

Checklist

[ ] Unit tests and e2e tests updated
[ ] Documentation updated

Not sure why this is not building and testing properly on TravisCI. "It works on my machine"...

@Smiley73 I don't see a build failure in Travis CI.


Keepass auto-fill doesn't get propagated through Angular data flow

@emptywee reporting he's unable to connect to st2web while the fields gets auto-filled by keepass browser addon. Clicking on connect button returns unauthorized. Triggering a change in fields and then trying to connect again solves the problem.

This should be fixed in the react rewrite, which should be included with 2.6.


PoC for log library surface reduction (2991)

Description

part of #2991, this is the initial step to unifying the log libraries and put the surface in a single location. Note that even for this one functionality about half the files in the entire project will be touched in the end. This one and the StringUtils one are probably the biggest. This and the gson one will be the more complicated than StringUtils. The DAO framework will have even more impact but the may be out of scope for #2991

Types of changes

[ ] Breaking change (fix or feature that would cause existing functionality to change)
[ ] New feature (non-breaking change which adds functionality)
[ ] Bug fix (non-breaking change which fixes an issue)
[ ] Enhancement (improves an existing feature and functionality)
[x] Cleanup (Code refactoring and cleanup, that may add test cases)

Screenshots (if appropriate):
How Has This Been Tested?

@blueorangutan package

@DaanHoogland a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

Good change to move all the logs under a single class to ease any future changes or choice of library.

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2403

@blueorangutan test

Trillian test result (tid-3140)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 19524 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2992-t3140-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_multipleips_per_nic.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
Smoke tests completed. 67 look OK, 2 have error(s)
Only failed tests results shown below:

Test
Result
Time (s)
Test File

test_nic_secondaryip_add_remove
Error
21.10
test_multipleips_per_nic.py

test_04_rvpc_network_garbage_collector_nics
Failure
437.02
test_vpc_redundant.py

Why not use SLF4J instead of reinventing your own facade?
As a developer of an internal plugin, I find it frustrating to be forced into using limited one-off implementations. In particular, I am sending managment server logs to ELK in a JSON format. With SLF4J, Logback with the Logstash Logback Encoder, I can use Markers to add event-specific custom fields wherever I want. This is very useful for searching and filtering logs in ELK, not to mention the potential that exists for visualization of log events based on custom JSON fields. I assume a similar thing can be done with SLF4J and log4j2, but I have not reasearched it much. But, if Cloudstack uses a homegrown facade, it will not have a full logging feature set available.

@csquire hearsay admittedly but apache logging folk say that log4j2 is better faster neater than slf4j and when we consolidated the util package we can decide to wrap slf4j in it as well, right now slf4j is used at some places in the system, java logging at others and log4j version 1 mostly. I want to consolidate all logging after merging this PoC first and than upgrade to whatever we decide. The idea here is that we have only one place where the version of the 3rd party lib matters.

Understood. I'd just like plugin development to be taken into consideration and by using at thin wrapper around logging that doesn't implement a full feature set, plugin developers would have to either bypass it to do what I want or accept that I cannot do certain things. I also understand that I'm probably in the minority (as far as Cloudstack goes) of wanting to do things like add event-specific custom fields to log events.

happy to work with you on what you need, @csquire . We do want to implement a large enough subset so all are served. ATM we have a maintenance problem, removal of which is our first objective. If you add an issue for your requirements I will add it if my puny abilities allow. Do not see the implementation of this PoC as the final stage or full interface.

Will do, thanks!

+1

@DaanHoogland I'll evaluate this soon and get back to you, thanks for the PR!

@blueorangutan package

@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

hm, there where packages for the latest commit already. test had been run as well.

This is not a feature, @rafaelweingartner . It is a way to make the system a bit more maintainable and deal with technical debt.

I understand that is not a feature, but I do not agree that this will help. I will try to write something until tomorrow to explain why.

ok, you will fail, but I will be patient for another day.

@rafaelweingartner, I have no idea why someone would not want to do this. It is a best practice and in my opinion a blocker to upgrading log4j and any other logging frameworks. Please give me any arguments not to do this. I am pretty sure I can counter them.

the travis build is successful but still reports an error here. I will extend this PoC somewhat to see what happened there.

Hey @DaanHoogland, sorry the delay. I have not had much time lately to work with CloudStack.
I am not seeing how this PR will reduce the surface of changes to upgrade to log4j2. You will still need to replace all of the points/places in the code where log4j-1 is currently used by your brand new eggshell (that will sit on top of a known logging framework such as log4j). Therefore, you are not reducing the surface of change right now. You would achieve some surface reduction if people adopted more Object orientation approach, and used less static methods/variables. I also do not see the value in adding this abstraction layer on top of a framework (in this case a logging framework). Why stop at the logging framework then? Why not create a layer of abstraction on top of Spring, JPA, and Web frameworks as well? At least that was our discussion in Montreal. We should move on towards standard implementations, and stop reinventing the well. For instance, your proposal could be applied to JPA (as it has different implementations too) as well, will we do that (when we move towards Spring-data and a real JPA implementation)? I hope not…
From log4j-1 to log4j-2, the methods  (logging ones such as debug, info, warn, and so on) did not change the signature. Only the classes and some other things moved to new places. Of course, new “methods/implementations/integrations” were added, but that is not the case we are dealing with here. Therefore, to execute the upgrade, you would only need to run a script such as the following:
#!/bin/bash
CLOUDSTACK_FOLDER="./"

ALL_CLOUDSTACK_CLASSES=$(find $CLOUDSTACK_FOLDER -name "*.java")

for class in $ALL_CLOUDSTACK_CLASSES
do
  count=$((count+1))
  echo "Processing ($count) class: $class"

  echo "Replacing org.apache.log4j.Logger with org.apache.logging.log4j.Logger"
  sed -i 's/org.apache.log4j.Logger/org.apache.logging.log4j.Logger/g' $class

  echo "Adding import to org.apache.logging.log4j.LogManager"
  sed -i '/org.apache.logging.log4j.Logger/a import org.apache.logging.log4j.LogManager;' $class

  echo "Replacing Logger.getLogger with LogManager.getLogger"
  sed -i 's/Logger.getLogger/LogManager.getLogger/g' $class

  echo "Replacing org.slf4j.Logger with org.apache.logging.log4j.Logger"
  sed -i 's/org.slf4j.Logger/org.apache.logging.log4j.Logger/g' $class

  echo "Replacing org.slf4j.LoggerFactory with org.apache.logging.log4j.Logger"
  sed -i 's/org.slf4j.LoggerFactory/org.apache.logging.log4j.LogManager/g' $class

  echo "Replacing LoggerFactory.getLogger with /LogManager.getLogger"
  sed -i 's/LoggerFactory.getLogger/LogManager.getLogger/g' $class
done

Moreover, as you can see by the script I created, someone else already did something similar what you are proposing with SLF4j. I mean, creating a POC, and hoping/wanting to do things on demand. The result…Nothing changed, and then we were using 2 different logging frameworks. With your proposal, we would have 3 different points/classes used for logging simultaneously.
I already took the liberty and did some work towards the upgrade and removing SLF4J. I only need now to solve the implementation of a custom SNMP logging mechanisms that was connected to log4j, and after that, the job is done. No need to create this abstraction layer.

tl;dr you are not giving any argument to not use this strategy, you are only saying why this PoC is just a PoC.
What you are describing is very elaborate as well, @rafaelweingartner. The script you describe is error prone. Not all calls and declaration are formatted the same way and the expressions look a bit to simple.
I have seen the attempt to use slf4j in the console proxy code and it needs to be addressed as well. It is in the wrong place and incomplete.
you say "For instance, your proposal could be applied to JPA ... as well, will we do that (when we move towards Spring-data and a real JPA implementation)? I hope not…". I do hope so, and I think you should as well, but this will be very challenging in the DAO case. I think it would be great if we could.
I think we should definitely do this for a lot of external libraries, not reinventing the wheel but abstracting out and isolating dependencies on external eccentricities of those libraries, like call syntax/sematics. As you can see in my description of the issue (#2991) I am not being religious. I exclude (not definitely but as example) the DAO framework, as indeed spring data may make it more convenient to go about it differently. But NOTE: this is a temptation, luring us into a tie into the specifics of a framework we decide to commit ourself into in such a way.
As you can see in #987 and #2276 and, I am sure numerous upgrade attempts by others as well, what you describe is not as simple as you say without isolating the use of an external library.
I will follow up on this PR given mandate. we need to reduce the internal exposure to external libraries, not reinventing the wheel but isolating there use in proxy libraries. Your solution to upgrading log4j is not unifying logging framework use but only upgrading log4j as a one off solution essentially perpetuating the problem.
In short, this PoC in itself will not solve the problem. it needs follow up and I dedicate myself to that. I do not want a PR like #2276, with 1710 files changed if a dependency decides to change a signature or a exposed structure. This will disable merging forward and hinder regular maintenance.

Also, @rafaelweingartner, I will -1 a PR that 'just' upgrades a structurally changed dependency, if it fails to makes efforts to isolate the dependency as described.

What do you mean with "isolate the dependency"? It is a dependency, we choose it (wisely), we evaluate it, and we move on.
As I said, there are different ways to tackle the issues. One is for sure doing what you are proposing and creating a layer on top of everything. Other would be a better Class hierarchy and using properly object orientation.
Anyways, to upgrade the log4j is not as a Dantesc task as you are portraiting. I am almost done, and I have almost had no time to work on it. I can finish, and then show you for us to discuss if you have an open mind.

Anyways, to upgrade the log4j is not as a Dantesc task as you are portraiting. I am almost done, and I have almost had no time to work on it. I can finish, and then show you for us to discuss if you have an open mind.
If you unify the log framework usage as well, I am open to your solution.

If you unify the log framework usage as well, I am open to your solution.
That is actually what I am doing. That is why it is taking some time (time that I have not had much lately). Also, as you noticed the simple script I created does not address some very specific case in our code base. Therefore, I need to visit them manually, and to evaluate if they are really needed, and if we can move on to the use of standard variables.

so basically you are re-doing my work from #2276 but without reducing the surface area. I do not like it much so far.

@rafaelweingartner , can you enter something of a PoC PR so we can discuss further?
Or sugest changes to this one?

Sure I will

used a addepted version of @rafaelweingartner's script above :
#!/bin/bash
CLOUDSTACK_FOLDER="."

ALL_CLOUDSTACK_CLASSES=$(find $CLOUDSTACK_FOLDER -name "*.java")

for class in $ALL_CLOUDSTACK_CLASSES
do
  count=$((count+1))
  echo "Processing ($count) class: $class"

  echo "Replacing org.apache.log4j.Level with org.apache.cloudstack.utils.log.Level"
  sed -i .loch 's/org.apache.log4j.Level/org.apache.cloudstack.utils.log.Level/g' "$class"

  echo "Replacing org.apache.log4j.Logger with org.apache.cloudstack.utils.log.Logger"
  sed -i .loch 's/org.apache.log4j.Logger/org.apache.cloudstack.utils.log.Logger/g' "$class"

  echo "Replacing java.util.logging.Logger with org.apache.cloudstack.utils.log.Logger"
  sed -i .loch 's/java.util.logging.Logger/org.apache.cloudstack.utils.log.Logger/g' "$class"

  echo "Adding import to org.apache.cloudstack.utils.log.LogFactory"
  sed -i .loch '/import org.apache.cloudstack.utils.log.Logger/a \
import org.apache.cloudstack.utils.log.LogFactory;
' "$class"

  echo "Replacing Logger.getLogger with LogFactory.getLogger"
  sed -i .loch 's/Logger.getLogger/LogFactory.getLogger/g' "$class"

  echo "Replacing org.slf4j.Logger with org.apache.cloudstack.utils.log.Logger"
  sed -i .loch 's/org.slf4j.Logger/org.apache.cloudstack.utils.log.Logger/g' "$class"

  echo "Replacing org.slf4j.LoggerFactory with org.apache.cloudstack.utils.log.LogFactory"
  sed -i .loch 's/org.slf4j.LoggerFactory/org.apache.cloudstack.utils.log.LogFactory/g' "$class"

  echo "Replacing s_logger with LOG"
  sed -i .loch 's/s_logger/LOG/g' "$class"
done

the above scripts leaves some to be desired like:
I don't have a constructor taking a String, yet. there where only a handful of those and all used a Class.getname, so I converted the calls instead.
on occasion the script led to a double insertion of the factory import. fixed those by hand as well

@blueorangutan package

@DaanHoogland a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2601

@blueorangutan test

@DaanHoogland a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

framework/managed-context uses slf4j and is not dependend on utils. This needs to be solved by

isolating logging in its own project and make it second to checkstyle
exclude managed context from the standard use of logging

Trillian env failed to deploy twice, I've rekicked the job again. cc @DaanHoogland

no public support


Improve caching behaviour when using GitHub Merge Queue

Due to the high number of daily PRs to a repo, we have enabled githubs merge queue feature:

The merge queue provides the same benefits as the Require branches to be up to date before merging branch protection, but does not require a pull request author to update their pull request branch and wait for status checks to finish before trying to merge.

Due to the fact that

The merge queue will ensure the pull request's changes pass all required status checks when applied to the latest version of the target branch and any pull requests already in the queue.

our workflow definitions mostly look like
name: Test
on:
  workflow_dispatch:
  pull_request:
  merge_group:

Notice specifically the absence of
on:
  push:
    branches:
      - main

because the merge queue pretty much prevents any merges from breaking main already, so running test jobs on push to main is wasted money. However, this prevents PR builds from profiting from the gradle cache.
Is there something that can be done in setup-gradle, which would allow PR builds to read the cache created in the merge queue builds by default?
This is how all the steps look:
- name: Setup Gradle
  uses<EMAIL_ADDRESS>  with:
    cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

Unfortunately, I don't think there's anything the setup-gradle action can do to improve the situation. Unless things have changed, here's the gist of the problem:

Merge queues works by creating a temporary branch with a special prefix. The workflow is executed against this branch.
By default, the setup-gradle action will set cache-read-only=true for any branch other than main. You can override this in your workflow by setting cache-read-only=true or using an expression based on the branch name.
But even if you do make the cache writable, cache entries written from one branch are not visible to workflow running another branch. (The only exception is cache entries written for the main branch, which are visible to all other branches).

You can read a more detailed explanation in the docs.
This GitHub issue captures the essense of the problem: https://github.com/orgs/community/discussions/66430

With the current functionality available in GitHub Actions, I don't believe there is anything that setup-gradle can do to improve the caching behaviour with GitHub Merge Queues.


What is the best way to store datasets?

For example, I want to train a deep learning model with many image files.
a) Should I upload the image datasets to the HDFS?
I have tried to upload the image dataset to the HDFS, but got a very slow upload speed because of the small size of the image file.
b) If uploading the dataset to the HDFS is the best way, how to upload them? by WebHDFS or other API?
Btw, I found that HDFS is not suitable to store many small files according to some webpage. And I think building the dataset into the docker image(like some examples) is not the best way.
Thanks.

Hi @GeoffreyChen777 , OpenPAI does not limit the usage of storage system: you can use any storage system you see fit. For example, for small-scale system, an NFS might be sufficient, and the user access the NFS from within a docker container.
If you would like to use HDFS, remember that HDFS has limitations. one of the well-known limitation is the small file problem: https://blog.cloudera.com/blog/2009/02/the-small-files-problem/.
Taking ImageNet as an example, the millions of small files will overload namenode. and making read/writer very slow. So it is recommended to pack them into one or a few large files to improve performance. Please refer to Hadoop community for further instruction (Some has suggested to use Hadoop Archives to pack files).
If you use TensorFlow, one option is to convert the ImageNet dataset into
a few TFRecord for TF to process them in parallel: https://stackoverflow.com/questions/48698286/tensorflow-dataset-api-with-hdfs
https://www.alibabacloud.com/help/doc-detail/53928.htm
Finally, if you would like to upload data to HDFS, OpenPAI's default HDFS deployment support WebHDFS and native HDFS API. You can use native HDFS CLI to do that: https://hadoop.apache.org/docs/r2.7.1/hadoop-project-dist/hadoop-hdfs/HDFSCommands.html. Please refer to Hadoop community for detailed instruction. And there are many tools available to support both native HDFS and WebHDFS. E.g., to just name a few: https://pypi.org/project/hdfs/, https://pypi.org/project/pydistcp/. Note that OpenPAI team has not tried any 3rd party hdfs tools, so the named examples are our recommendations.


compilation error with custom operator== defined in namespace

I have troubles compiling the code fragment below. And everything works just fine if namespace is not used. Any hints?
namespace N {
class MyClass {
public:
    bool operator == (const MyClass &v) const {return false;}
};
}

std::ostream & operator << (std::ostream &os, const N::MyClass &v){
    return os << "MyClass\n";
}

TEST_CASE("eq") {
    N::MyClass obj;
    std::cout << obj << "  comparison: " << (obj==obj) << "\n";
    REQUIRE(obj==obj); // does not compile!
}

g++-11 (Homebrew GCC 11.2.0_3) 11.2.0
#define DOCTEST_VERSION_STR "2.4.6"

I'm honestly inclined to believe this is a compiler bug introduced in GCC 11, considering it works on virtually all compilers, including all previous versions of GCC. However I'll investigate further and report back.

This is a minimal reproducible example: https://godbolt.org/z/re1Ez954x
So it appears that this is both a compiler and a doctest bug! On one hand The operator<< not being found is expected, due to some weird lookup rules in combination with operator<< being declared for doctest::String inside of the doctest namespace. However, this should simply result in has_insertion_operator returning false, via SFINAE, instead, GCC fails to compile. To fix this and get the expected (but still semantically wrong) behavior we can replace << with operator<< in the partial, true, specialization of has_insertion_operator.
How to fix this properly and in accordance with the standard I am not entirely sure. I am currently leaning towards declaring all operator<< overloads that doctest defines in the global namespace, however, I'm unsure if this is considered pollution and if it might have unintended side effects, so I'll have to reinvestigate this.

I'm finally getting close to fixing this.
I just noticed that you might've just been looking for a fix for your code, in which case simply putting operator<< inside of namespace N OR making it a friend of MyClass would both fix it. 🙂

In order to have this work doctest must be able to see the operator<< overload, which requires it being declared before including doctest, that's sadly just a C++ limitation. But other than that this has been fixed in dev!


Chef-Automate Cookbook?

Cookbook version
latest
Chef-client version
latest
Platform Details
CentOS
Scenario:
I would like to know if someone has created Chef-Automate Cookbook?
Expected Result:
the answer is yes, and a link is posted
Actual Result:
you'll say no?

Chef-ingredient has resources for installing non open source Chef products. Give it a try


Update tokenizer to no longer accept octals (without the prefix) and the long suffix

Hmm, maybe hold off on this one, I don't think it's quite right. For example 000 should be valid but it's not.

Seems to work now. Any idea if there are tests for this type of stuff?

test_int.py has some octal tests, but we can't run tests yet because the parser isn't up to snuff. https://github.com/IronLanguages/ironpython3/blob/master/Src/StdLib/Lib/test/test_int.py#L138

One thing I have been doing is copying some of the tests into a new file and then using -S to skip import of site.py.

Are you happy with this? If so, I'll go ahead and merge it.

@slide Yes. Should be fine for now.


Allow type coercion for some properties

For simplicity and a cleaner implementation, the nested types of NestedProperty can not be coerced. This might change in the future, should there be a need for it.


Add UAH currency

Add Ukrainian Hryvnia currency

@arthur-here can you resolve the conflicting file, then I will merge this PR :)

@jeppestaerk sure, done!


[Question]: what antlr directory really do?

Contact Details
<EMAIL_ADDRESS>What's the question?
I have a question!
I see there is a directory named antlr under babelfishpg_tsql, but babelfishpg_tsql generate gram-backend.y for parser,
so what the antlr really do?
Relevant log output or information
No response
Code of Conduct

[X] I agree to follow this project's Code of Conduct

It's not uncommon for a procedural language to have a parser (src/backend/pl separate from the backend (SQL) parser (src/backend/parser/gram.y).
The antlr directory holds the parser (and lexer) for PL/tsql - this parser (and lexer) isconstructed using ANTLR4.
I think that gram-backend.y is a modified version of src/backend/parser/gram.y - it's used to parse SQL code that may contain syntax extensions from TSQL (for example, SELECT TOP 5).

@korry
Thanks for your reply.
I saw there is an option named babelfishpg_tsql.use_antlr to choose the pl/tsql's parser.
 879 ▸ if (pltsql_use_antlr)
 880 ▸ {
 881 ▸ ▸ ANTLR_result result = antlr_parser_cpp(proc_source);
 882
 883 ▸ ▸ if (result.success)
 884 ▸ ▸ {
 885 ▸ ▸ ▸ parse_rc = 0;
 886 ▸ ▸ }
 887 ▸ ▸ else
 888 ▸ ▸ {
 889 ▸ ▸ ▸ report_antlr_error(result);
 890 ▸ ▸ ▸ parse_rc = 1; /* invalid input */
 891 ▸ ▸ }
 892 ▸ }
 893 ▸ else
 894 ▸ {
 895 ▸ ▸ parse_rc = pltsql_yyparse();
 896 ▸ }

So there are two ways to parse the pltsql? one using antlr and the other use yacc?
and which way will be the primary way in future?

@korry - could you please respond to the follow up question?

Hi @louishust,
The current babelfish architecture has two parsers. The first one is ANTLR parser which is compatible with T-SQL grammar.
This is the frontend parser (but still running postgres backend) and consume all the query string inputed from TDS port.
The role of ANTLR parser is 1) validate T-SQL grammar and then 2) relay the query string into postgres backend parser for normal DML/DDL, or 3) generate a PL/tsql structure which is used to run a T-SQL specific statement like IF, WHILE, ...
This sounds little bit confusing especially that babelfish still relies on PG's backend parser. But, even in a select statement, it takes much efforts to generate execution plan by ANTLR parser directly. so we decided to use PG's backend parser if PG already has similar statement.
But the problem is that, we mainly rely on PG's backend parser for DML/DDL but all the detailed grammar is not same.
For example, T-SQL has TOP expression but postgres has LIMIT expression.
To deal with this, we want to add a grammar to accept top-expression in PG, but we want to minimize to touch the PG's backend parser code. gram-backend.y is automatically generated by concatenating PG's gram.y and extended grammar files under babelfishpg_tsql/src/backend_parser.
Hope that this helps you for better understanding.
And here are the answers for your specific questions.
Q: there are two ways to parse the pltsql? one using antlr and the other use yacc?
A: NO. we need both ANLTR parser and yacc (PG backend parser)
And babelfishpg_tsql.use_antlr will be removed. This was added for historically reason. sorry for confusion of this.

Detailed answer provided and docs updated.


Question about the latest api update.

Hey @p1atdev thank you very much for this awesome library. Do you think the v1.1 api is still useable with the web client token after twtters recent update?

And if I use the web client token without providing guest-id or cookie will it cause any issues? @p1atdev

The api endpoints which this library uses are not official endpoints, so it needs guest-id to check whether a request came from browser. I don't know can be used v1.1 endpoint with correct token because I haven't tried it...
Cookie is not needed always but maybe it can be used for emulate a user operation.

The api endpoints which this library uses are not official endpoints, so it needs guest-id to check whether a request came from browser.

I'm aware of that no worries.

I don't know can be used v1.1 endpoint with correct token because I haven't tried it... Cookie is not needed always but maybe it can be used for emulate a user operation.

I actually tried the token directly with v1.1 endpoints and seems some basic endpoints such as getting tweet, userTimeline etc works. I'm just curious if it will keep working cause worried they might completey shutdown v1.1. Or maybe they ban my ip for constant use of the token. I'm thinking of using proxy for each call but the only thing worried about is existence of v1.1 in future.

Currently it fails with Error: Cannot get api.*.js id on:
    // get api.*..js from html
    // the format is `api:"9eacf99",`
    const apiJsId = htmlText.match(/api:"([^"]+)",/);
    Deno.writeTextFileSync("log.html", htmlText);
    if (apiJsId === null) {
      throw new Error("Cannot get api.*.js id");
    }

So I guess things changed and Twitter is no longer giving the api js?


Allow instants to pass through schema validation.

We missed a case. Hooray placeholders!

Channeling @ncalexan's comment when I did this - we should also expand the default case to cover all remaining cases so that we don't miss a case next time!

I thought about doing that… but don't we have a product here of all ValueTypes and all TypedValues? That's 56 more cases. We could choose to only do ValueType or TypedValue thoroughly…

@fluffyemily ^ howzat?


Adds Python decoders for Dragino LLMS01 and LSN50

Issue #, if available: N/A
Description of changes: Added a decoder for the Dragino LLMS01 Leaf Moisture Sensor, and for the Dragino LSN50 3-channel Temperature Sensor
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Thanks for your contribution Tom!


Use correct version of packages

Summary of changes
Changes introduced in this pull request:

Use fvm3 in all v10 actors

Reference issue to close (if applicable)

Contributes to #58
Other information and links

Codecov Report
Patch coverage: 1.33% and project coverage change: -0.03 :warning:

Comparison is base (bf17d21) 13.52% compared to head (83bc60e) 13.49%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #59      +/-   ##
==========================================
- Coverage   13.52%   13.49%   -0.03%
==========================================
  Files         221      223       +2
  Lines       21638    21693      +55
==========================================
+ Hits         2926     2927       +1
- Misses      18712    18766      +54

Impacted Files
Coverage Δ

fil_actor_interface/src/builtin/account/mod.rs
0.00% <0.00%> (ø)

fil_actor_interface/src/builtin/market/mod.rs
0.00% <0.00%> (ø)

fil_actor_interface/src/builtin/miner/mod.rs
0.00% <0.00%> (ø)

fil_actor_interface/src/builtin/power/mod.rs
0.00% <0.00%> (ø)

fil_actor_interface/src/builtin/reward/mod.rs
0.00% <0.00%> (ø)

miner_v8/src/policy.rs
43.95% <0.00%> (-0.99%)
:arrow_down:

miner_v9/src/policy.rs
42.10% <0.00%> (-0.91%)
:arrow_down:

utils/src/convert.rs
0.00% <0.00%> (ø)

utils/src/lib.rs
100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

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

@LesnyRumcajs I have checked in forest


context deadline exceeded (Client.Timeout or context cancellation while reading body)

when I ask a complex question , It will random interrupt.
请输入你的问题(quit 离开): 帮我写个关于 c++ 基础知识的博客
C++是一种面向对象的编程语言，它是一种多范式的编程语言，可以用于开发桌面应用程序、移动应用程序、服务器应用程序、游戏开发等。C++是一种非常强大的编程语言，它拥有非常强大的功能，可以帮助开发者实现复杂的功能。
C++的基础知识包括：
数据类型：C++支持多种数据类型，包括基本数据类型（int、float、char等）、枚举类型、结构体、类等。

变量：变量是程序中用于存储数据的容器，它们可以是基本数据类型，也可以是复合数据类型，如结构体和类。

运算符：C++支持多种运算符，包括算术运算符、关系运算符、逻辑运算符、位运算符等。

控制语句：C++支持多种控制语句，包括if-else、switch-case、while、do-while、for等。

函数：函数是程序中的一种重要组成部分，它可以实现特定功能，并且可以被多次调用。

模板：模板是C++中的一种重要概念，它可以帮助开发者实现代码的复用，提高程序的可维护性。context deadline exceeded (Client.Timeout or context cancellation while reading body)

Had the same issue, and made a backend called the Completion API 3 times in the same call. It was getting timed out.
The default HTTP client provided has a timeout of 30 seconds
Making a custom HTTP client and setting a longer timeout solved it.
// passing a custom http client with a timeout of 600 seconds
// this is required because the default http client has a timeout of 30 seconds
httpClient := &http.Client{
      Timeout: time.Duration(600 * time.Second),
}
client := gpt3.NewClient(apiKey, gpt3.WithHTTPClient(httpClient))

有相同的问题，并且在同一个调用中做了一个调用Completion API的后端3次。它正在超时。 提供的默认HTTP客户端超时为30秒
制作自定义HTTP客户端并设置更长的超时时间解决了这个问题。
// passing a custom http client with a timeout of 600 seconds
// this is required because the default http client has a timeout of 30 seconds
httpClient := &http.Client{
      Timeout: time.Duration(600 * time.Second),
}
client := gpt3.NewClient(apiKey, gpt3.WithHTTPClient(httpClient))

hello
Still return “context deadline exceeded (Client.Timeout or context cancellation while reading body)”
I used streaming call（client.CompletionStreamWithEngine）, but the problem was not solved

Had the same issue, and made a backend called the Completion API 3 times in the same call. It was getting timed out. The default HTTP client provided has a timeout of 30 seconds
Making a custom HTTP client and setting a longer timeout solved it.
// passing a custom http client with a timeout of 600 seconds
// this is required because the default http client has a timeout of 30 seconds
httpClient := &http.Client{
      Timeout: time.Duration(600 * time.Second),
}
client := gpt3.NewClient(apiKey, gpt3.WithHTTPClient(httpClient))

hello
Still return “context deadline exceeded (Client.Timeout or context cancellation while reading body)”
I used streaming call（client.CompletionStreamWithEngine）, but the problem was not solved

解决了，非常感谢
---Original---
From: @.>
Date: Sat, Feb 18, 2023 18:53 PM
To: @.>;
Cc<EMAIL_ADDRESS>Subject: Re: [PullRequestInc/go-gpt3] context deadline exceeded(Client.Timeout or context cancellation while reading body) (Issue #21)
Had the same issue, and made a backend called the Completion API 3 times in the same call. It was getting timed out. The default HTTP client provided has a timeout of 30 seconds
Making a custom HTTP client and setting a longer timeout solved it.
// passing a custom http client with a timeout of 600 seconds // this is required because the default http client has a timeout of 30 seconds httpClient := &http.Client{       Timeout: time.Duration(600 * time.Second), } client := gpt3.NewClient(apiKey, gpt3.WithHTTPClient(httpClient))
hello
Still return “context deadline exceeded (Client.Timeout or context cancellation while reading body)”
I used streaming call（client.CompletionStreamWithEngine）, but the problem was not solved
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: @.***>

解决了，非常感谢
…
---Original--- From: @.> Date: Sat, Feb 18, 2023 18:53 PM To: @.>; Cc<EMAIL_ADDRESS>Subject: Re: [PullRequestInc/go-gpt3] context deadline exceeded(Client.Timeout or context cancellation while reading body) (Issue #21) Had the same issue, and made a backend called the Completion API 3 times in the same call. It was getting timed out. The default HTTP client provided has a timeout of 30 seconds Making a custom HTTP client and setting a longer timeout solved it. // passing a custom http client with a timeout of 600 seconds // this is required because the default http client has a timeout of 30 seconds httpClient := &http.Client{ Timeout: time.Duration(600 * time.Second), } client := gpt3.NewClient(apiKey, gpt3.WithHTTPClient(httpClient)) hello Still return “context deadline exceeded (Client.Timeout or context cancellation while reading body)” I used streaming call（client.CompletionStreamWithEngine）, but the problem was not solved — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

你好，请问你的是流式调用么


Unexpected Unit in Result-Monad after a function returns null

Describe the bug
When an asynchronous function returns null I expect either null to be the value or that the Result turns into a failure, but Unit is returned.
To Reproduce
Steps to reproduce the behaviour:

Go to https://stackblitz.com/edit/typescript-tp3pbw?file=index.ts
Check the code
Have a look at the preview website, where Unit is printed.

Expected behaviour
I expect either null to be the value or that the Result turns into a failure
Screenshots

Function resolves null
Expecting Value to be null and checking for it in ensure
Since Unit is returned, .ensure has no effect.

This issue is in ResultAsync.from (https://github.com/seangwright/typescript-functional-extensions/blob/main/src/resultAsync.ts#L57)
If the value in the Promise isn't a Result<T>, then ResultAsync.from initializes its internal Result with Result.success which guards against null or undefined values for success with an isSome(value) check. In this specific case Result.success can actually return a failure for null or undefined.
The internal state of a Result is typed with:
type ResultState<TValue, TError> = {
  value: Some<TValue> | undefined;
  error: Some<TError> | undefined;
};

This means value cannot be null.
I think the issue behind all this is that Result has no from (it forces the caller to use either success or failure) but ResultAsync has a from which doesn't force the caller to declare if the value is a success or failure value, so it assumes all undefined/null/voidvalues are failure and any other value is asuccess`.
Either ResultAsync.from should be removed or the caller should be forced to declare the success/failure state of the passed value. But in the 2nd case, ResultAsync.success and ResultAsync.failure already exist, so those should instead be improved to accept Promise<T>.

@GregOnNet Coming back to this after looking at the types for #24 ... maybe the better approach is to do this:
function serviceReturningNothing: Promise<Maybe<string>> {
	return Promise.resolve(Maybe.none<string>());
}


[FLINK-19317] Make EventTime the default TimeCharacteristic

What is the purpose of the change
This is part of http://s.apache.org/FLIP-134 (Batch execution for the DataStream API).
Brief change log
Please look at each commit message which describes in detail what is happening.
In commit no 1 I also change all usage of timeWindow() to use explicit processing-time or event-time windows. For this, I temporarily removed timeWindow() from the  API and made sure everything compiles afterward. You can follow the process because I still left the removal and the revert of the removal in the commits.

commit no 1: make EventTime the new default: here I need to fix some tests which assumed the previous default behaviour
commit no 2: undo temporary removal of timeWindow()
commit no 3: remove unnecessary calls to setStreamTimeCharacteristic (java). I'm removing almost all calls because we're planning to deprecate/remove the method
commit no 4: remove unnecessary calls to setStreamTimeCharacteristic (scala)
commit no 5: update docs for default changes, here I remove almost all (all?) mentions of the time characteristic
commit no 6: deprecate setStreamTimeCharacteristic, this also adds a good deprecation message

Verifying this change
Existing tests cover the changes.
Does this pull request potentially affect one of the following parts:

Dependencies (does it add or upgrade a dependency): no
The public API, i.e., is any changed class annotated with @Public(Evolving): yes
The serializers: no
The runtime per-record code paths (performance sensitive): no
Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: no
The S3 file system connector: no

Documentation
I fix the javadocs, introduce a good deprecation text for setStreamTimeCharacteristic() and update the docs.

Just out of curiosity I tried compiling the PR at the first commit: ef08687adc7a466241050fe452d75a8cd80ebd28 and it fails for TimeWindowTranslationTest

BTW, I forgot to mention I really liked commit messages!

@aljoscha I am also looking at the PR now, but I was wondering if we can deprecate the TimeCharacteristic given that we still use it in the StreamConfig to determine stuff on the cluster side, e.g. the SourceContext.

Thanks for the reviews!
@dawidwys I didn't try removing setStreamTimeCharacteristic but I manually checked the references. There are a couple of clusters where it's still used:

tests that verify explicit behaviour based on the characteristic, for example in the Table Planner tests or the time window translation tests
CEP tests, but there's a follow-up issue for addressing that: https://issues.apache.org/jira/browse/FLINK-19326
time interval join (tests), unfortunately they also magically change behaviour based on the characteristic: https://issues.apache.org/jira/browse/FLINK-19479

@kl0u I'm also torn on deprecating TimeCharacteristic because we still use it internally. I did deprecate it because that's the message we want to send. What do you think?

@aljoscha No problem for the deprecation if you disagree. My only point was that I think that the message to the user to not set the time characteristic is sent by deprecating the setTimeCharacteristic().

Regarding TimeCharacteristic: I think that is the right message, I don’t want devs to use it because we should also remove it eventually.


fix: add global

can be removed when this is fixed: https://github.com/koumoul-dev/vuetify-jsonschema-form/issues/350


[feature request] Add template prop: tag to Vue components

Hi @Barbapapazes, are you open to extending the Vue components with dynamic components? Personally, I prefer to avoid deeply nested HTML tags. In this regard, I would like to propose adding a new optional property: tag, to facilitate the creation of dynamic components and to prevent unnecessary nesting of items.
If you agree I may create a PR. Let me know.

Hey @maartenvanhunsel 👋,
This is a great idea but instead of using tag, I would prefer as to align with components library.
Do you mind open a PR? Thanks 🙌


Get rid of event system

In retrospect, using a flexible event system was not a good idea.
Using a dynamic event-driven approach for everything...

makes code very unreadable and confusing
makes it difficult to figure out or troubleshoot "when A happens, B will happen"
is still an interesting concept, somehow specifying "business requirements" in code is still intriguing to me (No I don't mean Cucumber. In the actual application, not just in tests)

Should be easier with The Big Refactoring™ #302

Using Koin can be an option: https://insert-koin.io/

Using SharedFlows would be similar to an event system but would be more Kotlin-ic. And would make supporting multiple coroutines/threads easier.


Inline option doesn't work

When insert the option
...
inline: ['someChunk', 'manifest']
...
The script crashes:
TypeError: Cannot read property 'src' of undefined

common.js:10 getRawScriptName
[frontend-dashboard]/[script-ext-html-webpack-plugin]/lib/common.js:10:47

Approve please the pullRequest https://github.com/numical/script-ext-html-webpack-plugin/pull/33/commits/00aa0e9d54759e4d401dc51742d579fc762116fa

Sorry - forgot to report this fixed in version 1.8.8.
Thanks for the fix and huge apologies for the looong delay.


Fixed haskellngPackages.snaplet-acid-state

cc @peti

Please don't merge it, since snaplet-acid-state author released a patched version.


returns requestId for each broker query request

what's the problem?
Return a unique requestId always is important for tracing/debugging, to find related logging events for example. There're some limitation at the moment:

it's not available to every queries in broker, onlyMultiStageBrokerRequestHandler generates one and included in BrokerResponseNativeV2;
In java-client, org.apache.pinot.client.BrokerResponse is a reduced set of org.apache.pinot.common.response.BrokerResponse, requestId is lost with many other metadata fields;

Proposed changes
To address these limitations, I would like to suggest some changes as below:

generate requestId in PinotClientRequest.java, and add a new field requestId in org.apache.pinot.common.response.BrokerResponse;
remove org.apache.pinot.client.BrokerResponse and use  response.BrokerResponse directly;

Broker request id is generated within the BrokerRequestHandler, and I think we can keep it this way, but include it in the org.apache.pinot.common.response.BrokerResponse.
Seems org.apache.pinot.client.BrokerResponse was introduced to avoid dependency on pinot-common, but the module already has dependency on pinot-common so we may remove it. We need to be cautious about backward compatibility though.
@mingmxu Do you want to help contribute this?

surely will submit a PR on it. The requestId can be generated and set in BrokerResponse at method org.apache.pinot.broker.requesthandler.BaseBrokerRequestHandler#handleRequest(), using MultiStageRequestIdGenerator as the default one for both v1/v2.
I'll add a new requestId field in org.apache.pinot.client.BrokerResponse for now. Consolidating org.apache.pinot.client.BrokerResponse and org.apache.pinot.common.response.BrokerResponse would move to the next PR.


Dashboard still showing unopened requests

Fix is tested locally. Waiting for push to dev then test env.


query() is now unusable?

After updating to latest typst, I get the following error when using query:
error: missing argument: location
    ┌─ doc\_00-template.typ:226:24
    │
226 │     let elements = query(heading, after: loc)
    │

According to the documentation for the location parameter:

Only one of this, before, and after shall be given.

So, location is now mandatory but it should not be given together with before or after? So before and after are unusable? What is the correct new usage of query to match the line above?

The documentation is not yet fully up to date. You should write:
let elements = query(selector(heading).after(loc), loc)
It's a bit duplicate with the location in this case, but its a lot more flexible than before, because you can arbitrarily combine before and after restrictions with other selectors.

I changed to simply query(heading, loc) which is equivalent here I guess? Seems to work for now, but thanks for the clarification.

@Holt59 No, it is not equivalent. query(heading, loc) will not query after the current location, but the entire document including the current context. If you e.g. use it in a table of contents (TOC), the TOC itself will be contained in the TOC.

@Holt59 No, it is not equivalent. query(heading, loc) will not query after the current location, but the entire document including the current context. If you e.g. use it in a table of contents (TOC), the TOC itself will be contained in the TOC.

Thanks for the clarification, I'm not using a heading for my TOC so that's ok for now but good to know for future documents.


Music player should reset status and clear playlist when dismissed

When the bot leaves a music channel when using /music leave it does not reset its playlist and clears the paused status

Hopefully fixed by #126.


[WIP] Remove sh depedency

This removes sh package dependency.
This should solve #11.

The last thing I need to work through is making  _run_command() python 2 compatible.


#2081 bug fixs

Fixes #ISSUSE_ID.
Changes proposed in this pull request:

Pull Request Test Coverage Report for Build 7375

0 of 12 (0.0%)  changed or added relevant lines in 5 files are covered.
4 unchanged lines in 2 files lost coverage.
Overall coverage decreased (-0.02%) to 54.228%

Changes Missing Coverage
Covered Lines
Changed/Added Lines
%

sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/SQLSegmentsExtractorEngine.java
0
1
0.0%

sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/constant/SQLType.java
0
2
0.0%

sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/parser/sql/GeneralSQLStatement.java
0
2
0.0%

sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/parser/SQLParserEngine.java
0
3
0.0%

sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/AntlrParsingEngine.java
0
4
0.0%

Files with Coverage Reduction
New Missed Lines
%

sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/parser/SQLParserEngine.java
1
0.0%

sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/AntlrParsingEngine.java
3
0.0%

Totals

Change from base Build 7373:
-0.02%

Covered Lines:
8459

Relevant Lines:
15599

💛  - Coveralls


Confusion with "Extension bundles for local development"

Hello! I would like to make a small suggestion for the section named "Extension bundles for local development"
When working with a C# class library, this step actually causes issues. I think this is mostly because it is unclear whether or not you are supposed to follow these steps in addition to the steps listed under "C# class library". May I recommend added some copy that says something to clear this up? I would really appreciate it :)
Thank you!

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: 5fb82e02-5c41-239b-4903-aab80ff15215
Version Independent ID: 38f1c69b-f7af-5e13-1cdc-b6b7053d2f7b
Content: Register Azure Functions binding extensions
Content Source: articles/azure-functions/functions-bindings-register.md
Service: azure-functions
GitHub Login: @craigshoemaker
Microsoft Alias: cshoe

@APIWT Thank you for your feedback! We will review and provide an update as appropriate.

No problem. Thank you very much!

@APIWT - I updated the article to be a little more clear. I will ask to #please-close at this point, but please feel free to re-open if you think it needs more work.
Thanks for your feedback!


Bump minimum version to 2.3

Think framework-bundle is the only dependency we need, see https://github.com/symfony/framework-bundle/blob/master/composer.json
Removed .lock file because this is a bundle and not a project on it's own. Hope that .travis config is valid :+1:

:+1:

Good. I just discovered the phpunit.xml my self.
I will merge as soon the tests passes

Wow, this tested way more that I expected.
Btw, I fixed the failing tests in #59.
If you revert the changes in phpunit.xml.dist it would be fine.

What do we want to test?
All supported Symfony versions on 5.6 and then test all php versions on Symfony 2.8?

I think this is fine. The rest is fixed in #59. Im going to merge this.

The number of test matrix entries now look good to me, since we bumped php to 5.5 you should remove 5.3 and 5.4 from the .travis options. :+1:


Don't assume enums are exhaustive

We currently have code like this:
#[derive(Debug, Eq, PartialEq, Clone, Deserialize_repr, Serialize_repr)]
#[repr(u8)]
pub enum SignatureHelpTriggerKind {
    Invoked = 1,
    TriggerCharacter = 2,
    ContentChange = 3,
}

the problem is that if the client implements a protocol extension and send 4, this will completely prevent deserialization, instead of graceful degradation. We should do the following instead
#[serde(transparent)]
pub struct SignatureHelpTriggerKind(u8);
impl SignatureHelpTriggerKind {
    pub const Invoked = SignatureHelpTriggerKind(1);
    pub const TriggerCharacter = SignatureHelpTriggerKind(2);
    pub const ContentChange = SignatureHelpTriggerKind(3);
}

We already do this for some string-based enums:
https://github.com/gluon-lang/lsp-types/blob/7801115725943a002ae271a495123318e88b4c19/src/semantic_tokens.rs#L18

That sounds like a good plan.

Short term, I think doing refactor like the one in https://github.com/gluon-lang/lsp-types/issues/213#issue-989190158 is the way to go.
Long-term, someone has to write lsp.d.ts file along the lines of vscode.d.ts, so that we can just generate the whole thing instead of manually duplicating the info from markdown files.
I think it needs:

manual or semi-automated "parsing" of LSP markdown spec into lsp.d.ts file
writing some TypeScript code to parse that d.ts and to emit some language-independent JSON (more or less serializing TS AST into JSON)
writing some Rust code to convert from JSON to serde structs

Ideally, this should be done in the protocel iteslf, but there was very little motion on this upstream: https://github.com/microsoft/language-server-protocol/issues/67.
So, organizationally, I think it makes most sense for us to do all the work ourselves, and than just ask upstream if they are willing to pull.

@archseer not really. First of all, it would prevent users from defining protocol extensions, because you wouldn't be able to make new enum variants. Second, I don't know if serde knows can deal with those. What might have worked was something like:
#[repr(u8)]
enum Foo {
    Bar = 1,
    Baz = 2,
    #[serde(other)]
    Extension(u8) = 3,
}

but I don't think #[serde(other)] works like that, and custom discriminants on tuples isn't stable anyway.


retry on nsx v errors

Rescued Unknown: Failed to add VM to Security Group with unknown NSX error: '<?xml version="1.0" encoding="UTF-8"?>
<error>Concurrent object access error. Refresh UI or fetch the latest copy of the object and retry the operation.<errorCode>101</errorCode></error>'. backtrace: /var/vcap/packages/vsphere_cpi/lib/cloud/vsphere/nsx.rb:42:in `block in add_vm_to_security_group'
/var/vcap/packages/vsphere_cpi_ruby/lib/ruby/gems/2.2.0/gems/bundler-1.15.0/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
I, [2017-12-04T17:17:11.315955 #24487]  INFO -- [req_id cpi-532525]: Failed to apply NSX properties to VM 'vm-4b4c07e2-7683-4ae8-bbc2-33f999bb9eb0' with error: Failed to add VM to Security Group with unknown NSX error: '<?xml version="1.0" encoding="UTF-8"?>
<error>Concurrent object access error. Refresh UI or fetch the latest copy of the object and retry the operation.<errorCode>101</errorCode></error>'

fixed by https://github.com/cloudfoundry-incubator/bosh-vsphere-cpi-release/commit/1d5a5c4d97abbed9fdb98a8cf6d4a6b725078198

Fixed in Version 46.


implement filter and column pushdown

We should implement filter and column pushdown once they land in go-mysql-server.
I don't think we have any computationally expensive columns yet, so we shouldn't care much about column pushdown, but we should about filter pushdown, which can reduce a lot the amount of data sent.

Filters are now implemented (not merged, though) in https://github.com/src-d/go-mysql-server/pull/86


xray doesnt work

The bug occurs without having Optifine or Optifabric installed? (Optifine bugs won't be fixed)

[ ] Yes, I don't have Optifine install.

Mod version
1.19.2
Minecraft version
1.19.2
Mod loader
Forge
Description of the issue
when i turn on xray, it just makes fullbright and thats all
Excepted behavior
i was excepting to see all the ores
Obtained behavior
xray didnt work at all

How to reproduce

step 1: i dont know, didnt work from the start

Do I want to contribute to fix it?
No
Something else?
No response

I'm using this on version 1.19.4 and i've noted that it works in 1.19.3, however it doesn't work properly on 1.19.4, i can see through walls but only uncovered block faces are visible, Xray Ultimate is able to reveal concealed blocks.


json generation fails

Dear InCTRL-Team @GuansongPang @Diana1026,
I wanted to set up your project on my own machine but bumped into an error.
When using your command in the Terminal
python gen_val_json.py --dataset_root=./visa_anomaly_detection/visa --dataset_name=candle
It says that the argument is not found. Quick look into the code and there is no dataset_name argument there.
What is the fix to my problem?
Best regards

Hi, the --dataset_name is in lines 12-13 of gen_val_json.py, please check it.

Dear InCTRL-Team @GuansongPang @Diana1026,
I wanted to set up your project on my own machine but bumped into an error. When using your command in the Terminal python gen_val_json.py --dataset_root=./visa_anomaly_detection/visa --dataset_name=candle  It says that the argument is not found. Quick look into the code and there is no dataset_name argument there. What is the fix to my problem?
Best regards

For me I had to change --dataset_root  and use  --dataset_dir instead.

When I change it to --data_dir it throws an error:
FileNotFoundErrpr: [Errno 2] No such file or directory: './datasets/AD_json/candle_val_normal.json
What should i do next?

Dear InCTRL-Team @GuansongPang @Diana1026,
I wanted to set up your project on my own machine but bumped into an error. When using your command in the Terminal python gen_val_json.py --dataset_root=./visa_anomaly_detection/visa --dataset_name=candle  It says that the argument is not found. Quick look into the code and there is no dataset_name argument there. What is the fix to my problem?
Best regards

For me I had to change --dataset_root and use --dataset_dir instead.

Yes, thank you for your reminder. I have fixed the command.

@Diana1026 You are welcome :) I hope you can answer my question about : how to test your model on one image , i tried different methods but I was unable to do it :(

When I change it to --data_dir it throws an error: FileNotFoundErrpr: [Errno 2] No such file or directory: './datasets/AD_json/candle_val_normal.json
What should i do next? @baraa-m

first you should run
python convert_visa.py --dataset_root=./AD_json/visa
before

When I change it to --data_dir it throws an error: FileNotFoundErrpr: [Errno 2] No such file or directory: './datasets/AD_json/candle_val_normal.json
What should i do next? @baraa-m

If it's not the case, you have to execute :
python convert_visa.py --dataset_root=./AD_json/visa
before doing:
python gen_val_json.py --dataset_dir=./visa_anomaly_detection/visa --dataset_name=candle


Make seqrepo archive available in public bucket over unauthenticated http

Could also provide an alternate to seqrepo pull that streams it to the local filesystem and unpacks it

It's now in a public bucket. It can be downloaded and used by unpacking into the default seqrepo dir /usr/local/share/seqrepo/<version> or somewhere else and using the environment variable SEQREPO_ROOT_DIR (or whatever it is) to point a project to it.


Use NamedArgumentConstructorAnnotation as an extra condition in Instantiator\Factory

Q
A

Bugfix?
❌

Breaks BC?
❌

New feature?
✔

Using NamedArgumentConstructorAnnotation interface as a marker is deprecated since doctrine/annotations:1.12, so here is an additional check

The first approval came from my mistake. I have not looked or analyzed specific use cases for this functionality.
Note that the intantiator emulates the behavior of the doctrine constructor when using attributes for easier transition from the old syntax.
I think that in general, it makes sense to replace all the code with:
// constructor
if (class_exists(DoctrineAnnotationReader::class)) {
    $this->reader = new SpiralAnnotationReader();
}

// isNamedArguments function
if (is_subclass_of($class->getName(), NamedArgumentConstructorAnnotation::class)) {
    return true;
}

if ($this->reader !== null) {
    // Try detect constructor type using annotation
}

?

Merged here: https://github.com/spiral/attributes/pull/2
P.S. This branch that you are using is not relevant yet, because the package is distributed separately. And although it is in release, it is not stable and has not been merged into the main framework branch.

Thanks. Sorry for late response, haven't had a moment to fix PR this week


Opaque cursor

Hi,
GraphQL.org suggests having opaque cursors for pagination. They encourage a base 64 encoding.

As a reminder that the cursors are opaque and that their format should not be relied upon, we suggest base64 encoding them.
- https://graphql.org/learn/pagination/

I currently use the following for my pet project
pub struct Base64Cursor<A>(pub A);

impl<A: CursorType> CursorType for Base64Cursor<A> {
    type Error = String;

    fn decode_cursor(s: &str) -> Result<Self, Self::Error> {
        base64::decode_config(s, base64::URL_SAFE_NO_PAD)
            .ok()
            .as_ref()
            .and_then(|s| std::str::from_utf8(s).ok())
            .and_then(|c| A::decode_cursor(c).ok())
            .map(|a| Base64Cursor(a))
            .ok_or_else(|| "Unable to parse cursor".to_owned())
    }

    fn encode_cursor(&self) -> String {
        self.0
            .encode_cursor()
            .pipe(|cursor| base64::encode_config(cursor, base64::URL_SAFE_NO_PAD))
    }
}

My implementation builds on top of CursorType, but it could use Serde's Serialize and Deserialize. Possibly something like the following:
// WIP, won't compile
impl<A: Serialize + Deserialize> CursorType for A {
    type Error = ???;

    fn decode_cursor(s: &str) -> Result<Self, Self::Error> {
        base64::decode_config(s, base64::URL_SAFE_NO_PAD)
            .and_then(|s| serde_json::from_str(s))
    }

    fn encode_cursor(&self) -> String {
        serde_json::to_string(self)
            .and_then(|json| base64::encode_config(json, base64::URL_SAFE_NO_PAD))
    }
}

While this is one idea, another option is to use cbor as it is already included in this project.
Would there be any objections if I opened a PR to change CursorType's encode_cursor and decode_cursor? I am open to any encoding if base64 isn't preferred.

I posted about this a while back and one of the folks at Vector, @leebenson,  posted a link to their open source code that solved 99% of the problems I was trying to solve. Maybe this will help you?
https://github.com/vectordotdev/vector/blob/master/src/api/schema/relay.rs
I just came back to this trying to update my async-graphql v3 -> v4 relay spec and they did it already 😂 Literally life savers doing the best work.

Hey,
Thank you for the link. While I saw the code previously, I wasn't particularly happy with the hard coded type, usize. I preferred a generic approach.
I also believe that a bundled solution would allow everyone to benefit from it.
Anyways, I have a solution for my problem. If someone wishes, I can easily create a PR.

I would be interested in seeing your solution 😄  While I'm not a maintainer of this repo, I think PR's are always welcome and at the very least provide a searchable resource for people in similar situations.

This feature has been released