Word convention for JSON

Sometimes it matters which word convention do you use.
For example, in some projects it is a rule to use only snake_case in json properties.
Now we do not have any options for the problem. I suggest to add some flag for word convention.

What are you planning on controlling with such a flag? You can already control which fields to use by using struct tags or naming your input variables to service functions.
As for the fields in the JSON RPC response itself, the names has to follow the JSON RPC spec.

@smyrman , the JSONRPC spec does not specify json word convention.
lowerCamelCase variant:
--> {"jsonrpc": "2.0", "method": "someMethod", "params": {"someParam": 23, "someOtherParam": 42}, "id": 3}
<-- {"jsonrpc": "2.0", "result": 19, "id": 3}

snake_case variant:
--> {"jsonrpc": "2.0", "method": "some_method", "params": {"some_param": 23, "some_other_param": 42}, "id": 3}
<-- {"jsonrpc": "2.0", "result": 19, "id": 3}

The both are possible by the spec. The both are usable. But only one works now.

Sorry for being unclear, I was referring to the reserved words (jsonrpc, method, params, result, error). But I guess all of these (except jsonrpc) are single words.
But to achive what you want, you should be able to do the following?
func (srv *Service) Some_method(some_param, some_other_param int) (*int, *zenrpc.Error) {
}

Not saying this is nice in Go, but you could solve that by letting the service method become a thin wrapper for your actual (private) method with propper naming.
And for nested data-structures, rely on json-tags.

Thank you so much for such tricks, @smyrman.
As you mention, it is technically possible to solve the problem using current state of zenrpc, but I believe we can improve zenrpc and make it more convenient and less tricky.

This feature is available in my old pr and can be easily copied to some fork.


ElectronicStructureProblem might generate a redundant operator

What is the expected enhancement?
ElectronicStructureProblem of main branch generates a redundant operator than that by stable though they are identical from matrix perspective. Because the operator is larger, qubit mapping takes more time with main branch than stable.
I think we need to apply reduce somewhere.
from qiskit_nature.drivers import Molecule
from qiskit_nature.drivers.second_quantization import ElectronicStructureDriverType, \
    ElectronicStructureMoleculeDriver
from qiskit_nature.problems.second_quantization import ElectronicStructureProblem

h2_geometry = [('H', [0, 0, 0]), ('H', [0, 0, 1])]

molecule = Molecule(geometry=h2_geometry, charge=0, multiplicity=1)
driver = ElectronicStructureMoleculeDriver(molecule, basis="sto3g",
                                           driver_type=ElectronicStructureDriverType.PYSCF)
es_problem = ElectronicStructureProblem(driver)
second_q_op = es_problem.second_q_ops()
lst = sorted(second_q_op[0].to_list(display_format="dense"), key=lambda e: e[0])
print(f'size {len(lst)}')
for op in lst:
    print(op)
print("\nmatrix")
print(second_q_op[0].to_matrix())

main
size 28
('+-+-', (0.09839529174273506+0j))
('+-+-', (0.09839529174273506+0j))
('+--+', (-0.0983952917427351+0j))
('+--+', (-0.09839529174273509+0j))
('-++-', (-0.09839529174273509+0j))
('-++-', (-0.0983952917427351+0j))
('-+-+', (0.09839529174273512-0j))
('-+-+', (0.09839529174273512-0j))
('IIIN', (-0.589121003706083+0j))
('IINI', (-1.1108441798837272+0j))
('IINN', (-0.0983952917427351+0j))
('IINN', (0.31085338155985665+0j))
('IINN', (0.31085338155985653+0j))
('IINN', (-0.09839529174273509+0j))
('INII', (-0.589121003706083+0j))
('ININ', (0.326535373471287+0j))
('ININ', (0.326535373471287+0j))
('INNI', (0.31085338155985653+0j))
('INNI', (0.31085338155985665+0j))
('NIII', (-1.1108441798837272+0j))
('NIIN', (0.31085338155985665+0j))
('NIIN', (0.31085338155985653+0j))
('NINI', (0.3132012497647589+0j))
('NINI', (0.3132012497647589+0j))
('NNII', (-0.0983952917427351+0j))
('NNII', (0.31085338155985665+0j))
('NNII', (0.31085338155985653+0j))
('NNII', (-0.09839529174273509+0j))

matrix
  (1, 1)	(-0.589121003706083+0j)
  (2, 2)	(-1.1108441798837272+0j)
  (3, 3)	(-1.275049003955567+0j)
  (4, 4)	(-0.589121003706083+0j)
  (5, 5)	(-0.525171260469592+0j)
  (10, 5)	(0.19679058348547013+0j)
  (6, 6)	(-1.078258420470097+0j)
  (9, 6)	(0.19679058348547018-0j)
  (7, 7)	(-0.5893924975993629+0j)
  (8, 8)	(-1.1108441798837272+0j)
  (6, 9)	(0.19679058348547018-0j)
  (9, 9)	(-1.078258420470097+0j)
  (5, 10)	(0.19679058348547024+0j)
  (10, 10)	(-1.5952858602379365+0j)
  (11, 11)	(-1.137783921190063+0j)
  (12, 12)	(-1.275049003955567+0j)
  (13, 13)	(-0.5893924975993629+0j)
  (14, 14)	(-1.137783921190063+0j)
  (15, 15)	(-0.02721123519961588+0j)

stable/0.3
size 14
('+-+-', (0.19679058348547013+0j))
('+--+', (-0.19679058348547018+0j))
('-++-', (-0.19679058348547018+0j))
('-+-+', (0.19679058348547024+0j))
('IIIN', (-0.589121003706083+0j))
('IINI', (-1.1108441798837272+0j))
('IINN', (0.424916179634243+0j))
('INII', (-0.589121003706083+0j))
('ININ', (0.653070746942574+0j))
('INNI', (0.6217067631197132+0j))
('NIII', (-1.1108441798837272+0j))
('NIIN', (0.6217067631197132+0j))
('NINI', (0.6264024995295178+0j))
('NNII', (0.424916179634243+0j))

matrix
  (1, 1)	(-0.589121003706083+0j)
  (2, 2)	(-1.1108441798837272+0j)
  (3, 3)	(-1.275049003955567+0j)
  (4, 4)	(-0.589121003706083+0j)
  (5, 5)	(-0.525171260469592+0j)
  (10, 5)	(0.19679058348547013+0j)
  (6, 6)	(-1.078258420470097+0j)
  (9, 6)	(0.19679058348547018-0j)
  (7, 7)	(-0.5893924975993629+0j)
  (8, 8)	(-1.1108441798837272+0j)
  (6, 9)	(0.19679058348547018-0j)
  (9, 9)	(-1.078258420470097+0j)
  (5, 10)	(0.19679058348547024+0j)
  (10, 10)	(-1.5952858602379365+0j)
  (11, 11)	(-1.137783921190063+0j)
  (12, 12)	(-1.275049003955567+0j)
  (13, 13)	(-0.5893924975993629+0j)
  (14, 14)	(-1.137783921190063+0j)
  (15, 15)	(-0.02721123519961588+0j)

I notice that FermionicOp.reduce may generate an operator with a larger size due to normal_order. See the second example of #586. In the example the size grows from 1000 to 18950 by applying reduce.

I notice that FermionicOp.reduce may generate an operator with a larger size due to normal_order.

Based on this I assume that this is (at least partially) related to #551. I have not had time to check out your proposed PR yet though..

I would like to suggest the following "fix" of this issue:
Since we would like to retain the sparsity information, the current behavior for the display_format="sparse" case is as intended. However, I suggest that the FermionicOp._to_dense_label_data() method should internally call FermionicOp.simplify(). This will retain the original behavior in the display_format="dense"` case.
In addition to that, we should act on this https://github.com/Qiskit/qiskit-nature/blob/b75742f46f6eaa255023f85c58729e09d4641add/qiskit_nature/operators/second_quantization/fermionic_op.py#L250-L259
and change the default display_format from dense to sparse, since we are about to release version 0.4
If we do the latter, I actually wonder whether the former would be needed at all? :thinking:
@t-imamichi @woodsp-ibm What do you think?

It sounds good. If we call _to_dense_label_data within simplify, the number of operators is reduced from 28 to 14.
        for label, coeff in self._to_dense_label_data():
            data[label] += coeff

I'm fine to change the default display_format too.

@t-imamichi would you mind opening a PR for these two changes?


zipkin-collector-service is better configurable

Allow more configuration options to be configurable through
environment variables.
Especially being able to easily configure log level, sample rate
and number of queue workers is crucial for us.

In our current zipkin setup we tweak log level (default debug level logs way too much), queue num workers and sample rate.  By using environment variables it means we also can configure these options when using docker-zipkin.

If the environment variables are not specified I use the current default values. So there will be no change in behavior if you don't configure the options.

:+1:, maybe could use some simple docs?

@jamescway Agree. I updated README.md with explanation of the new configurable parameters.

looks great :)


Gate servo/servo PRs on the community-tc deployment of Taskcluster

… in addition to the legacy deployment, for now. That one will be removed after the transition is finished.
CC https://bugzilla.mozilla.org/show_bug.cgi?id=1574648

This should only be deployed after https://github.com/servo/servo/pull/24662 lands.

@bors-servo r+

:pushpin: Commit 7cb09d0 has been approved by jdm

:hourglass: Testing commit 7cb09d0d8c41f2fe41928382bf893e1d3cd872af with merge 0ed0349a9b96f0ec9dd33be33e38fb601f1424bf...

:sunny: Test successful - checks-travis
Approved by: jdm
Pushing 0ed0349a9b96f0ec9dd33be33e38fb601f1424bf to master...

@jdm Could you help with deploying this? https://github.com/servo/servo/pull/24662 has landed. I ran Salt with test=True on servo-master but didn’t dare do more since it showed a number of unrelated changes.

Alright, after filtering it down (salt 'servo-master1' state.apply homu) and enabling /tmp/salt-testing-root this looked better. The only unexpected change was:
Python package git+https://github.com/servo/homu@78dbd0be5dc1739787eaa2b9df858d736aa7aa4b is set to be installed

… which is hopefully harmless enough. It is still marked as to be done when running again with test=True, so I assume that Salt doesn’t realize this is already up to date.


Annotation is removed on click

Hello,
I'm currently trying the annotorious-openseadragon plugin, and if I try to click on an w3c annotation that was generated from a geojson shape, it removes the annotation and crashes with the following error:

Here's an example of the w3c annotation that I load via loadAnnotations:
[
  {
    "@context": "http://www.w3.org/ns/anno.jsonld",
    "body": [
      {
        "type": "TextualBody",
        "value": "someclass"
      }
    ],
    "created": null,
    "creator": null,
    "id": "anno-someclass-84140eb0-9b1b-44b6-b579-3d75b65c6ea2",
    "motivation": "classifying",
    "target": {
      "selector": {
        "type": "SvgSelector",
        "value": "<svg><path d=\"M 6267.0,11935.0 L 6269.0,11930.0 L 6271.0,11926.0 L 6272.0,11923.0 L 6273.0,11920.0 L 6274.0,11919.0 L 6275.0,11918.0 L 6276.0,11917.0 L 6277.0,11916.0 L 6279.0,11915.0 L 6280.0,11914.0 L 6281.0,11913.0 L 6282.0,11913.0 L 6283.0,11913.0 L 6285.0,11913.0 L 6286.0,11915.0 L 6288.0,11917.0 L 6289.0,11918.0 L 6290.0,11920.0 L 6292.0,11922.0 L 6293.0,11925.0 L 6295.0,11927.0 L 6296.0,11929.0 L 6297.0,11930.0 L 6298.0,11932.0 L 6299.0,11934.0 L 6300.0,11936.0 L 6302.0,11937.0 L 6303.0,11939.0 L 6304.0,11940.0 L 6305.0,11941.0 L 6306.0,11943.0 L 6307.0,11944.0 L 6309.0,11945.0 L 6310.0,11946.0 L 6311.0,11948.0 L 6312.0,11950.0 L 6313.0,11951.0 L 6313.0,11953.0 L 6313.0,11955.0 L 6313.0,11957.0 L 6313.0,11958.0 L 6312.0,11959.0 L 6311.0,11961.0 L 6310.0,11962.0 L 6309.0,11963.0 L 6307.0,11964.0 L 6306.0,11965.0 L 6304.0,11966.0 L 6302.0,11966.0 L 6300.0,11966.0 L 6298.0,11965.0 L 6296.0,11965.0 L 6293.0,11964.0 L 6291.0,11963.0 L 6290.0,11963.0 L 6288.0,11962.0 L 6287.0,11961.0 L 6285.0,11959.0 L 6284.0,11957.0 L 6283.0,11955.0 L 6281.0,11953.0 L 6280.0,11951.0 L 6278.0,11949.0 L 6276.0,11947.0 L 6275.0,11945.0 L 6273.0,11943.0 L 6271.0,11941.0 L 6269.0,11939.0 L 6268.0,11937.0 L 6267.0,11936.0 L 6267.0,11935.0 z\" /></svg>"
      }
    },
    "type": "Annotation"
  }
]

Any idea why this crashes?
Cheers,
Andreas 😃

Excellent. I'm keeping the issue open (and will rename it later). It's actually a good test case. Annotorious doesn't always play well with annotations generated elsewhere.
Obviously, it can't provide editing tools for all selections possible. But since it's all just SVG, it should just keep the shape (in non-editable form) and don't throw errors.


Support AppImage

I think this project is a textbook usecase for App Image. App Image is great for applications that have some external dependencies that some users may not have installed. It also allows the user to run the project on any incompatable Linux system that has App Image.
I am happy to work on this if you think it will be useful.

That would be really great, I'd like to know how to build an App Image for future use too

I closed it for error :sweat_smile: sorry, reopened it

Cool, I have been interested in App Image but have not had a reason to learn. I think this project is a great use case. I will have a PR in the coming days hopefully 👍

Cool, I have been interested in App Image but have not had a reason to learn. I think this project is a great use case. I will have a PR in the coming days hopefully 👍

Very nice to hear, meanwhile I'm trying to alternate between school and between improving the security issues in the cryptografy of the password manager. Btw if you want you can hmu on discord: Gyro#2077

@jsirianni how is the development going?

Turns out it is more work than I thought. I am having trouble packaging dependencies inside the app image. This might be a good place to start https://openbuildservice.org/


Bevy 0.12

Still a work in progress, feedback wanted.

Thanks a lot @haihala for the PR. Given the timeline (Bevy 0.12 released yesterday, I just found out) and the complexity of the change (many new things in asset management and rendering, affecting severely the crate), I went ahead and I'm doing an upgrade on my side. I've looked at the PR, there are a few useful things, but some are incorrect I think (like using AssetId instead of Handle). I'll make a separate PR for the upgrade soon.

See #249


Server setup

Prepare the server to run a PHP application and render HTML files.
The server should listen to port 8000 and 8080 using Apache.
8000 is used for the frontend and 8080 for the backend application.

@raulalmeidatarazona Any timeline for this task?

@moein I need access to the server


Fix the parameters hidden by the deployFromImage checkbox.

A parameter is not allowed affect the visibility of a parameter in a different group box. I was initially overzealous with what deployFromImage would hide, hiding parts of the "copy" group box.


Fix description of won:textMessage

Fixed the description of won:textMessage in the ontology. Also found out why we cannot move it to msg.

ok i understand that hasTextMessage is not allowed in msg due to message validation, merging this pr (@fkleedorfer should i add an issue to replace won:hasTextMessage with some preexisting ontology of schema.org?)


RFE: set log_path to use the fact_caching_connection parent directory

Is your feature request related to a problem? Please describe.
I find it mildly annoying to change log_path in ansible.cfg every time I install a new version of ceph-ansible-*el7cp.noarch (or clone from git).
Describe the solution you'd like
Since fact_caching_connection already writes to the directory $HOME/ansible/facts/, it would be nice if the log path was set to
log_path = $HOME/ansible/ansible.log

The attached patch does just that (tell if you'd rather I fork and pose a MR)
0001-write-ansible.log-to-same-dir-fact_caching_connectio.txt

Not everyone has an ansible user on their system. So setting log_path = $HOME/ansible/ansible.log won't work for everyone.

I don't mind setting log_path to $HOME/ansible/ansible.log, but just asking, why not doing the opposite then? Like fixing fact_caching_connection to a path everyone has ?

fetch_directory: ~/ceph-ansible-keys
gets created during an ansible run, just the first attempt to log fails.
Test log
pcfe@ceph-ansible-rhel7 ~ $ pwd
/home/pcfe
pcfe@ceph-ansible-rhel7 ~ $ ls
pcfe@ceph-ansible-rhel7 ~ $ cd /usr/share/ceph-ansible/
pcfe@ceph-ansible-rhel7 ceph-ansible $ ansible -m ping all
[WARNING]: log file at /home/pcfe/ansible/ansible.log is not writeable
and we cannot create it, aborting

^C
[...]
 [ERROR]: User interrupted execution

pcfe@ceph-ansible-rhel7 ceph-ansible $ cd /home/pcfe/
pcfe@ceph-ansible-rhel7 ~ $ ls
ansible
pcfe@ceph-ansible-rhel7 ~ $ ls ansible/
facts
pcfe@ceph-ansible-rhel7 ~ $ cd /usr/share/ceph-ansible/
pcfe@ceph-ansible-rhel7 ceph-ansible $ ansible -m ping all
^C
[...]
 [ERROR]: User interrupted execution

pcfe@ceph-ansible-rhel7 ceph-ansible $ ls /home/pcfe/ansible/
ansible.log  facts

Since it is recommended to try to ansible -m ping all before running the
site.yml playbook, maybe that is acceptable for you.
In practise only the first ansible or ansible-playbook does not get logged, all subsequent ones can log with the suggested PR.
If not, then I can adjust the pull request to log_path = /var/tmp/ansible.log
pcfe


Adding notes and external extraction (Issue 168)

Tackling issue #168

Add input box "notes" (done)
Add check box "externally extracted" (partial)

It worked in my local system. Maybe there is a trigger to update the database for Travis?

Checkbox added but couldn't figure out how to get this to work with db.

Do you have any other clues about what you mean by this? It may be that you need to add a notes field to the test db. It should be somewhere around this line of populate_test_db.sql. I can help with that when I get back this thursday.

@tanaes In Amanda's pull request this notes field was already added to the database. That was done thru a db patch. But it seemed that Travis doesn't take it..

Checkbox updated but still not working with the database, which does not allow None values being added.

Looks to me like the problem is that the greyed-out 'equipment id' boxes are passing None, and there's currently no scope for them to be None when creating the GDNAExtractionProcess:
AN ERROR HAS OCCURED!
Please copy the following into an issue in our github repository
Error
qiita.equipment with ID 'None' does not exist
Traceback
Traceback (most recent call last):
File "/Users/jonsanders/Development/anaconda/envs/labman/lib/python3.5/site-packages/tornado/web.py", line 1541, in _execute result = method(*self.path_args, **self.path_kwargs)
File "/Users/jonsanders/Development/anaconda/envs/labman/lib/python3.5/site-packages/tornado/web.py", line 2949, in wrapper return method(self, *args, **kwargs)
File "/Users/jonsanders/Development/git_sw/labman/labman/gui/handlers/process_handlers/gdna_extraction_process.py", line 78, in post for pid, kf, ep, ept, kit, p_name, nt in json_decode(plates_info)]
File "/Users/jonsanders/Development/git_sw/labman/labman/gui/handlers/process_handlers/gdna_extraction_process.py", line 78, in for pid, kf, ep, ept, kit, p_name, nt in json_decode(plates_info)]
File "/Users/jonsanders/Development/git_sw/labman/labman/db/base.py", line 40, in __init__ raise exceptions.LabmanUnknownIdError(self._table, id_)
labman.db.exceptions.LabmanUnknownIdError: qiita.equipment with ID 'None' does not exist
Request Info
host_name: localhost
_start_time:<PHONE_NUMBER>.274381
protocol: http
method: POST
query_arguments: {}
_cookies: Set-Cookie: _xsrf=2|14837f86|32227ba985c9822af9064e95e0b9ff1e|1523374667 Set-Cookie: user="2|1:0|10:1525708909|4:user|20:InRlc3RAZm9vLmJhciI=|4cd048d91acd28fdf6aa7925cccb492361f5edcf3759ee1798a44581a6262aaa" Set-Cookie: username-localhost-8889="2|1:0|10:1525466644|23:username-localhost-8889|44:Y2RkOWQ1N2MyMmY1NDY5Yzg0NTBhN2RiYjc1YmViOGI=|f21aed0f04f94d13846652a7d54b7926c15ad5adb681f8ffbad870118a109933" Set-Cookie: username-localhost-8892="2|1:0|10:1525387616|23:username-localhost-8892|44:MDFmM2I1YTdhZjljNGU4YjgxMTAyYTM3MzdmMGRlZmY=|82ce1232b8cdef2e910c548a466bcced68f2e56987bc4b7bb9bd1f7c8e7bc26d"
server_connection:
body_arguments: {'volume': [b'100'], 'extraction_date': [b'05/07/2018'], 'plates_info': [b'[["21",null,null,null,null,"Test plate 1 (gDNA)",""]]']}
connection:
arguments: {'extraction_date': [b'05/07/2018'], 'volume': [b'100'], 'plates_info': [b'[["21",null,null,null,null,"Test plate 1 (gDNA)",""]]']}
body: b'extraction_date=05%2F07%2F2018&volume=100&plates_info=%5B%5B%2221%22%2Cnull%2Cnull%2Cnull%2Cnull%2C%22Test+plate+1+(gDNA)%22%2C%22%22%5D%5D'
host: localhost:8080

@ElDeveloper, @AmandaBirmingham, and thoughts on how best to resolve this? I can think of two possibilities:

Modify the equipment lookup function in this method to check explicitly for None and return an appropriate value (would that be 'Not Applicable'?)
Have a 'Not Applicable' value existing in the database and modify the html interface page to return that specific value when 'Externally extracted' is checked.

What do you think?

Several things:

It appears the actual test that is failing for this PR is https://github.com/jdereus/labman/blob/723133fcb80ed87a0721f1ec0d12204e4f9ec518/labman/gui/handlers/process_handlers/test/test_gdna_extraction_process.py#L36-L40
... because no notes value is being passed in.  Changing the definition of "data" to

        data = {'extraction_date': '01/20/2018', 'volume': 10,
                'plates_info': json_encode(
                    [['21', 11, 6, 15, '157022406', 'new gdna plate',
                      'a note']])}

... makes this test pass, after which all tests pass (at least for me :) .

However, the error Jon pointed out above occurs in the interface--but isn't being surfaced by the tests.  This suggests to me that we need to add another test case for test_post_gdna_extraction_process_handler to exercise the "externally extracted"  path (where plates_info is [["21",null,null,null,null,"Test plate 1 (gDNA)",""]]).
As to how to actually make that externally extracted use case work, I strongly prefer Jon's suggestion 2 above ("Have a 'Not Applicable' value existing in the database and modify the html interface page to return that specific value when 'Externally extracted' is checked.").  I think letting the equipment be None is dangerous.

This should fix the issue! We have gone with suggestion 2 and added a 'None' (aka not applicable) value in the database for equipment and reagent, and the handler and interface are updated accordingly.

This first error is
ERROR: test_comment_well (labman.db.tests.test_process.TestSamplePlatingProcess)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/jdereus/labman/labman/db/tests/test_process.py", line 151, in test_comment_well
    tester.comment_well(8, 1, 'New notes')
  File "/home/travis/build/jdereus/labman/labman/db/process.py", line 290, in comment_well
    self.plate.get_well(row, col).composition.notes = comment
  File "/home/travis/build/jdereus/labman/labman/db/process.py", line 257, in plate
    return plate_module.Plate(plate_id)
  File "/home/travis/build/jdereus/labman/labman/db/base.py", line 40, in __init__
    raise exceptions.LabmanUnknownIdError(self._table, id_)
labman.db.exceptions.LabmanUnknownIdError: qiita.plate with ID 'None' does not exist

@ElDeveloper @tanaes

@qiyunzhu any chance you can run the tests locally and fix the failures? It seems like the errors are happening because of the new "none" types. I would recommend running nosetests -v to see all the local failures. Alternatively you could look at the failures in the travis build.

@ElDeveloper I was not able to run local test using nosetests. It says ImportError: No module named 'mock'. Is there anything I missed?

@qiyunzhu in a terminal window, with your labman conda environment activated, try running
conda install mock

@AmandaBirmingham Thanks for the suggestion! mock was already installed, and I can import mock in the Python environment.

@qiyunzhu Dang!  I got the same failure as you trying to run the unit tests locally, but for me just installing mock in the conda environment made all copacetic.

@AmandaBirmingham I just conda install mock again and it said All requested packages already installed. But then I figured out! What I need is conda install nose.  It is running now!

Can you try conda install nosetests? Looks like the nosetests executable might be installed somewhere else.
Yoshiki Vázquez-Baeza

On May 14, 2018, at 6:55 PM, Qiyun Zhu<EMAIL_ADDRESS>wrote:
@AmandaBirmingham Thanks for the suggestion! mock was already installed, and I can import mock in the Python environment.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@ElDeveloper @AmandaBirmingham Would one of you have time to get another set of eyes on this PR? I pair-programmed this with @qiyunzhu.

Thought I would give you guys a heads up, there are merge conflicts here.

One more Travis issue:
======================================================================
FAIL: test_create (labman.db.tests.test_process.TestGDNAExtractionProcess)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/jdereus/labman/labman/db/tests/test_process.py", line 300, in test_create
    self.assertEqual(obs.notes, 'test note')
AssertionError: None != 'test note'

@tanaes

@qiyunzhu please merge this PR to your branch, it should fix the issue. :)

Thanks @AmandaBirmingham! I've updated per your suggestion and added documentation.


Runtime Permissions

Not working! =(
doWait() runtimePermission(Manifest.permission.ACCESS_COARSE_LOCATION) { deny() } runtimePermission(Manifest.permission.ACCESS_FINE_LOCATION) { deny() } doWait()
logcat:
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/test/uiautomator/UiDevice; at br.com.concretesolutions.kappuccino.utils.PermissionUtils.handlePermission(PermissionUtils.kt:41) at br.com.concretesolutions.kappuccino.utils.PermissionUtils.deny(PermissionUtils.kt:29) at br.com.concretesolutions.kappuccino.utils.PermissionUtilsKt.runtimePermission(PermissionUtils.kt:15)

Found it!! I missed the UiAutomator dependendy!
Maybe the readme should be updated or the dependencies in the build.gradle should be 'api' instead of 'implementation'

Fixed!
Thank you Methe


Struct members of cdef'd classes don't get destroyed

If I create a cdef'd class in a cython file having a struct as class member, and then instantiate that class in python, the structs do not get destroyed when the python object is deleted. Adding an explicit call to the struct destructor in __dealloc__ will do the job however.
Example:
cppheader.hpp:
#include <vector>

typedef struct MyObject {
	int val;
	std::vector<double> big_obj;
} MyObject;

typedef struct InfoHolder {
	std::vector<MyObject> v;
	int some_val;
} InfoHolder;

void increase_size(MyObject &my_obj)
{
	my_obj.big_obj.resize(10000000, 1);
}

void force_destroy(InfoHolder &info_holder)
{
	info_holder.~InfoHolder();
}

cyfile.pyx:
from libcpp.vector cimport vector

cdef extern from "cppheader.hpp":
	ctypedef struct MyObject:
		int val
		vector[double] big_obj
	ctypedef struct InfoHolder:
		vector[MyObject] v
		int some_val
	void increase_size(MyObject &my_obj)
	void force_destroy(InfoHolder &info_holder)

cdef class PyInfoHolder:
	cdef InfoHolder info_holder
	def __init__(self):
		self.info_holder.v.resize(1);
		increase_size(self.info_holder.v.at(0))
	def say_hello(self):
		print("hello")

pyfile.py:
from cyfile import PyInfoHolder

for i in range(100):
	py_obj = PyInfoHolder()
	py_obj.say_hello()
print("end")

Watch the memory usage when running python pyfile.py, and then compare against the following alternative cython class:
cdef class PyInfoHolder:
	cdef InfoHolder info_holder
	def __init__(self):
		self.info_holder.v.resize(1);
		increase_size(self.info_holder.v.at(0))
	def __dealloc__(self):
		force_destroy(self.info_holder)
	def say_hello(self):
		print("hello")

(For some reason, the structs also cannot call their destructor explicitly within cython - e.g. self.info_holder.~InfoHolder() fails to compile)

Cython doesn't handle structs in C++ any different from structs in C.
If you can, use a C++ class instead.
Does this seem worth turning into a feature?

Yes, would be a nice addition to auto-destruct all attributes of a cdef'd class, especially considering that it's not possible to call the struct destructor in Cython unless it's wrapped in a C++ function.
Also, does it mean that if I instantiate a cdef'd class with POD types like int, double, etc. that those would also not be freed when the python object is deleted?

I've had a go at fixing it https://github.com/cython/cython/pull/3228. My view is it's somewhat useful: it's convention that C++ structs should only be POD, but it is only a convention so to be safe they should be destructed. It should cost almost nothing to do it (especially when they are just POD) but it could save mystery memory leaks
@david-cortes  There's no issue with memory being freed built-in types like int and double - no destructor will be called, but the memory is allocated and deallocated with the Python object.

@da-woods : related question: with the changes in the PR you created, what would happen if some struct member is re-assigned? e.g.
self.some_struct = SomeStruct(n = 1)
self.some_struct = SomeStruct(n = 2)

I think this currently also produces a memory leak.

@david-cortes I believe it calls the SomeStruct constructor to create a temporary then calls the copy assignment operator, then when the temporary falls out of scope (might be instant or might later in the function the temporary will be destructed by default) - this is the existing behaviour. It might possibly be worth testing for this, but I'm pretty sure it already did the right thing.
The issue was really only for structs in cdef classes, where the cdef class is allocated with malloc and freed with free. For pretty much every other case normal C++ scope rules handle appropriately.

@da-woods : Was testing the assignments in the PR you had created and in the current master branch, and I'm finding some strange behavior:
#include <vector>
#include <iostream>

typedef struct MyObject {
	int val;
	std::vector<double> big_obj;
	~MyObject() {std::cout << "I'm destructed (val:" << this->val << ")" << std::endl;}
} MyObject;

void modify_val(int &val)
{
	val *= 2;
}

from libcpp.vector cimport vector

cdef extern from "cppheader.hpp":
	ctypedef struct MyObject:
		int val
		vector[double] big_obj
	void modify_val(int &val)

cdef class PyInfoHolder:
	cdef MyObject my_object

	def __init__(self):
		self.my_object.val = -1

		self.my_object = MyObject()
		self.my_object.val = 1
		modify_val(self.my_object.val)
		print("this is val: ", self.my_object.val)

		self.my_object = MyObject()
		self.my_object.val = 2
		modify_val(self.my_object.val)
		print("this is val: ", self.my_object.val)

		self.my_object = MyObject()
		self.my_object.val = 3
		modify_val(self.my_object.val)
		print("this is val: ", self.my_object.val)

	def say_hello(self):
		print("hello")

from cyfile import PyInfoHolder

for i in range(3):
	py_obj = PyInfoHolder()
	py_obj.say_hello()
	print("---done with this object---")
print("end")

this is val:  2
this is val:  4
this is val:  6
I'm destructed (val:2075964704)
hello
---done with this object---
this is val:  2
this is val:  4
this is val:  6
I'm destructed (val:2075964704)
hello
---done with this object---
this is val:  2
this is val:  4
this is val:  6
I'm destructed (val:2075964704)
hello
---done with this object---
end

Should I be worried about those outputs? Is it the same issue?

The output you show is without my PR, so it's missing the destruction of the MyObject in the cdef class. With my PR these are destructed correctly
If you dig into the C++ code it first creates an uninitialized MyObject temporary:
MyObject __pyx_t_1;

then for all the self.my_object = MyObject() assignments it just assigns from that temporary:
__pyx_v_self->my_object = __pyx_t_1;

The destructor calls you see is that temporary being destroyed at the end of __init__, with the arbitrary number being because it was uninitialized.
You could possibly argue that this is slightly odd code to generate. However, it's valid and there's no memory leaks or real bugs to fix here. I'm not sure a patch to treat structs and C++ classes completely identically would be practical, and it'd be hard not to break existing code (e.g. struct->dict conversion). I'll leave real decisions on this to the actual maintainers, but personally I'm not going to do anything more on this.
Remember that you can always just wrap MyObject as cdef cppclass MyObject if you want Cython to treat it as a C++ class. This'll work fine (without changing the C++ source).

Would it be possible to backport this fix to 0.29.x? We are running into this issue in rapidsai/cudf#8935 and are currently restricted to cython >=0.29,<0.30

Would it be possible to backport this fix to 0.29.x? We are running into this issue in rapidsai/cudf#8935 and are currently restricted to cython >=0.29,<0.30

It's probably very easily worked around - just declare the struct type as a cppclass instead. It really doesn't matter to Cython whether the definition in C++ is a struct or a class.
The only thing you lose is the auto-conversation to dicts


Error to compile Javascript

I  am using chrome latest version while is write some code on dartpad.dartlang.org and when i run that code a pop up alert come with Error to compile with Javascript

Would it be possible for you to include the code snippet or a gist of your code?


open directory problem

Type: Bug
When using vscode to open the project directory, the content shown as below:
G:.
└─test
│  test.py
│
└─test1
test1.py
an invisible unicode character \u202a appears in the python sys.path which is shown as below:
['g:\test', 'g:\test\\u202a',......]
then we found that the sys.path of python scripts in the sub directory are:
['g:\test\test1', 'g:\test\\u202a', ...... ]
hence, scripts in ./test/test1 cannot  load any modules in ./test
VS Code version: Code 1.74.0 (5235c6bb189b60b01b1f49062f4ffa42384f8c91, 2022-12-05T16:37:40.396Z)
OS version: Windows_NT ia32 10.0.19044
Modes:
Sandboxed: No

System Info

Item
Value

CPUs
Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (12 x 3192)

GPU Status
2d_canvas: unavailable_softwarecanvas_oop_rasterization: disabled_offdirect_rendering_display_compositor: disabled_off_okgpu_compositing: disabled_softwaremultiple_raster_threads: enabled_onopengl: disabled_offrasterization: disabled_softwareraw_draw: disabled_off_okskia_renderer: enabled_onvideo_decode: disabled_softwarevideo_encode: disabled_softwarevulkan: disabled_offwebgl: unavailable_softwarewebgl2: unavailable_softwarewebgpu: disabled_off

Load (avg)
undefined

Memory (System)
15.84GB (8.01GB free)

Process Argv
--crash-reporter-id 007a0889-1647-4ca5-b654-f0340d375a74

Screen Reader
no

VM
44%

Extensions (10)

Extension
Author (truncated)
Version

code-runner
for
0.11.8

vscode-language-pack-zh-hans
MS-
1.74.12070927

isort
ms-
2022.8.0

python
ms-
2022.20.0

vscode-pylance
ms-
2022.12.20

jupyter
ms-
2022.11.1003412109

jupyter-keymap
ms-
1.0.0

jupyter-renderers
ms-
1.0.12

vscode-jupyter-cell-tags
ms-
0.1.6

vscode-jupyter-slideshow
ms-
0.1.5

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
vsccc:30610678
pyindex848cf:30577861
nodejswelcome1cf:30587006
2e4cg342:30602488
gswce1:30612156
3d0df643:30613357
dbltrim-noruby:30604474
89544117:30613380
fim-prod:30623723

We don't manipulate sys.path anywhere, so my suspicion is this is coming from your system somehow. Does any of your code change sys.path? Do you have the PYTHONPATH environment variable set?

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.


Add ability to sync dashboard state with URL parameters

Adds a global sync_query config option and options on individual components.

[x] Add (more) tests
[ ] Add documentation
[ ] Add example

@maximlt What do you think about the naming of sync_query? Any better suggestions?

I think it wouldn't hurt too much to add url somewhere in the name, to make it clear what the query is about. People may think it's about data querying for instance. Maybe sync_url_query?

Agreed, was also thinking about sync_with_url, which one is better?

sync_with_url, definitely!


Dev guide: fix typos in the use case

Current:

Suggested:
Use case ends should be in the next line.
Use proper hierarchical listed instead of block quote formatting for nested levels.

Asciidoc doesn't recognise 2a. and 3a. as numbered points. If you notice carefully, there's a slight formatting different between the other numbered points such as 1., 2. compared to them.
As such, there's no way to properly format the 3a1. as a nested point, because 3a. already isn't being recognised as a nested point. The current way of workaround looks ugly though, and cannot be extended to support another level of nesting i.e. the method doesn't work for 3a1a..


gradlew clean assemble gives: No SLF4J providers were found in 0.7.2 stable

./gradlew clean assemble
gives SLF4J: No SLF4J providers were found in 0.7.2 stable
It could be by system ...
openjdk 18.0.2 2022-07-19
OpenJDK Runtime Environment (build 18.0.2+0)
OpenJDK 64-Bit Server VM (build 18.0.2+0, mixed mode)

... but I do not know what to do next. Any tip?
$ ./gradlew clean assemble

SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
SLF4J: Ignoring binding found at [jrt:/org.tinylog.api.slf4j/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See https://www.slf4j.org/codes.html#ignoredBindings for an explanation.

FAILURE: Build failed with an exception.

* What went wrong:
class org.slf4j.helpers.NOPLogger cannot be cast to class org.gradle.api.logging.Logger (org.slf4j.helpers.NOPLogger is in module<EMAIL_ADDRESS>of loader 'app'; org.gradle.api.logging.Logger is in unnamed module o
f loader org.gradle.internal.classloader.VisitableURLClassLoader @42d8062c)

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
java.lang.ClassCastException: class org.slf4j.helpers.NOPLogger cannot be cast to class org.gradle.api.logging.Logger (org.slf4j.helpers.NOPLogger is in module<EMAIL_ADDRESS>of loader 'app'; org.gradle.api.logging
.Logger is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @42d8062c)
	at org.gradle.api.logging.Logging.getLogger(Logging.java:39)
	at org.gradle.launcher.cli.DebugLoggerWarningAction.<init>(DebugLoggerWarningAction.java:57)
	at org.gradle.launcher.cli.DefaultCommandLineActionFactory$WithLogging.execute(DefaultCommandLineActionFactory.java:235)
	at org.gradle.launcher.Main.doAction(Main.java:35)
	at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:50)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
	at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
	at org.gradle.launcher.GradleMain.main(GradleMain.java:31)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:35)
	at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:108)
	at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)

Hi @bwakkie !
Likely JDK too high: openjdk 18.0.2 for the version of logger implementation. In any case, you currently need a lower version of the JDK to run Grobid, due to the dynamic libraries, see:
https://grobid.readthedocs.io/en/latest/Install-Grobid/#getting-grobid

Great,
after ...
export PATH="/usr/lib/jvm/java-8-openjdk/bin/:$PATH"
... it worked! Well ... it is compiling as we speak.


hidesBarsOnTap does not work

perhaps use hidesBarsOnSwipe?

pdfView.scrollView?.gestureRecognizers are causing hidesBarsOnTap not to work on iOS 13 and above.
Change navigationController?.barHideOnTapGestureRecognizer.numberOfTouchesRequired to 2 is a prefect fix in this situation.

Apple PDFKit is embedded with iOS Systems. Not with project.
In my project. hidesBarsOnTap works on iOS 11 and iOS 12.
I tried the answer here:
https://stackoverflow.com/a/54986986/4063462
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
    return true
}

It did not work.
I also tried to remove all gestureRecognizers excluding UIScrollView built-in gestures from  pdfView.scrollView?. hidesBarsOnTap somehow works but unstable.
Altering those gestureRecognizers could cause many other problems. So I stopped there.

Fixed 161e0c1


Where can I find build.cmd

I use this library in my electron app. And from this issue( #17 ), I try to run build.cmd.
But I cannot find that file.
Where can I find this command?

It was renamed to install.cmd

Thanks. I try it.


Add button to legacy template to switch to Advanced metadata

We could also backport it to 3.3

closed through https://github.com/GeoNode/geonode/commit/8b45f7d70a907764a99af9e99abfe7a9ea232a33


[Issue]: Nextjs token based auth is not secure

Description
Hi,
I'm trying to implement https://docs.wundergraph.com/docs/auth/token-based-auth/auth-js but it will always work even if you setup empty Bearer token
Reproduction
When setting up userInfoEndpoint like:
authentication: {
    tokenBased: {
      providers: [
        {
          userInfoEndpoint: `${process.env.MY_APP}/api/auth/session`,
        },
      ],
    },
  },

there is an issue that /api/auth/session from nextauth is basically resolving in {} empty object.
The reason for that is wundergraph is attaching Authorization header while nextauth is expecting next-auth.session-token cookie in order to display any info.
Then probably I could check if there is any user info inside mutatingPostAuthentication but right now it would allow everyone with url to wundergraph to use it - you just have to provide empty Bearer token.
I think the example is either outdated or it was never working as expected.

Have you enabled authentication on all your operations?
https://docs.wundergraph.com/docs/wundergraph-operations-ts-reference/configure-authentication

@Pagebakers obviously I did:
operations: {
    defaultConfig: {
      authentication: {
        required: true,
      },
    },

I think I know what is missing in the tutorial. Basically the NEXTJS_URL/api/wg/* is secured but when I directly call WUNDERGRAPH_URL/operations without the rewrite in NEXTJS -> that's when it's get tricky. When you do that you an put any kind of token like Beared xyz and wundergraph would still response because it is getting 200 and {} from /api/auth/session.

Thanks for the extra info. In that case the /api/auth/session response should throw an error in case the token is invalid. I'llr un some tests to verify this is broken.

I've tested it, and indeed requests are always accepted because the session endpoint doesn't throw an error when the session isn't valid.
You can create a new userInfo.ts handler in api/auth/userInfo.ts with the following code:
import { getToken } from 'next-auth/jwt';

export default async (req, res) => {
	// If you don't have NEXTAUTH_SECRET set, you will have to pass your secret as `secret` to `getToken`
	const token = await getToken({ req });
	if (token) {
		res.status(200);
		res.json({ name: token.name, email: token.email, picture: token.picture });
	} else {
		// Not Signed in
		res.status(401);
	}
	res.end();
};

And then update the userInfoEndpoint in wundergraph.config.ts to point to the userInfo handler instead.
This way you can also map nextauth user details to the wundergraph claims.

Docs have been updated, closing this for now.


Offset player sphere, decrease size.

If the player sphere can be offset (will this screw with weight distribution?) we can reduce its radius and have more reasonable collisions.
Or maybe the camera frustum just needs adjustment? Not sure what the issue was here. The offset on every tick is silly though, a shape-wise offset would be better.

Improved by 0ccb8630dcb6cc1277a132ab04c6bd378f8de223.

TODO - use a capsule.


Mirror-less Scala 3

Draft of mirror-less implementation for Scala 3. Probably most of the code can be simplified a lot. But should be a good start for testing if recursive types can be handled properly this way.
Related to #310

Thanks!
I think it might turn out recursive types work as-is, but maybe we could support value classes and non-trivial sealed trait hierarchies, for which mirrors are currently not derived.

FYI the base branch is now scala3

Ok, so this branch should now pass at least as many tests as the scala3  branch does.
So apart from the compatibility issues and overall being rough around the edges, it works.
@adamw will you be able to find some time to take a look at the changes and give some feedback? It would be great to test it on some real-world libraries that use magnolia - tapir?

So one thing that breaks is calling magnolia from another macro: Expr.summon[Schema[T]] returns a None.
Even in a simple case:
    case class Test1(f1: Int)
    implicitly[Schema[Test1]]
    val codec = implicitly[MultipartCodec[Test1]].codec

the implicitly[Schema[Test1]] works, while the same lookup done as part of the multipart codec derivation macro fails

But is it something that we actually care about? if Expr.summon[Schema[T]] returns None then we just use the same implicit method (Typeclass.derived) but by hand this time.
The only thing I can think of that may be affected here is the inline depth. Am I missing something?

Not sure I understand - Expr.summon used to work in the old implementation, returning a Some. It stopped with the new one (no idea why). Where would I use Typeclass.derived?

This is how to reproduce, inside magnolia/test:
// test1.scala
package magnolia1.tests

import magnolia1.examples._

case class Data(value: String)

object Test1 {
  summon[Show[String, Data]]
  Test2.summonShow[Data]
}

// test2.scala
package magnolia1.tests

import magnolia1.examples._
import scala.quoted.*

object Test2 {
  inline def summonShow[T]: Show[String, T] = ${ summonShowImpl[T] }

  def summonShowImpl[T: Type](using Quotes): Expr[Show[String, T]] = {
    import quotes.reflect.*

    Expr.summon[Show[String, T]].getOrElse(report.throwError(s"Cannot find a Show for: ${Type.show[T]}."))
  }
}

The direct summon works, the indirect one - fails.

there is a problem with current impl which i hope can be addressed as well with the rewrite
here is a showcase https://github.com/softwaremill/magnolia/pull/421
basically, since subtypes contains only types directly inheriting root type, all of the logic relying on subtypes and choose breaks when you introduce non-leaf subtypes
as far as i can see the rewrite also suffers from this right now
can something be done about it?

actually the problem seems to be easy to fix with old implementation, i submitted a pr

@OlegYch You obviously can flatten the hierarchy in this rewrite too, but I'm not sure if that's what we want. Don't we lose some information, when we flatten the type hierarchy like that?
I'm pretty sure that there's a way to implement DecoderSafe derivation in a way that will work for those hierarchies. (choosing the instance that returns Right)

@KacperFKorban i thought so too, but it appears to be no way to make choose work, or enumerate all subtypes
trying out all instances will not work since multiple instances may succeed


data attributes missing from some elements

Hi,
I can see that https://github.com/lumihq/purescript-react-basic/issues/89 was resolved and the _data prop works fine, great! However, it seems like the _data prop is missing on a few elements as is evident in React/Basic/DOM/Generated.purs (for example Props_input).
There's a few other elements with missing _data prop as well. Seems like this was omitted by mistake?

hmm seems to be caused by this: https://github.com/lumihq/purescript-react-basic/blob/master/codegen/index.js#L103
We should probably add ["_data"] prop to the noChildren case

I'll try to get to this soon.


DTU IOPS units

The line that reads "IO throughput (approximate)	1-5 IOPS per DTU	1-5 IOPS per DTU	25 IOPS per DTU", are we talking about five I/O operations per second? That's a really small unit of measure. I mean, ppl can type that fast. Or does IOPS stand for something else? Or maybe there should be a k in there as in 1k-5k.

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

ID: 4b8f9b79-678b-7a3e-0642-8ae7bd8a790b
Version Independent ID: 6dc1fcc4-dd65-1a3a-af5d-c698dbb1b2ba
Content: Service tiers - DTU-based purchase model - Azure SQL Database
Content Source: articles/sql-database/sql-database-service-tiers-dtu.md
Service: sql-database
Sub-service: service
GitHub Login: @stevestein
Microsoft Alias: sstein

#please-close


go/version: unclear as to what counts as a valid Go version

Go version
go version devel go1.22-e9b3ff15 Wed Jan 10 17:35:49 2024 +0000 darwin/amd64
Output of go env in your module/workspace:
❯ gotip env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/mjivrajani/Library/Caches/go-build'
GOENV='/Users/mjivrajani/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/mjivrajani/gocode/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/mjivrajani/gocode'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/mjivrajani/sdk/gotip'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/mjivrajani/sdk/gotip/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='devel go1.22-e9b3ff15 Wed Jan 10 17:35:49 2024 +0000'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/mjivrajani/gocode/src/github.com/MadhavJivrajani/go/src/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/r7/f6kyp7vs0sv90105pjh1t8340000gp/T/go-build3111256134=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?
I was playing around with the new go/version package to see how it works.
I'm probably missing something, but I'm not entirely sure what a "valid" Go version entails - from the documentation of Compare:

Invalid versions, including the empty string, compare less than valid versions

However, it also says:

Custom toolchain suffixes are ignored during comparison: "go1.21.0" and "go1.21.0-bigcorp" are equal.

What did you see happen?
My assumption going into this was that a "valid" version is one that returns a true when passed into IsValid. However, IsValid seems to reject custom toolchain names and names with +auto attached, see here: https://go.dev/play/p/OnEbA0bOovs?v=gotip
What did you expect to see?
Maybe clarifying the docs would help better understand what a valid Go version is for folks other than me who might also make similar assumptions and I'm happy to send in a fix here! And thank you for introducing this package, we are already in the works of getting rid of custom parsing code in the Kubernetes codebase! ❤

Looks like the description of Compare is not really correct, I don't think we are ignoring the suffixes, if it finds a suffix we just return an empty version:
https://go.googlesource.com/go/+/e9b3ff15f40d6b258217b3467c662f816b078477/src/internal/gover/gover.go#137

We might be able to fix this by returning the proper version if it is a custom toolchain, eg "go1.21.3-corp" returns "1.21.3" instead of an empty version. That would fix Compare but will also affect all other usages of internal/gover.Parse, so I'm not sure if it would break anything.
diff --git a/src/internal/gover/gover.go b/src/internal/gover/gover.go
index 2ad068464d..151ff674fa 100644
--- a/src/internal/gover/gover.go
+++ b/src/internal/gover/gover.go
@@ -133,7 +133,7 @@ func Parse(x string) Version {
 	// Parse patch if present.
 	if x[0] == '.' {
 		v.Patch, x, ok = cutInt(x[1:])
-		if !ok || x != "" {
+		if !ok || x != "" && x[0] != '-' {
 			// Note that we are disallowing prereleases (alpha, beta, rc) for patch releases here (x != "").
 			// Allowing them would be a bit confusing because we already have:
 			//	1.21 < 1.21rc1

The mention of toolchains in that comment is just a bug. Custom toolchains are not allowed in this API.
This API is for things like deciding that go1.3 < go1.21.5.
What is the context where you need "go1.21.0-bigcorp" to work?

@rsc Why is it a bug? It was a feature we explicitly discussed in the proposal. https://github.com/golang/go/issues/62039#issuecomment-1726486081

@rittneje Thanks for pointing that out. My memory is clearly faulty!

Reopen for backport.

Reopening for x/tools

This was done for x/tools in CL 562838.
This issue is in Go1.22 milestone, so closing again. (It was fixed by CL 559796.)


GitHub Page for project

We need to set up a GitHub webpage as a project prototype for MozFest.

Can be simple to begin with, e.g. set up like the Mozilla Open Leadership Training Series (GitHub: https://github.com/mozilla/open-leadership-training-series)

Let me know if you need any help deciphering what I did there :)

I found this and hyde theme really cool. Let me know your views :)


Luwak/Reverse Search/Lucene Monitor for tantivy

https://issues.apache.org/jira/browse/LUCENE-8766
Does tantivy have an equivalent of Luwak/Lucene Monitor, even if it is some other open-source rust project?

No one has implemented reverse search with tantivy yet.

No one has implemented reverse search with tantivy yet.

@AceHack Happy to discuss your need though. We might have that  (paul at quickwit.io)

@AceHack Happy to discuss your need though. We might have that  (paul at quickwit.io)


Django 1.7 compatibility

fixes #77
Replaced django.http.HttpResponse with django.http.JsonResponse with fallback for Django < 1.7.

Hi, has this been abandoned? looks like this PR is still open

@egamonal I think https://github.com/idan/oauthlib is a safer bet these days :)

thanks @antonagestam , I was trying django-oauth-toolkit to get ready for updating django rest framework to 3.x . I'll give that one a shot as well.