[BUG] RangeError when selection.isValid is false

https://github.com/xsahil03x/multi_trigger_autocomplete/blob/751988a10b0b8f5b10bb0f2a8bf88d7abaf2bbab/lib/src/autocomplete_trigger.dart#L69
Unhandled Exception: RangeError (end): Invalid value: Not in inclusive range 0..21: -1

When isValid is false baseOffset and other properties are -1
So
https://github.com/xsahil03x/multi_trigger_autocomplete/blob/751988a10b0b8f5b10bb0f2a8bf88d7abaf2bbab/lib/src/autocomplete_trigger.dart#L63-L65
I fixed it like this:
  AutocompleteQuery? invokingTrigger(TextEditingValue textEditingValue) {
    if (!textEditingValue.selection.isValid) {
      return null;
    }

    final text = textEditingValue.text;
    final cursorPosition = textEditingValue.selection.baseOffset;

In my case it happens that selection.isValid is false when the Widget is a child of a custom SliverReorderableList and I change its position by drag and drop.

Hey @MiniSuperDev, can you also share a small reproducible code which I can test this on?

Fixed in https://github.com/xsahil03x/multi_trigger_autocomplete/commit/3c1a152f65bf0c8c56f9e5ea5fe3ebffb85119a3


Keybinding for filtering help items was not listed among those help items

There is a command to filter help items. By default it was bind to "/" in keymap.toml for help section.
[help]

keymap = [
...
   # Filtering
   { on = "/", run = "filter", desc = "Apply a filter for the help items" },
]

But it was missing for other sections, like manager. Thus it was never displayed. And this is a very useful feature for newcomers.
I've added it to all sections. I also had to replace "/" binding with "F". By default, "/" is used for finding in manager, while "f" is used for filtering. Unfortunately we can't bind filtering for help items to "f" because it will collide with manager's command and only one will be displayed.
I also think that filtering help items should be displayed as the first item on the list since it's very useful when looking at big list of commands like in manager's section. But it's more like follow up suggestion and not included in this PR.

I'm adding the video to avoid misunderstanding. Currently there is no way for user to know that he can use filter in help widget.
simplescreenrecorder-2024-07-27_20.18.32.webm

That's because there's no help for the help itself, you can't see the help's own keymappings.
When you press ~ in the task manager, you're viewing the task manager's help

If we want to prompt users that they can use / to filter in the help, we should change the help itself instead of adding it to other components ([tasks], [manager], etc.).

That's because there's no help for the help itself, you can't see the help's own keymappings.

Yes, I understand that yazi shows keymap help based on a widget context.
But I see no other way how you can let a user to know that he can filter the help listing. Making a user to open a help for help is weird and judging by code base it doesn't look as intended.
My point is that this is a very useful feature that is not documented and not listed anywhere in help keymap. If you know a better way how to implement it - please let me know.

I agree that putting command that is not related to the widget is not the best solution in general.
How about showing this keybinding instead of manager.help or tasks.help?

Sounds great to me! And it should also be simple to achieve:
https://github.com/sxyazi/yazi/blob/f024ce03e7b97f55f3bfad9da4b33458cea765d5/yazi-fm/src/help/layout.rs#L22
We just need to append a  (Press f to filter) after the .help string here

In that case I will revert my changes and reimplement this way.
I will also try to have it based on keymap binding, in case if a user would want to override the key.

Completely reworked in https://github.com/sxyazi/yazi/pull/1361


It always says wrong url.

I tried a lot of different variants but I couldn't make it work. Does anybody has an idea what to do?

same here I tried:

product page
product review page
product review page + pageNumber

Guys, sorry but this is an old project of mine. Amazon can change a single div element and the script won't work
I don't have the time to maintain this project anymore, but if you can fix it and raise a PR, I'll gladly merge it :)


Linux: Shared Debug Library Broken

I have found that the Shared Debug library for linux does not work correctly. There is internal assert failures.  The steps to reproduce are fairly straight forward if you follow the wiki with some slight changes( see: Microsoft/ChakraCore Wiki: Embedding ChakraCore).
The steps to reproduce the issue are as follows...

Create a clean checkout of the Master ChakraCore branch.
Meet all build dependencies for ChakraCore. In my case I use Ubuntu 16.04 LTS with packaged versions of cmake, clang, ninja ( ninja-build package), and others.
Build chakracore debug library

# Run this in root directory for ChakraCore.
./build.sh -n -d

Wait for build to finish.
prepare an example runtime/link folder using above...

	cd BuildLinux
	mkdir DebugLibTest
	cd DebugLibTest
	# This command is for Linux.
	cp ../Debug/libChakraCore.so .
	# This is for OSX/Darwin.
	#cp ../Debug/libChakraCore.dylib .
	# add Headers.
	mkdir include
	cd include
	# This will copy the four core headers outlined at...
	# https://github.com/Microsoft/ChakraCore/wiki/Embedding-ChakraCore
	cp ../../../lib/Jsrt/Chakra*.h .

Build an example... In this Case I use the Hello World example as the source... (see: https://github.com/Microsoft/Chakra-Samples/blob/master/ChakraCore Samples/Hello World/Linux_OSX/sample.cpp )

	# NOTE: Copy sample.cpp from the Chakra Core Hello World example for Linux/OSX here.
	# Build example on a Linux System...
	clang++ sample.cpp $(pwd)/libChakraCore.so -Wl,-rpath,. -Iinclude -o Sample -std=c++11
	# Build example on a OS X/Darwin System... - NOTE: I have not tested this.
	# clang++ sample.cpp $(pwd)/libChakraCore.dylib -Wl,-rpath,. -Iinclude -o Sample -std=c++11

run the example. ./Sample
 # This should output Hello World, but instead it crashes.

@kphillisjr xplat shared library requires an explicit call to DllMain first. See our python example https://github.com/Microsoft/Chakra-Samples/blob/master/ChakraCore Samples/Hello World/Python/helloWorld.py#L23-L28
Thanks for the detailed report. I'm closing this one since we follow this issue from #1811


Cannot read property 'hiddenInputComponent' of null

Open a file
Use / to search for something + Enter

The problem seems to be here.
https://github.com/atom/atom/blob/master/src/text-editor-element.coffee#L134-L140
I don't quite understand what this check is for:
if event.relatedTarget is @component.hiddenInputComponent.domNode
so I didn't go further.
Enabling Shadow DOM temporarily solves the problem.
\\Atom Version\\: 0.188.0-6c38562
\\System\\: linux 3.19.2-1-ARCH
\\Thrown From\\: vim-mode package, v0.40.0
Stack Trace
Uncaught TypeError: Cannot read property 'hiddenInputComponent' of null
At /home/pine/atom-build/Atom/resources/app/src/text-editor-element.js:199

TypeError: Cannot read property 'hiddenInputComponent' of null
  at atom-text-editor.TextEditorElement.blurred (/home/pine/atom-build/Atom/resources/app/src/text-editor-element.js:199:51)
  at HTMLInputElement.<anonymous> (/home/pine/atom-build/Atom/resources/app/src/text-editor-element.js:174:26)
  at atom-pane.PaneElement.activated (/home/pine/atom-build/Atom/resources/app/src/pane-element.js:91:19)
  at Emitter.module.exports.Emitter.emit (/home/pine/atom-build/Atom/resources/app/node_modules/event-kit/lib/emitter.js:82:11)
  at Pane.module.exports.Pane.activate (/home/pine/atom-build/Atom/resources/app/src/pane.js:651:27)
  at VimCommandModeInputView.module.exports.VimCommandModeInputView.remove (/home/pine/.atom/packages/vim-mode/lib/view-models/vim-command-mode-input-view.coffee:52:36)
  at VimCommandModeInputView.remove (/home/pine/.atom/packages/vim-mode/lib/view-models/vim-command-mode-input-view.coffee:1:1)
  at VimCommandModeInputView.module.exports.VimCommandModeInputView.confirm (/home/pine/.atom/packages/vim-mode/lib/view-models/vim-command-mode-input-view.coffee:42:6)
  at atom-text-editor.<anonymous> (/home/pine/.atom/packages/vim-mode/lib/view-models/vim-command-mode-input-view.coffee:1:1)
  at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/home/pine/atom-build/Atom/resources/app/src/command-registry.js:242:29)
  at /home/pine/atom-build/Atom/resources/app/src/command-registry.js:3:61
  at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/home/pine/atom-build/Atom/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:558:16)
  at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/home/pine/atom-build/Atom/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:396:22)
  at HTMLDocument.module.exports.WindowEventHandler.onKeydown (/home/pine/atom-build/Atom/resources/app/src/window-event-handler.js:180:20)

Commands
 46x -1:41.2 vim-mode:move-down (input.hidden-input)
     -1:25.8 vim-mode:insert-below-with-newline (input.hidden-input)
     -1:25.2 vim-mode:reset-command-mode (input.hidden-input)
     -1:24.9 vim-mode:undo (input.hidden-input)
     -1:24.5 vim-mode:move-up (input.hidden-input)
     -1:23.5 vim-mode:scroll-half-screen-up (input.hidden-input)
  8x -1:22.8 vim-mode:move-up (input.hidden-input)
     -1:21.5 vim-mode:move-to-bottom-of-screen (input.hidden-input)
     -1:21.0 vim-mode:move-to-middle-of-screen (input.hidden-input)
 31x -1:20.0 vim-mode:move-down (input.hidden-input)
 28x -1:17.3 vim-mode:move-up (input.hidden-input)
     -0:47.1 settings-view:open (input.hidden-input)
 12x -0:03.5 vim-mode:move-up (input.hidden-input)
     -0:01.5 vim-mode:search (input.hidden-input)
     -0:00.6 editor:newline (input.hidden-input)
  3x -0:00.6 blur (input.hidden-input)

Config
{
  "core": {
    "disabledPackages": [
      "wrap-guide",
      "view-tail-large-files"
    ],
    "audioBeep": false
  },
  "vim-mode": {
    "useClipboardAsDefaultRegister": true,
    "useSmartcaseForSearch": true
  }
}

Installed Packages
# User
language-lua, v0.9.0
vim-mode, v0.40.0

# Dev
No dev packages

I also have this problem when using v.40

In my case, the problem has gone away after enabling "use shadow DOM" in the main settings - I can't remember why I disabled it.

@jacekkopecky
Atom says this option will eventually go away, so we can't rely on that.

My interpretation seems to differ: the option in Atom is described as
Use Shadow DOM
Disable if you experience styling issues with packages or themes. Be sure to open an issue on the relevant package or theme, because this option is going away eventually.

I read that as meaning the option to disable shadow DOM is going away, and it was enabling shadow DOM that fixed the issue for me.

@jacekkopecky
You're right. I should have looked at the option more closely. Thanks!


datasets.map pickle issue resulting in invalid mapping function

I trained my own tokenizer, and I needed to use a python custom class. Because of this I have to detach the custom step before saving and reattach after restore. I did this using the standard pickle __get_state__ / __set_state__ mechanism. I think it's correct but it fails when I use it inside a function which is mapped to a dataset, i.e. in the manner of run_mlm.py and other huggingface scripts.
The following reproduces the issue - most likely I'm missing something
A simulated tokeniser which can be pickled
class CustomTokenizer:
    def __init__(self):
        self.state = "init"

    def __getstate__(self):
        print("__getstate__ called")
        out = self.__dict__.copy()
        self.state = "pickled"
        return out

    def __setstate__(self, d):
        print("__setstate__ called")
        self.__dict__ = d
        self.state = "restored"

tokenizer = CustomTokenizer()

Test that it actually works - prints "getstate called" and "setstate called"
import pickle
serialized = pickle.dumps(tokenizer)
restored = pickle.loads(serialized)
assert restored.state == "restored"

Simulate a function that tokenises examples, when dataset.map is called, this function
def tokenize_function(examples):
    assert tokenizer.state == "restored" # this shouldn't fail but it does
    output = tokenizer(examples)           # this will fail as tokenizer isn't really a tokenizer
    return output

Use map to simulate tokenization
import glob
from datasets import load_dataset

assert tokenizer.state == "restored"
train_files = glob.glob('train*.csv')
validation_files = glob.glob('validation*.csv')
datasets = load_dataset("csv", data_files=dict(train=train_files, validation=validation_files))

tokenized_datasets = datasets.map(
    tokenize_function,
    batched=True,
)

What's happening is I can see that getstate is called but not setstate, so the state of tokenize_function is invalid at the point that it's actually executed. This doesn't matter as far as I can see for the standard tokenizers as they don't use getstate / setstate. I'm not sure if there's another hook I'm supposed to implement as well?

AssertionError                            Traceback (most recent call last)
 in
8 tokenized_datasets = datasets.map(
9     tokenize_function,
---> 10     batched=True,
11 )
~/.pyenv/versions/3.7.6/envs/xxx/lib/python3.7/site-packages/datasets/dataset_dict.py in map(self, function, with_indices, input_columns, batched, batch_size, remove_columns, keep_in_memory, load_from_cache_file, cache_file_names, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, desc)
487                     desc=desc,
488                 )
--> 489                 for k, dataset in self.items()
490             }
491         )
~/.pyenv/versions/3.7.6/envs/xxx/lib/python3.7/site-packages/datasets/dataset_dict.py in (.0)
487                     desc=desc,
488                 )
--> 489                 for k, dataset in self.items()
490             }
491         )
~/.pyenv/versions/3.7.6/envs/xxx/lib/python3.7/site-packages/datasets/arrow_dataset.py in map(self, function, with_indices, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, suffix_template, new_fingerprint, desc)
1633                 fn_kwargs=fn_kwargs,
1634                 new_fingerprint=new_fingerprint,
-> 1635                 desc=desc,
1636             )
1637         else:
~/.pyenv/versions/3.7.6/envs/xxx/lib/python3.7/site-packages/datasets/arrow_dataset.py in wrapper(*args, **kwargs)
184         }
185         # apply actual function
--> 186         out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
187         datasets: List["Dataset"] = list(out.values()) if isinstance(out, dict) else [out]
188         # re-apply format to the output
~/.pyenv/versions/3.7.6/envs/xxx/lib/python3.7/site-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
395             # Call actual function
396
--> 397             out = func(self, *args, **kwargs)
398
399             # Update fingerprint of in-place transforms + update in-place history of transforms
~/.pyenv/versions/3.7.6/envs/xxx/lib/python3.7/site-packages/datasets/arrow_dataset.py in _map_single(self, function, with_indices, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, new_fingerprint, rank, offset, desc)
1961                                 indices,
1962                                 check_same_num_examples=len(input_dataset.list_indexes()) > 0,
-> 1963                                 offset=offset,
1964                             )
1965                         except NumExamplesMismatch:
~/.pyenv/versions/3.7.6/envs/xxx/lib/python3.7/site-packages/datasets/arrow_dataset.py in apply_function_on_filtered_inputs(inputs, indices, check_same_num_examples, offset)
1853                 effective_indices = [i + offset for i in indices] if isinstance(indices, list) else indices + offset
1854             processed_inputs = (
-> 1855                 function(*fn_args, effective_indices, **fn_kwargs) if with_indices else function(*fn_args, **fn_kwargs)
1856             )
1857             if update_data is None:
 in tokenize_function(examples)
1 def tokenize_function(examples):
----> 2     assert tokenizer.state == "restored"
3     tokenizer(examples)
4     return examples

Hi ! map calls __getstate__ using dill to hash your map function. This is used by the caching mechanism to recover previously computed results. That's why you don't see any __setstate__ call.
Why do you change an attribute of your tokenizer when __getstate__ is called ?

@lhoestq because if I try to pickle my custom tokenizer (it contains a pure python pretokenization step in an otherwise rust backed tokenizer) I get

Exception: Error while attempting to pickle Tokenizer: Custom PreTokenizer cannot be serialized

So I remove the Custom PreTokenizer in __getstate__ and then restore it in __setstate__ (since it doesn't contain any state). This is what my __getstate__  / __setstate__ looks like:
def __getstate__(self):
    """
    Removes pre_tokenizer since it cannot be pickled
    """
    logger.debug("Copy state dict")
    out = self.__dict__.copy()
    logger.debug("Detaching pre_tokenizer")
    out['_tokenizer'].pre_tokenizer = tokenizers.pre_tokenizers.Sequence([])
    return out

def __setstate__(self, d):
    """
    Reinstates pre_tokenizer
    """
    logger.debug("Reattaching pre_tokenizer")
    self.__dict__ = d
    self.backend_tokenizer.pre_tokenizer = self._pre_tokenizer()

I seems you're bypassing setstate by simply writing directly to self.dict if I understand your comment correctly? If this is the case Ican you think of another way of avoiding my issue?

Actually, maybe I need to deep copy self.__dict__? That way self isn't modified. That was my intention and I thought it was working - I'll double-check after the weekend.

Doing a deep copy results in the warning:
06/20/2021 16:02:15 - WARNING - datasets.fingerprint -   Parameter 'function'=<function tokenize_function at 0x7f1e95f05d40> of the transform datasets.arrow_dataset.Dataset._map_single couldn't be hashed properly, a random hash was used instead. Make sure your transforms and parameters are serializable with pickle or dill for the dataset fingerprinting and caching to work. If you reuse this transform, the caching mechanism will consider it to be different from the previous calls and recompute everything. This warning is only showed once. Subsequent hashing failures won't be showed.
def __getstate__(self):
    """
    Removes pre_tokenizer since it cannot be pickled
    """
    logger.debug("Copy state dict")
    out = copy.deepcopy(self.__dict__)
    logger.debug("Detaching pre_tokenizer")
    out['_tokenizer'].pre_tokenizer = tokenizers.pre_tokenizers.Sequence([])
    return out

Looks like there is still an object that is not pickable in your tokenize_function function.
You can test if an object can be pickled and hashed by using
from datasets.fingerprint import Hasher

Hasher.hash(my_object)

Under the hood it pickles the object to compute its hash, so it calls __getstate__ when applicable.

I figured it out, the problem is deep copy itself uses pickle (unless you implement __deepcopy__). So when I changed __getstate__ it started throwing an error.
I'm sure there's a better way of doing this, but in order to return the __dict__ without the non-pikelable pre-tokeniser and without modifying self I removed the pre-tokenizers, did a deep copy and then re-generated it.
It does work -  although I noticed Hasher doesn't call __hash__ if the object being hashed implements it which I feel it should? If it did I could return a hash of the tokenizers.json file instead.
    def __getstate__(self):
        """
        Removes pre_tokenizer since it cannot be pickled
        """
        logger.debug("Copy state dict")
        self.backend_tokenizer.pre_tokenizer = tokenizers.pre_tokenizers.Sequence([])
        out = copy.deepcopy(self.__dict__)  #self.__dict__.copy()
        self.backend_tokenizer.pre_tokenizer = self._pre_tokenizer()

        return out

I'm glad you figured something out :)
Regarding hashing: we're not using hashing for the same purpose as the python __hash__ purpose (which is in general for dictionary lookups). For example it is allowed for python hashing to not return the same hash across sessions, while our hashing must return the same hashes across sessions for the caching to work properly.


Feature Request: "Can particles.js be made into a cross platform screensaver?"

Hi, I really like this project and was wondering whether it could be made into a cross platform screensaver?
Thank you!

Possibly this could be done with Before Dawn:
https://github.com/muffinista/before-dawn 🙂


Change password for users connected with Github

When I connect with my Github account, I can't set a password because the "current password" is always required.
Two suggestions for this:
Force user to set a password on account creation
or
Change UpdatePasswordRequest and password.blade file. Check if the user has GitHub id defined and an empty password.  In other words, make the validation request dynamic. Only show current password field if the user has a password defined.

I think an even easier way is to just add a link to the password settings screen to the password reset form. What do you think?

@driesvints yes, that's possible too.
But I'm not sure about user experience here - is a good idea to redirect to another page just to reset the password? ("I'm already on password page"). I prefer option 2 - seems easier to the final user.

You're right. But I wouldn't take Github authentication into account. Just check if the user already has a password or not.

Just pushed this feature on master.


Format if expressions & loops

Since a lot of code is inside these expressions, this should significantly increase coverage!
Blocked by https://github.com/rust-lang/rust/pull/27065.
Single line if-else expressions are not implemented yet.
Closes https://github.com/nrc/rustfmt/issues/102.

I wonder if we should ever try to format the label on to the previous line? For example:
'a_long_label:
while a < b {
}

// rather than
'a_long_label: while a <
                   b {
}

(assuming a and b are actually really long, or whatever).
I guess in practice labels are usually quite short, but it does prevent rightward drift a little bit.
Anyway, just a random thought, don't need to change anything with the PR.

This is awesome, thanks!

Good thing you mentioned tests for ranges, because their bad spans still break this :-(
It seems we're blocked on https://github.com/rust-lang/rust/issues/27162 now.

How should we format if-else block inside functions? I'm tempted to format things as follows:
Some(if cond {
    ...
} else {
    ...
})

but that's not really consistent with how we format them within struct literals. OTOH,
Some(if cond {
         ...

     } else {

        ...

     })

just looks weird to me...
What to do?

I would add options for this: block indent, block indent + tab, visual indent.

I'm not sure what the default should be, perhaps block + tab?

I'll play around with a bit, but that sounds sensible to me.

The bad span for ranges should be fixed now, I hope nightly is updated in time!
This should also close https://github.com/nrc/rustfmt/issues/155.

Guess not :-(

This builds now!


Contribution Help

I am on a team of four college students that are willing to contribute to this open-source project throughout the summer. We are beginning to familiarize ourselves with the repo and how it all works together. What are the next steps are in order to help effectively? Thanks!

Hi @nathanostdiek, thanks so much for reaching out and your interest in Activity! We would be glad to get some additional support on Activity. Currently we are in a hardening sprint to refactor and improve the code quality to make it easier for folks to contribute. For next steps let's find time to chat. What's the best email I can reach you at and I'll follow up.

Thanks for the reply! My email is<EMAIL_ADDRESS>and I will include my teammates in our conversation. I look forward to hearing from you.