Add a way to inject modules to rustpython_wasm

cc @satyajeetkolhapure
To add your own modules, you should make your own crate that depends on
# for wasm-bindgen
[lib]
crate-type = ["cdylib", "rlib"]

# can remove `branch="..."` once  this PR is merged
rustpython_wasm = { git = "https://github.com/RustPython/RustPython", branch = "wasm-hooks" }
rustpython_vm = { git = "https://github.com/RustPython/RustPython", branch = "wasm-hooks" }
wasm-bindgen = "0.2"

# might also want this so that compilation doesn't take forever
[package.metadata.wasm-pack.profile.release]
wasm-opt = false

Then your lib.rs should look like:
pub use rustpython_wasm::exports::*;

use wasm_bindgen::prelude::*;
use rustpython_vm::VirtualMachine;

#[wasm_bindgen(start)]
fn init() {
    rustpython_wasm::add_init_func(init_vm);
}

fn init_vm(vm: &mut VirtualMachine) {
    vm.add_frozen(rustpython_vm::py_freeze!(dir = "deps"));
}

deps/ should be a directory next to your Cargo.toml, with a subdirectory deps/pytezos with stuff like deps/pytezos/__init__.py.

Thanks @coolreader18 for the quick fix.
I created new crate and cargo.toml looks like -
`[package]
name = "PytezosRustPython"
version = "0.1.0"
authors = ["satyajeetkolhapure"]
edition = "2018"
See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
rustpython_wasm = { git = "https://github.com/RustPython/RustPython", branch = "wasm-hooks" }
rustpython-vm = { git = "https://github.com/RustPython/RustPython", branch = "wasm-hooks" }
wasm-bindgen = "0.2"
[package.metadata.wasm-pack.profile.release]
wasm-opt = false`
And lib.rs looks like
`pub use rustpython_wasm::exports::*;
use wasm_bindgen::prelude::*;
use rustpython-vm::VirtualMachine;
#[wasm_bindgen(start)]
fn init() {
rustpython_wasm::add_init_func(init_vm);
}
fn init_vm(vm: &mut VirtualMachine) {
vm.add_frozen(rustpython-vm::py_freeze!(dir = "deps"));
}`
I have added simple mymodule.py file in deps folder which has one simple function
When I try to run wasm-pack build --target nodejs I get below error
Compiling rustpython-pylib v0.1.0 (https://github.com/RustPython/RustPython?branch=wasm-hooks#304a47af)
error[E0599]: no method named into_pyexception found for struct std::io::Error in the current scope
--> /Users/satyajeetkolhapure/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/304a47a/vm/src/stdlib/thread.rs:246:28
|
246 |         .map_err(|err| err.into_pyexception(vm))
|                            ^^^^^^^^^^^^^^^^ method not found in std::io::Error
|
= help: items from traits can only be used if the trait is implemented and in scope
note: IntoPyException defines an item into_pyexception, perhaps you need to implement it
--> /Users/satyajeetkolhapure/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/304a47a/vm/src/exceptions.rs:42:1
|
42  | pub trait IntoPyException {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try rustc --explain E0599.
error: could not compile rustpython-vm
Any idea, if I am missing something?

Thanks @coolreader18 for the quick fix.
I created new crate and cargo.toml looks like -
`[package]
name = "PytezosRustPython"
version = "0.1.0"
authors = ["satyajeetkolhapure"]
edition = "2018"
See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
rustpython_wasm = { git = "https://github.com/RustPython/RustPython", branch = "wasm-hooks" }
rustpython-vm = { git = "https://github.com/RustPython/RustPython", branch = "wasm-hooks" }
wasm-bindgen = "0.2"
[package.metadata.wasm-pack.profile.release]
wasm-opt = false`
And lib.rs looks like
`pub use rustpython_wasm::exports::*;
use wasm_bindgen::prelude::*;
use rustpython-vm::VirtualMachine;
#[wasm_bindgen(start)]
fn init() {
rustpython_wasm::add_init_func(init_vm);
}
fn init_vm(vm: &mut VirtualMachine) {
vm.add_frozen(rustpython-vm::py_freeze!(dir = "deps"));
}`
I have added simple mymodule.py file in deps folder which has one simple function
When I try to run wasm-pack build --target nodejs I get below error
Compiling rustpython-pylib v0.1.0 (https://github.com/RustPython/RustPython?branch=wasm-hooks#304a47af)
error[E0599]: no method named into_pyexception found for struct std::io::Error in the current scope
--> /Users/satyajeetkolhapure/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/304a47a/vm/src/stdlib/thread.rs:246:28
|
246 |         .map_err(|err| err.into_pyexception(vm))
|                            ^^^^^^^^^^^^^^^^ method not found in std::io::Error
|
= help: items from traits can only be used if the trait is implemented and in scope
note: IntoPyException defines an item into_pyexception, perhaps you need to implement it
--> /Users/satyajeetkolhapure/.cargo/git/checkouts/rustpython-f8ef4d934ac33cd8/304a47a/vm/src/exceptions.rs:42:1
|
42  | pub trait IntoPyException {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try rustc --explain E0599.
error: could not compile rustpython-vm
Any idea, if I am missing something?

Oh whoops, yeah, add default-features = false to the rustpython-vm dependency

Oh whoops, yeah, add default-features = false to the rustpython-vm dependency

Sorry @coolreader18  for too many questions. This time cargo build succeeds, but when I ran wasm-pack build --target nodejs   I got below error
[INFO]: ⬇  Installing wasm-bindgen...
error: cannot specify two `start` functions
Error: Running the wasm-bindgen CLI
Caused by: failed to execute `wasm-bindgen`: exited with exit code: 1

May be because rustpython_wasm package already has start method. Not sure how to fix this.

Sorry @coolreader18  for too many questions. This time cargo build succeeds, but when I ran wasm-pack build --target nodejs   I got below error
[INFO]: ⬇  Installing wasm-bindgen...
error: cannot specify two `start` functions
Error: Running the wasm-bindgen CLI
Caused by: failed to execute `wasm-bindgen`: exited with exit code: 1

May be because rustpython_wasm package already has start method. Not sure how to fix this.

Oh, hmmmm. I didn't think that the one in rustpython_wasm would count since it isn't really exported.

Oh, hmmmm. I didn't think that the one in rustpython_wasm would count since it isn't really exported.

@satyajeetkolhapure try adding features = ["no-start-func"] to your rustpython_wasm dependency

@satyajeetkolhapure try adding features = ["no-start-func"] to your rustpython_wasm dependency

Hi @coolreader18 : Progressed one more step. Now with no-start-func, it has created the pkg with wasm file. Now while using it, it is failing runtime with below error
/Users/satyajeetkolhapure/TruffleProject/TezosRustPython/PytezosRustPython/pkg/PytezosRustPython.js:1140
const wasmModule = new WebAssembly.Module(bytes);
                   ^

CompileError: WebAssembly.Module(): Wasm decoding failed: mutable globals cannot be exported @+16801
    at Object.<anonymous> (/Users/satyajeetkolhapure/TruffleProject/TezosRustPython/PytezosRustPython/pkg/PytezosRustPython.js:1140:20)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/Users/satyajeetkolhapure/TruffleProject/TezosRustPython/PytezosRustPython/runwasm.js:1:12)
    at Module._compile (internal/modules/cjs/loader.js:778:30)

Hi @coolreader18 : Progressed one more step. Now with no-start-func, it has created the pkg with wasm file. Now while using it, it is failing runtime with below error
/Users/satyajeetkolhapure/TruffleProject/TezosRustPython/PytezosRustPython/pkg/PytezosRustPython.js:1140
const wasmModule = new WebAssembly.Module(bytes);
                   ^

CompileError: WebAssembly.Module(): Wasm decoding failed: mutable globals cannot be exported @+16801
    at Object.<anonymous> (/Users/satyajeetkolhapure/TruffleProject/TezosRustPython/PytezosRustPython/pkg/PytezosRustPython.js:1140:20)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/Users/satyajeetkolhapure/TruffleProject/TezosRustPython/PytezosRustPython/runwasm.js:1:12)
    at Module._compile (internal/modules/cjs/loader.js:778:30)

Hi @coolreader18
I managed to run new package with new changes. I am not sure how to use it though.
I created mymodule.py inside deps folder in my new crate. Created pkg using wasm-pack command.
mymodule.py looks like below
def getPrintString():
    return 'Hello world'

Then I created main.py like below
from mymodule import getPrintString
print(getPrintString())

I then created runwasm.js like below
const rp = require('/Users/satyajeetkolhapure/TruffleProject/TezosRustPython/PytezosRustPython/pkg_old/PytezosRustPython.js')
const fs = require('fs')

const content = fs.readFileSync('main.py').toString()
rp.pyEval(content)

But I am getting below error
Error parsing Python code: Got unexpected token 'print' at line 2 column 1
print(getPrintString())

Any idea?

Hi @coolreader18
I managed to run new package with new changes. I am not sure how to use it though.
I created mymodule.py inside deps folder in my new crate. Created pkg using wasm-pack command.
mymodule.py looks like below
def getPrintString():
    return 'Hello world'

Then I created main.py like below
from mymodule import getPrintString
print(getPrintString())

I then created runwasm.js like below
const rp = require('/Users/satyajeetkolhapure/TruffleProject/TezosRustPython/PytezosRustPython/pkg_old/PytezosRustPython.js')
const fs = require('fs')

const content = fs.readFileSync('main.py').toString()
rp.pyEval(content)

But I am getting below error
Error parsing Python code: Got unexpected token 'print' at line 2 column 1
print(getPrintString())

Any idea?

You should call pyExec, not pyEval, pyEval expects one expression. Also, you have to have mymodule.py in the deps/ folder that gets frozen, wasm doesn't have access to the file system.

You should call pyExec, not pyEval, pyEval expects one expression. Also, you have to have mymodule.py in the deps/ folder that gets frozen, wasm doesn't have access to the file system.

@coolreader18 : You are awesome. It worked. Thank you so much for all your help and solving this problem.  It worked. Thank you so much for all your help and solving this problem. I will keep you posted when I try it with pytezos library.

Hi @coolreader18
While testing it for pytezos, I am getting error because of other dependencies which pytezos needs. Is it possible to copy whole venv as well with this? When I copy the whole venv folder inside deps folder, somehow it does not find packages.
e.g I have venv folder with all site-packages and one python file which uses those dependencies. How can I achieve it? Is there any way to add venv?

Hi @coolreader18
While testing it for pytezos, I am getting error because of other dependencies which pytezos needs. Is it possible to copy whole venv as well with this? When I copy the whole venv folder inside deps folder, somehow it does not find packages.
e.g I have venv folder with all site-packages and one python file which uses those dependencies. How can I achieve it? Is there any way to add venv?

@satyajeetkolhapure you should be able to point the py_freeze!(dir = "...") to your venv packages folder, though keep in mind that the more you include the larger the wasm binary will be

@satyajeetkolhapure you should be able to point the py_freeze!(dir = "...") to your venv packages folder, though keep in mind that the more you include the larger the wasm binary will be

@coolreader18 Somehow when I add packages folder with puy_freeze, it is not able to detect it.
I did below steps -

Created new python project with venv python 3.7 version
Installed pytezos package
Copied all the folders and files from vevn/lib/python3.7/site-packages folder to deps folder inside my new crate rust project
Built pkg using wasm command
Tried to import pytezos, it failed with module not found.
Probably site-packages are treated differently. If I manage to add pytezos as std-library in vm as others like html, email etc. I might be able to use it.

Is it possible to add it as standard library. I mean if I copy all pytezos libraries inside pylib-crate/Lib folder on my local machine vm repository, will those be added as standard libraries? or do I need something more than just copying?

@coolreader18 Somehow when I add packages folder with puy_freeze, it is not able to detect it.
I did below steps -

Created new python project with venv python 3.7 version
Installed pytezos package
Copied all the folders and files from vevn/lib/python3.7/site-packages folder to deps folder inside my new crate rust project
Built pkg using wasm command
Tried to import pytezos, it failed with module not found.
Probably site-packages are treated differently. If I manage to add pytezos as std-library in vm as others like html, email etc. I might be able to use it.

Is it possible to add it as standard library. I mean if I copy all pytezos libraries inside pylib-crate/Lib folder on my local machine vm repository, will those be added as standard libraries? or do I need something more than just copying?

@satyajeetkolhapure that's really weird, you can definitely try copying everything in deps/ to rustpython/Lib. Could you post what the contents of your deps/ folder looks like? Like just ls deps or something?

@satyajeetkolhapure that's really weird, you can definitely try copying everything in deps/ to rustpython/Lib. Could you post what the contents of your deps/ folder looks like?  Probably, this is causing it, may be because of obsolete import rather than relative.
Which version of python interpreter RustPython uses?

Hi @coolreader18 : I am using python3.7 to create those packages. Probably, this is causing it, may be because of obsolete import rather than relative.
Which version of python interpreter RustPython uses?

We don't really have a specific version we target, we're a mishmash of anywhere from 3.5 to 3.9. Have you changed your lib.rs at all? It's still vm.add_frozen(py_freeze!(dir = "deps")) ?

We don't really have a specific version we target, we're a mishmash of anywhere from 3.5 to 3.9. Have you changed your lib.rs at all? It's still vm.add_frozen(py_freeze!(dir = "deps")) ?

yes. it is still the same vm.add_frozen(py_freeze!(dir = "deps"))
I tried even copying all those files in Libs folder in vm. Somehow it found the main module. But it failed to find submodule. the paths used are obsolute. Not sure if that is the reason.

yes. it is still the same vm.add_frozen(py_freeze!(dir = "deps"))
I tried even copying all those files in Libs folder in vm. Somehow it found the main module. But it failed to find submodule. the paths used are obsolute. Not sure if that is the reason.

Which paths? (assuming you mean absolute). Like the imports are import pytezos.bar.baz instead of import ..bar.baz?

Which paths? (assuming you mean absolute). Like the imports are import pytezos.bar.baz instead of import ..bar.baz?

There might be some unresolved issues with recursive relative imports, I know there are a few instances in the standard library we've had to work around.

There might be some unresolved issues with recursive relative imports, I know there are a few instances in the standard library we've had to work around.

correct import pytezos.rpc is throwing error No module named 'pytezos.rpc'
could you help me with the workaround? if possible. if you point me to any example of workaround

correct import pytezos.rpc is throwing error No module named 'pytezos.rpc'
could you help me with the workaround? if possible. if you point me to any example of workaround

Were you ever able to get it working in the first place? Trying to import pytezos just using the native rustpython binary seems to error in a bunch of different ways.

Were you ever able to get it working in the first place? Trying to import pytezos just using the native rustpython binary seems to error in a bunch of different ways.

When I create new python project and installed pytezos package, I called pytezos as below
import pytezos from pytezos
print(pytezos)

Then I ran it in pycharm. I also tried command python3 filename.py
It gave me output
<pytezos.client.PyTezosClient object at 0x103cf59d0>

Properties
.key  # tz1grSQDByRpnVs7sPtaprNZRp531ZKz6Jmm
.shell  # https://rpc.tzkt.io/delphinet/ (delphinet)

Helpers
.account()
.activate_account()
.balance()
.ballot()
.contract()
.delegation()
.double_baking_evidence()
.double_endorsement_evidence()
.endorsement()
.nft_app()
.now()
.operation()
.operation_group()
.origination()
.proposals()
.reveal()
.seed_nonce_revelation()
.transaction()
.using()

Process finished with exit code 0

I had to install below two on mac os
$ brew tap cuber/homebrew-libsecp256k1
$ brew install libsodium libsecp256k1 gmp

pytezos documentation link - https://pypi.org/project/pytezos/
Appreciate your help @coolreader18

When I create new python project and installed pytezos package, I called pytezos as below
import pytezos from pytezos
print(pytezos)

Then I ran it in pycharm. I also tried command python3 filename.py
It gave me output
<pytezos.client.PyTezosClient object at 0x103cf59d0>

Properties
.key  # tz1grSQDByRpnVs7sPtaprNZRp531ZKz6Jmm
.shell  # https://rpc.tzkt.io/delphinet/ (delphinet)

Helpers
.account()
.activate_account()
.balance()
.ballot()
.contract()
.delegation()
.double_baking_evidence()
.double_endorsement_evidence()
.endorsement()
.nft_app()
.now()
.operation()
.operation_group()
.origination()
.proposals()
.reveal()
.seed_nonce_revelation()
.transaction()
.using()

Process finished with exit code 0

I had to install below two on mac os
$ brew tap cuber/homebrew-libsecp256k1
$ brew install libsodium libsecp256k1 gmp

pytezos documentation link - https://pypi.org/project/pytezos/
Appreciate your help @coolreader18

Right, but were you ever able to get it working in rustpython? RustPython isn't fully compatible with CPython yet, and looking at what pytezos depends on, it looks like there are some native modules, which RustPython probably won't support any time soon.

Right, but were you ever able to get it working in rustpython? RustPython isn't fully compatible with CPython yet, and looking at what pytezos depends on, it looks like there are some native modules, which RustPython probably won't support any time soon.

I was not able to run it using rustpython yet.
Possible. I think, I need to wait for those native modules be part of rustpython then.
Will it be a long task to add those native modules? Just to get an idea

I was not able to run it using rustpython yet.
Possible. I think, I need to wait for those native modules be part of rustpython then.
Will it be a long task to add those native modules? Just to get an idea

Well it wouldn't really be adding them, it would be adding support for native extensions. Alternatively, you could translate every native module that pytezos depends on to rust and include it in your wasm binary, but I don't even know if that's possible - it looks like there's lots of crypto stuff as well as http requests, which can't be made from wasm

Well it wouldn't really be adding them, it would be adding support for native extensions. Alternatively, you could translate every native module that pytezos depends on to rust and include it in your wasm binary, but I don't even know if that's possible - it looks like there's lots of crypto stuff as well as http requests, which can't be made from wasm

Sorry for "leading you on" for so long, I hadn't ever looked up what pytezos is until today, I don't think it's possible to run in rustpython at the moment

Sorry for "leading you on" for so long, I hadn't ever looked up what pytezos is until today, I don't think it's possible to run in rustpython at the moment

@coolreader18 no problem mate

@coolreader18 no problem mate


fix: application profile, relationship occurrence defendants

PR Checklist
Please check if your PR fulfills the following requirements:

[X] The commit message follows our guidelines
[ ] Tests for the changes have been added (for bug fixes / features)
[ ] Docs have been added / updated (for bug fixes / features)

Issue Number: 28
PR Type
What kind of change does this PR introduce?

[X] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior? (Optional)

What is the new behavior?
Fix the relationship between occurrence and defendat tables

Other information (Optional)

LGTM


Periodic job running multiple job instances ?

Hi:
New to here : )
I created a periodic job in our project to sync customer profile data every one minute. It suppose to run only one job every minute, but i found every minue there are more than 1 job was running. And those jobs are with different ids
05-18 16:13:12.417 16147-20013/com.*.* I/JobExecutor: Finished job{id=5, finished=true, result=SUCCESS, canceled=false, periodic=true, class=CustomerSyncJob, tag=CUSTOMER_SYNC_JOB}
05-18 16:13:12.417 16147-20014/com.*.* I/JobExecutor: Finished job{id=2, finished=true, result=SUCCESS, canceled=false, periodic=true, class=CustomerSyncJob, tag=CUSTOMER_SYNC_JOB}

I dont think I created more than on job, those are the function I used to create job. And it only be called inside  Application's onCreate method once.
  public fun startCustomerSyncJob() {
        stopCustomerSyncJob()

        mCustomerSyncJobId = JobRequest.Builder(CustomerSyncJob.TAG)
                .setPeriodic(60000L) // 1 min
                .build()
                .schedule()
    }

    public fun stopCustomerSyncJob() {
        if (mCustomerSyncJobId is Int) {
            jobManager.cancel(mCustomerSyncJobId as Int)
            mCustomerSyncJobId = null
        }
    }

What might cause this issue ?

Hard to say what's wrong. Is it possible that mCustomerSyncJobId is null in stopCustomerSyncJob()? Do you store the value in a preference file?
In your case I would use JobManager#cancelAllForTag(tag) to cancel the job. Or you can use the shortcut down below.
        new JobRequest.Builder(DemoJob.TAG)
                .setPeriodic(TimeUnit.MINUTES.toMillis(1))
                .setUpdateCurrent(true) // calls cancelAlllForTag(DemoJob.TAG) for you
                .build()
                .schedule();

@vRallev
Thanks will try that.

Another question is If the app was recovered from a crash, is it possible to stop all previous running jobs during the startup ?

If my understanding was not wrong, with JobManager#cancelAllForTag(tag), I dont need to save jobId reference any more ?

Please start experimenting with the API or feel free to ask such questions at Stackoverlfow. That's not the purpose of issue tracking.
Really short: Use JobManager.cancelAll() to cancel all jobs. No, you don't to save the job ID in that case.


Mojolicious::Controller->url_for incorrectly decodes URI-special chars

Mojolicious version: 7.11
Perl version: 5.20.2
Operating system: Debian Linux Jessie (8)

Test file
See gist https://gist.github.com/dboehmer/439d86e1102348c4d081b01b22f96c46.
Steps to reproduce the behavior
Receive a 302 HTTP response with Location header with URI-special chars, e.g. Location: /#foo=42&bar=%2520 (The key bar should have the decoded value %20). The code behaves differently if the header value contains a ? instead of a #.
Expected behavior

$t->tx->req->to_string prints the request unmodified.
$t->tx->req->header('Location') returns the header unmodified.

Actual behavior

encoded chars are decoded while unencoded chars stay as there are, leading to invalid results, e.g. /#foo=42&bar=%20 for the input above.

Why I am doing this
I am actually trying to redirect the HTTP client to another URL with data in an anchor that might contains arbitrary characters that need to be encoded.
My original problem was that in my test the location header was reported being different from the value set in the server. With the help of #mojo IRC channel I tracked down the problem to url_for().

Ok so let me see if I understand correctly. You want to redirect_to to a different url within the same application, thus a relative url is used. You want some data in the fragment (anchor) section of the url.
From your example code I see that you are manually url encoding url that will become a "query parameter" in the fragment. I'm guessing you are doing some front-end-routing which tries to pretend that the fragment contains a query. I think you probably just need to encode/decode the fragment manually.
You can still use the functionality in Mojolicious to do so of course.
$ perl -Mojo -E 'say Mojo::URL->new("/")->fragment(Mojo::Parameters->new->pairs([foo => "bar", str => "foo://xyz?bar=baz+%20"]))'
/#foo=bar&str=foo%3A%2F%2Fxyz%3Fbar%3Dbaz%2B%2520

and to decode
$ perl -Mojo -E 'say Mojo::Parameters->new->parse(Mojo::URL->new("/#foo=bar&str=foo%3A%2F%2Fxyz%3Fbar%3Dbaz%2B%2520")->fragment)->param("str")'
foo://xyz?bar=baz

Now the next problem is maybe that by using redirect_to (which internally calls url_for) you might be getting a second encoding pass. To avoid this you can do one of the following (untested, but at least one of these should work).
First, pass an instance of Mojo::URL rather than a string. As I've shown above you can construct a Mojo::URL that looks correct and url_for simply passes that through rather than trying to manipulate it. Or second, set the location header yourself and render a 302 yourself.
get '/redir' => sub {
  my $c = shift;
  $c->res->headers->location($target);
  $c->rendered(302);
};

I don't think there is much else the framework can do for you and I don't immediately see a bug (though indeed url handling is some of the hardest stuff in web work). I'm going to close this for now. If you feel there is a true bug involved please add more detail and reopen.

FWIW: Mojo::URL::parse (called by url_for) decodes and unescapes a URL fragment part but not a query string. However, the reverse process isn't completely symmetric. The way Mojo::URL::to_string calls Mojo::Util::url_escape to reconstruct the fragment means that your already-escaped input value isn't "double-escaped" on output as you are expecting it to be in your second test. I think you may need to use some manual intervention to get the location header you want.

Yes, you'd need a special container for the fragment, like the query currently has. Hardly seems worth the trouble.

As discussed in IRC this is actually a problem in Mojo::URL. This module handles de-/encoding of fragments and other parts like the query differently. The reason for this seems to be that the query is represented by an object with internal state while the fragment is only a string with no state saying whether it's already encoded.
I've got some new test cases which might illustrate what's the problem better than before:

fragment is handled differently from query

say Mojo::URL->new("host?query=%25#fragment=%25");
# host?query=%25#fragment=%

constructing Mojo::URL objects results in unequal URLs, even when providing an existing Mojo::URL object

using Mojo::URL as a container for an URL makes you actually loose data

say Mojo::URL->new(Mojo::URL->new("host?query=%252627#fragment=%252627"));
# host?query=%252627#fragment=&27

passing a fragment part with obviously not encoded characters (♥ is from an example in Mojo::URL's POD, < or > also apply) makes Mojo::URL encode part of the fragment while the % isn't

say Mojo::URL->new("host#fragment=♥%25");
# host#fragment=%E2%99%A5%

Please define the encoding type of the string argument to constructor and the Mojo::URL->fragment() method and the type of fragment string stored inside a Mojo::URL object and allow passing either a completely encoded string or passing a completely unencoded string which gets completely encoded.
I invested a whole bunch of my time to work through the URL Living Standard but I wasn't able to identify if the document addresses this issue and what it says about it (if anything). If the design of Mojo::URL regarding this issue depends on this standard, please file a bug there.

Should we ever find a good reason to make changes in one of the specs, i think turning the fragment attribute into a method like this would work.
sub fragment {
  my $self = shift;

  return
    exists $self->{fragment} ? _decode(url_unescape $self->{fragment}) : undef
    unless @_;
  $self->{fragment} = shift;

  return $self;
}

This still doesn't make sense to me. dboehmer showed that an invalid URL could be produced from valid input:
say Mojo::URL->new("/foo?bar=1%25+nacl#1%25+nacl")
# /foo?bar=1%25+nacl#1%+nacl

which is invalid syntax according to RFC 3986, RFC 3987 and the URL Living Standard. Is there ever a case where a percent character can be represented in a URL by anything other than its percent-encoded value (%25)? The syntax rules in all 3 specs preclude it, but maybe there is more to the story.
Beyond that, there is an inconsistency in how Mojo::URL handles fragments. You get a different, valid URL if you supply the same input to the fragment accessor, unlike when parsing a full URL:
say Mojo::URL->new("/foo")->query("1%25+nacl")->fragment("1%25+nacl")
# /foo?1%25+nacl#1%25+nacl

As was pointed out in the earlier IRC discussion, this inconsistency arises because Mojo::URL->parse() unescapes a percent character in the fragment while Mojo::URL->to_string does not re-escape it on output. I can't see the reason for that call to url_unescape in parse(). The query part and fragment have the same syntax rules in all 3 specs, so I would expect them to get the same treatment as far as unescaping.
sri noted on IRC that this test failed if you remove the unescaping for URL fragments: https://github.com/kraih/mojo/blob/master/t/mojo/request.t#L2101
I think that test is using an invalid URL (contains unescaped percent character), so users relying on that behaviour would also be using invalid URLs.
I don't see any need for an object of some sort to manage fragments (as Mojo::Parameters may be used for query part). Fragments can be treated as opaque strings - there is no key=value convention for fragment as there is for query. Leave it up to users to construct a properly escaped URL for parsing, as Mojo::URL already assumes when string is passed to accessors. In this context, fragments are just strings that need to be properly escaped for inclusion in URLs. Except for percent signs, Mojo::URL already does this.

say Mojo::URL->new("/foo?bar=1%25+nacl#1%25+nacl")
# /foo?bar=1%25+nacl#1%+nacl

@ilainftw If this behavior is in fact not allowed by the specs, please open a new issue and report this as a bug, with references to the spec sections in question.

The URL living standard says in section 4.1

A URL-fragment string must be zero or more URL units.

and defines URL units

The URL units are URL code points and percent-encoded bytes.

A % is obviously not anything percent-encoded. Is it a URL code point? The list of valid code points says it's not.
I hate to quote from this document which defines everything just be linking to another paragraph. That makes even reading difficult, not to mention quoting a particular point.

I'm going to sum this up in a new issue as @kraih requested.


lorri daemon hangs on launch

When running lorri daemon there is not output from it, it just hangs with cursor on next line:

All I am doing is run lorri daemon in a project folder. I could reproduce this on different systems.

If it doesn’t throw an error, it is running successfully.
You need to do an action that will tell it which nix file to watch.
Currently, there are two commands that will trigger the daemon to watch a nix file:

Calling lorri direnv in a project directory (usually done by direnv, but can also be done manually)
Calling lorri ping_ /path/to/nix/file.nix (ping_ is the plumbing command to trigger the daemon, that’s why it has a trailing _)

We could print a message that the daemon has successfully started if it’s too confusing.

Especially note that lorri daemon doesn’t fork itself into the background, because that’s generally considered a design flaw nowadays.
There’s various ways to run the daemon automatically in the background, a few are documented in https://github.com/target/lorri/issues/96, but we should add official instructions in the future.

I think this is fixable by just printing a log message  like "Lorri: ready".

Yes, please add some visual feedback that the daemon is wokring. Currently it is very confusing.


Filter the content of an SMS by recognizing several words one after the other

Hello,
Thank you for creating such an awesome and well built app.
I added a regular expression to recognize text messages that contain the following words in a row: avant majoration http
For example, to block this type of text message: "ANTAI: Dernier rappel avant la majoration de votre amende à 135,00 euros: https://reglementsdirect.com"
Here is my regular expression, tested and validated on https://regex101.com/
.*avant.*majoration.*http.*
However, when I test in your SpamBlocker application, it tells me that the text message is accepted.
Can you help me find my error please?
Thank you.

Your regex works fine:

Please check the SMS history tab, it shows why messages are blocked or allowed. What's the reason in your case?

Thank you for your quick answer.
Here screenshots of my settings 👍

That's strange, can you export the configuration and paste here? (Json format)

{     "global": {         "enabled": true,         "callEnabled": true,         "smsEnabled": true     },     "theme": {     },     "language": {     },     "contacts": {         "enabled": true     },     "stir": {         "enabled": true,         "isExcusive": true     },     "repeatedCall": {         "enabled": true,         "times": 1,         "inXMin": 5     },     "dialed": {         "enabled": true,         "inXDay": 10     },     "recentApps": {         "list": [             "ee.mtakso.client"         ],         "inXMin": 10     },     "blockType": {     },     "offTime": {         "enabled": true,         "stHour": 19,         "stMin": 30,         "etHour": 21     },     "numberRules": {         "rules": [             {                 "id": 1,                 "pattern": "(?:33)?(1(?:62|63)|2(?:70|71)|3(?:77|78)|4(?:24|25)|5(?:68|69)|9(?:48|49))\\d{6}",                 "patternFlags": {                     "value": 5                 },                 "patternExtraFlags": {                     "value": 5                 },                 "description": "Bloqué appel pub",                 "flags": {                     "value": 1                 },                 "importance": 1,                 "schedule": "23456,00:00-00:00,true"             }         ]     },     "contentRules": {         "rules": [             {                 "id": 2,                 "pattern": ".*avant.*majoration.*http.*",                 "patternFlags": {                     "value": 5                 },                 "patternExtraFlags": {                     "value": 5                 },                 "description": "Spam Amende",                 "priority": 12,                 "flags": {                     "value": 3                 },                 "importance": 1,                 "schedule": ",00:00-00:00,false"             },             {                 "id": 1,                 "pattern": ".*veuillez.*http.*",                 "patternFlags": {                     "value": 5                 },                 "patternExtraFlags": {                     "value": 5                 },                 "description": "spam livraison ",                 "priority": 3,                 "flags": {                     "value": 3                 },                 "importance": 1,                 "schedule": ",00:00-00:00,false"             }         ]     },     "quickCopyRules": {         "rules": [             {                 "id": 1,                 "pattern": "(?<=code.{0,3})\\d+",                 "patternFlags": {                     "value": 5                 },                 "patternExtraFlags": {                     "value": 5                 },                 "description": "Copier code sms",                 "isBlacklist": false,                 "flags": {                     "value": 26                 },                 "schedule": ",00:00-00:00,false"             }         ]     } }

I can't reproduce the problem, it's blocked:

I use version 1.19 from Store F-Droid, with Android 14.

I just downloaded v1.19 from F-Droid and tried on Android 14, it still works.
This is really strange, is it just this message or rule not working? What about other rules? For example, does .* work at all?

The other rules work.
I am testing this rule with real messages that I receive, so far I have only received one message with this new phone.

In fact, I am trying to filter spam sms that contain certain words in the message like please, delivery - surcharge, fine.
In France, there are spams with fines, social assistance, parcels in delivery, etc...
And to spot a spam sms, you have to recognize several words in a certain order.
However, to match several spam sms, it is necessary to use different regular expressions.
I have not found any other solutions to simplify this type of spam SMS filtering.
Below are examples of spam sms (translated into English)
ANTAI: Last reminder before the increase of your fine to 135.00 euros: https://reglementsdirect.com
La Poste
Following the Paris 2024 Olympic Games and despite our efforts, your package No.: CAC09244 has suffered a delivery problem.
Please update your delivery information on our website: https://mes-services-colissimo.info
UPS: Your package has been put on hold because it does not meet the weight requirements. Please go to the following address: https://ma-livraison-ups.com

What about this: .*(antai|olympic|ups).*, or simply .*https:.*
And what about the previous issue that passed by default, got any clue?

Thank you for your help.
I use this : .*(amende|livraison|ups).*https.*
It's working.
Congratulations, your app is very great !


fix: decoupling motivation text assets from plugin bundle

Motivation
Closes #128
Notes
I didn't feel like re-doing work, so I'll wait for #166 to go through then rebase once that is in.

Aight, this should be good to look an now.

LGTM 🥳


Deprecated instruction method

I am trying to send an instruction to my anchor program. But instruction, rpc and transaction -- all get a cross mark across them in VS code. I checked and found out that these properties of the Program class are deprecated. I want to know what the new method to send the transaction is? Also could somebody help me with this --- I have my solana wallet adapter in the header component.. But the UI button to send the transaction is in the main component. But on console logging wallet --- const wallet = useWallet(), I get an empty object in the main component. Can that be the reason behind not being able to send the transaction as sendTransaction is a method of useWallet(). The error message previously was about the property of program --- program.instruction.create. But now it says, cannot identify property sendTransaction of wallet.. The crossed property of program is still there though.. Also how can I send the wallet as a prop or anything from the header component to the main component --- both children of the app component if at all the empty object logging of wallet is the case?? Any help is much appreciated.. I really need to move on..

pls use discord for support https://discord.gg/GVRw4kHB


/usr/bin/ar: permission denied when running haste-boot

I can't run haste-boot after a fresh installation on El Capitan (via cabal). I immediately get "/usr/bin/ar: permission denied", even when running as root. This might be related to the ["System Integrity Protection"] (https://support.apple.com/en-us/HT204899) that Apple introduced in OS X El Capitan.
Edit: Seems to work if one disables SIP before running haste-boot (boot into safe mode and run "csrutil disable"), and then re-enables it again afterwords.

That's interesting, and slightly weird: Haste should never be calling ar. Does your .cabal/config contain shared: True or any other interesting flags? This seems like it may be related to, or at least the same kind of problem as, #348.

It's called by haste-boot which calls haste-cabal which tries to call ar. I can, sadly, reproduce. No shared-true.
And I'm pretty sure it's related to this main cabal issue

Building haste-cabal fails with:
Resolving dependencies...

Distribution/Simple.hs:106:8:
    Could not find module ‘System.Directory’
    Use -v to see a list of the files searched for.

Distribution/Simple/Utils.hs:199:8:
    Could not find module ‘System.Process’
    Use -v to see a list of the files searched for.

During the config step. Seems like it's a no-go at this moment :(.

@bananu7 I've run into the same issue it seems. I tried building cabal from source as stated in the README, and it includes unix <IP_ADDRESS> when run. But I still get the same error as above.
Did you get this working, if so, how? :)
Cheers

It was a while ago; I think that fixing unix got it to work though.

Alright, thanks for the lead! :)
On Thu, Mar 3, 2016 at 12:45 PM Bartek Banachewicz<EMAIL_ADDRESS>wrote:

It was a while ago; I think that fixing unix got it to work though.
—
Reply to this email directly or view it on GitHub
https://github.com/valderman/haste-compiler/issues/353#issuecomment-191722042
.

Until this is fixed (and even after that - this build is finicky), it's highly recommended that you use the pre-built binaries for non-Linux platforms. Not only does this have a substantially higher likelihood of working, but you also get niceties such as manual pages and not having to wait forever for haste-boot to complete.

I have downloaded the pre-build Haste binary and am trying to compile https://github.com/yamafaktory/reflex-starter with it.

haste-cabal init worked
haste-cabal install is throwing a /usr/bin/ar: permission denied

Unfortunately, I don't think using the pre-build binary is a solution, because the haste-cabal that comes with it still doesn't seem to work:
$ haste-cabal install parsec
haste-cabal: /usr/bin/ar: permission denied

Fixed as of release <IP_ADDRESS>.

So, time to try reflex-frp with haste now?
On 16 Oct 2016 4:06 am, "Anton Ekblad"<EMAIL_ADDRESS>wrote:

Fixed as of release <IP_ADDRESS>.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/valderman/haste-compiler/issues/353#issuecomment-254015262,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABu0W63w0Shuwtdnoo816D15x-nTh3oks5q0VV4gaJpZM4Gv6g-
.


[PHPStanRules] Improve PreventDuplicateClassMethodRule with mask names

Fixes #2683

@TomasVotruba masking variable names cause error in phpstan analyze process, while it works in phpunit tests:

 [WARNING] Reached internal errors count limit of 50, exiting...

 [WARNING] Internal error: Internal error: Call to a member function toString()
           on string in file
           /home/runner/work/symplify/symplify/packages/coding-standard/src/Toke
           nRunner/ValueObjectFactory/LineLengthAndPositionFactory.php
           Run PHPStan with --debug option and post the stack trace to:

Do you have any idea for it, currently, what I do is changing variable when same with classmethod parameter in the statements:
    private function getPrintStmts(ClassMethod $classMethod, array $stmts): string
    {
        $newStmts = $stmts;
        $maskName = 'a';
        foreach ($classMethod->params as $param) {
            $paramVariable = $param->var;
            if (! $paramVariable instanceof Variable) {
                continue;
            }

            $this->nodeFinder->find($newStmts, function (Node $node) use ($paramVariable, $maskName): void {
                if (! $this->nodeComparator->areNodesEqual($node, $paramVariable)) {
                    return;
                }

                $node->name = $maskName;
            });

            ++$maskName;
        }

        return $this->printerStandard->prettyPrint($newStmts);
    }
    ```

@TomasVotruba masking variable names cause error in phpstan analyze process, while it works in phpunit tests:

 [WARNING] Reached internal errors count limit of 50, exiting...

 [WARNING] Internal error: Internal error: Call to a member function toString()
           on string in file
           /home/runner/work/symplify/symplify/packages/coding-standard/src/Toke
           nRunner/ValueObjectFactory/LineLengthAndPositionFactory.php
           Run PHPStan with --debug option and post the stack trace to:

Do you have any idea for it, currently, what I do is changing variable when same with classmethod parameter in the statements:
    private function getPrintStmts(ClassMethod $classMethod, array $stmts): string
    {
        $newStmts = $stmts;
        $maskName = 'a';
        foreach ($classMethod->params as $param) {
            $paramVariable = $param->var;
            if (! $paramVariable instanceof Variable) {
                continue;
            }

            $this->nodeFinder->find($newStmts, function (Node $node) use ($paramVariable, $maskName): void {
                if (! $this->nodeComparator->areNodesEqual($node, $paramVariable)) {
                    return;
                }

                $node->name = $maskName;
            });

            ++$maskName;
        }

        return $this->printerStandard->prettyPrint($newStmts);
    }
    ```

@TomasVotruba it seems masking variable in classmethod statements, the classmethod params need to be updated as well, and this is will cause another error, as comments needs to be updated as well, eg: @param ClassMethod $node to be @param ClassMethod $a_86f7e437fa

@TomasVotruba it seems masking variable in classmethod statements, the classmethod params need to be updated as well, and this is will cause another error, as comments needs to be updated as well, eg: @param ClassMethod $node to be @param ClassMethod $a_86f7e437fa

I already synced the comments with new masks, but it seems phpstan still read old comments attributes:
        $comments = $newClassMethod->getAttribute(PhpParserAttributeKey::COMMENTS);
        foreach ($oldVariablesNames as $oldVariablesName) {
            foreach ($comments as &$comment) {
                if (! $comment instanceof Doc) {
                    continue;
                }

                $text = (string) $comment->getText();
                $text = str_replace($oldVariablesName, $newVariableNames[$oldVariablesName], $text);
                $comment = new Doc($text);
            }
        }

        $newClassMethod->setAttribute(PhpParserAttributeKey::COMMENTS, $comments);

I already synced the comments with new masks, but it seems phpstan still read old comments attributes:
        $comments = $newClassMethod->getAttribute(PhpParserAttributeKey::COMMENTS);
        foreach ($oldVariablesNames as $oldVariablesName) {
            foreach ($comments as &$comment) {
                if (! $comment instanceof Doc) {
                    continue;
                }

                $text = (string) $comment->getText();
                $text = str_replace($oldVariablesName, $newVariableNames[$oldVariablesName], $text);
                $comment = new Doc($text);
            }
        }

        $newClassMethod->setAttribute(PhpParserAttributeKey::COMMENTS, $comments);

I have idea, save class method content first to variable, replace all variable in string content with same variable, save, compare

I have idea, save class method content first to variable, replace all variable in string content with same variable, save, compare

finally working 🎉

finally working 🎉

All checks have passed 🎉 @TomasVotruba it is ready for review.

All checks have passed 🎉 @TomasVotruba it is ready for review.

rebased.

rebased.

phpunit notice is unrelated:

There was 1 failure:

1) Symplify\PHPStanRules\Tests\Rules\ForbiddenArrayWithStringKeysRule\ForbiddenArrayWithStringKeysRuleTest::testRule with data set #0 ('/home/runner/work/symplify/sy...gs.php', array(array('Array with keys is not allowe...nstead', 11)))
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'11: Array with keys is not allowed. Use value object to pass data instead
+'
 '

phpunit notice is unrelated:

There was 1 failure:

1) Symplify\PHPStanRules\Tests\Rules\ForbiddenArrayWithStringKeysRule\ForbiddenArrayWithStringKeysRuleTest::testRule with data set #0 ('/home/runner/work/symplify/sy...gs.php', array(array('Array with keys is not allowe...nstead', 11)))
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'11: Array with keys is not allowed. Use value object to pass data instead
+'
 '

rebased.

rebased.

All checks have passed 🎉 @TomasVotruba it is ready for review.

All checks have passed 🎉 @TomasVotruba it is ready for review.

Rebased. All checks have passed 🎉 @TomasVotruba it is ready for review.

Rebased. All checks have passed 🎉 @TomasVotruba it is ready for review.

I've added ability to differentiate start method point base method param count so same method with different param will be marked as different comparation.

I've added ability to differentiate start method point base method param count so same method with different param will be marked as different comparation.

All checks have passed 🎉 @TomasVotruba it is ready for review.

All checks have passed 🎉 @TomasVotruba it is ready for review.

rebased.

rebased.

@TomasVotruba phpunit notice is unrelated.

@TomasVotruba phpunit notice is unrelated.

rebased.

rebased.

All checks have passed 🎉 @TomasVotruba it is ready for review.

All checks have passed 🎉 @TomasVotruba it is ready for review.

rebased.

rebased.

All checks have passed 🎉 @TomasVotruba it is ready for review.

All checks have passed 🎉 @TomasVotruba it is ready for review.

@TomasVotruba after rebase, rector action got the following error:

 [ERROR] Could not process
         "packages/phpstan-rules/src/Rules/PreventDuplicateClassMethodRule.php"
         file, due to:
         "Analyze error: "Class  was not found while trying to analyse it -
         discovering symbols is probably not configured properly.". Include your
         files in "$parameters->set(Option::AUTOLOAD_PATHS, [...]);" in
         "rector.php" config.
         See https://github.com/rectorphp/rector#configuration".

Do you have idea?

@TomasVotruba after rebase, rector action got the following error:

 [ERROR] Could not process
         "packages/phpstan-rules/src/Rules/PreventDuplicateClassMethodRule.php"
         file, due to:
         "Analyze error: "Class  was not found while trying to analyse it -
         discovering symbols is probably not configured properly.". Include your
         files in "$parameters->set(Option::AUTOLOAD_PATHS, [...]);" in
         "rector.php" config.
         See https://github.com/rectorphp/rector#configuration".

Do you have idea?

@TomasVotruba I added packages/phpstan-rules/src/Rules/PreventDuplicateClassMethodRule.php to rector exclude due weird error Class  was not found while trying to analyse it above.

@TomasVotruba I added packages/phpstan-rules/src/Rules/PreventDuplicateClassMethodRule.php to rector exclude due weird error Class  was not found while trying to analyse it above.

All checks have passed 🎉 @TomasVotruba I think it is ready.

All checks have passed 🎉 @TomasVotruba I think it is ready.

All checks have passed 🎉 @TomasVotruba I think it is ready.

All checks have passed 🎉 @TomasVotruba I think it is ready.

rector notice finally solved 🎉 it was unitialized array assignment to append.

rector notice finally solved 🎉 it was unitialized array assignment to append.

All checks have passed 🎉 @TomasVotruba I think it is ready.

All checks have passed 🎉 @TomasVotruba I think it is ready.

This looks good, thank you :+1:

This looks good, thank you :+1:


Have instances of a generic function

Can I have an instance of a generic function?
For example I have a function like this:
function pushType<T>(item: T, list: T[]): T[]{
    list.push(item);
    return list;
}

If I would like to use with number parameter in multiple places, I have to do this:
pushType<number>(12, [3, 4, 5]);
pushType<number>(1, [4, 5]);

Can I have an instance of this function for numbers instead of?
Something like this:
var pushNumber = pushType<number>; // this is syntax error now
pushNumber(12, [3, 4, 5]);
pushNumber(1, [4, 5]);

var pushNumber = pushType<number>; is now synax error and compiles to var pushNumber = pushType();
It would be nice I guess to compile it to var pushNumber = pushType;

You can just do:
var pushNumber: (i: number, list: number[]) => number[] = pushType;

Note there's no need to explicitly specify the generic type argument here.
function pushType<T>(item: T, list: T[]): T[]{
    list.push(item);
    return list;
}

pushType(12, [3, 4, 5]); // ok
pushType(1, [4, 5]); // ok
pushType(1, ['']); // error

Thanks danquirk. No need to explicit specify in that case, I agree.
However if I have the var pushNumber = pushType<number>; than a pushNumber('1', ['2']); is an error while the pushType('1', ['2']); is fine, so it's like a restricted version of a generic function.
CyrusNajmabadi's comment looks a solution for now, thanks. But I feel my my suggesion more elegant. Do you think is it against any language design or can it be a valid suggestion to implement later?

You might also be interested in https://github.com/Microsoft/TypeScript/issues/1616
The problem right now is that the system is not designed in such a way that you can instantiate a generic with a particular type and then 'finish' using it later (ie provide arguments). Certainly people are accustomed to doing something like what you are proposing in certain other languages with different implementations of generics. Given that there are a couple good workarounds (Cyrus' as well as defining a separate function constrained specifically to number which then forwards the call to a more generic version) we would likely need some more compelling use cases to consider complicating the type system like this.


Account launched with LB has (considerably) longer loading times than when launched normally

Hey ! Thanks a lot for LB, which I have been enjoying for quite a while now !
Lately on my laptop (4800HS 1660Ti Max Q) I've been noticing a weird behavior : launching a given account with LB will result in significantly longer loading times (up to four times longer) than launching the same account normally, despite both login methods having the very same parameters.
I've done a fresh GW2 install, and a fresh LB install. In LB I registered the account directly from the initial local.dat parameters, no arguments, no addons or injection of any kind.
And yet, I've timed loading into New Kaineng at ~13s while logged in the "normal" way, and at ~40s with LB.
Has anyone experienced the same thing perchance ?

all is fine here

Found the culprit ! For some reason, the "Active Protection" feature of Acronis True Image software (in its 2020 version at least) interferes with the mutex handling of LB, resulting in the observed reduced performance. Once disabled, problem goes away.


🐛 Bug Report — fetch fails locally with custom port on HTTPS

I'm trying to do a fetch request from a Worker to a local dev server over HTTPS and getting a 500 error.
The URL is something like this:
https://<IP_ADDRESS>:5555/some/path/etc

Wrangler only outputs this:
[wrangler:err] Error: internal error
   at (stack trace)
[wrangler:inf] GET /some/path/etc 500 Internal Server Error (19ms)

The request works as expected when disabling HTTPS in the dev server.
This is a bit of a pain because the server needs HTTPS for other features. So now we're required to manually enable/disable HTTPS when testing a single endpoint that is called from the Worker.
I'm getting this warning from Wrangler:

WARNING: known issue with fetch() requests to custom HTTPS ports in published Workers

Which refers to published workers, and I'm testing this locally.

According to this custom ports are supported now: https://developers.cloudflare.com/workers/configuration/compatibility-dates/#allow-specifying-a-custom-port-when-making-a-subrequest-with-the-fetch-api
But I still get that warning on local dev  🤔

Same here @ivanfgm!
Have you tried once deployed to CF network?

Same here @ivanfgm! Have you tried once deployed to CF network?

Just got the chance to try on a deployed instance. Works perfectly, faultlessly, superbly, excellently, flawlessly, to perfection, without fault, ideally, impeccably, exquisitely.


SystemError: error return without exception set

I had this working, reinstalled OS after switching from Pizero to Pi3.  I can't seem to get the luma.spi stuff working. I have spi loaded (dtparam=spi=on,  modules spidev and spi_bcm2835 loaded, /dev/spidev0.0  exists.  If I load the RPi.GPIO module I can set/test the CS0 line, but with or without it, luma.core.interface.serial.spi can't seem to open spi0.0. Here's what happens when I try to talk to spi.
from luma.core.interface.serial import spi
serial = spi(device=0, port=0)
oled = ssd1322(serial, width=256, height=64, rotate=2)

/usr/local/lib/python3.7/dist-packages/luma/core/interface/serial.py:185: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  self._gpio.setup(pin, self._gpio.OUT)
Traceback (most recent call last):
  File "./oled.py", line 18, in <module>
    serial = spi(device=0, port=0)
  File "/usr/local/lib/python3.7/dist-packages/luma/core/interface/serial.py", line 285, in __init__
    self._spi.cshigh = cs_high
SystemError: error return without exception set

I don't see any process being launched, however lsof shows that root has a spi0 process open (spawned by kthreadd). My user is in the spi group and it doesn't matter if I run the script as root - I still get the error. Any ideas what I'm doing wrong?

See https://github.com/rm-hull/luma.led_matrix/issues/225
Try sudo pip3 install --upgrade --force-reinstall luma.oled luma.core spidev

Tried with same results. I did see this however:
luma-core 1.14.1 has requirement spidev<=3.4; platform_system == "Linux", but you'll have spidev 3.5 which is incompatible.
I downgraded which cleared the error, but it's still not working (when it was prior)

There are two more of us with the exact same issue. We think it might have occurred with the last Raspian update.

There is now a third with the exact same issue. Stopped working after a updating Raspian.

I to am having the same problem "SystemError: error return without exception set".  I tried the suggestions here but it still doesn't work. I have eight Pi's that have clock displays that no longer work as of an upgrade I did a week or so ago.
There is a lot more than just a handful of people with this problem.

Does anyone have a last known good data point? Here's a bit more on who has the spi device open:
sudo lsof |grep spi
spi0       179                           root  cwd       DIR      179,2     4096          2 /
spi0       179                           root  rtd       DIR      179,2     4096          2 /
spi0       179                           root  txt   unknown                                /proc/179/exe
However /proc/179/cmdline is empty and while there is a /dev/spi0 device file, there doesn't appear to be any sort of executable called spi0 to run. I also see no spi related entries in /var/log/apt (but that only means it didn't happen post imaging.)
top - 00:59:47 up 22:39,  1 user,  load average: 0.00, 0.00, 0.00
Tasks:   1 total,   0 running,   1 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.1 us,  0.0 sy,  0.0 ni, 99.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :    926.8 total,    519.5 free,     41.4 used,    365.9 buff/cache
MiB Swap:    100.0 total,    100.0 free,      0.0 used.    814.6 avail Mem
PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
179 root      20   0       0      0      0 S   0.0   0.0   0:00.00 spi0

@nathan-stewart2

Tried with same results. I did see this however:
luma-core 1.14.1 has requirement spidev<=3.4; platform_system == "Linux", but you'll have spidev 3.5 which is incompatible.

Can you try this instead:
$ sudo pip3 install --upgrade --upgrade luma.oled luma.core

I tried "sudo pip3 install --upgrade --upgrade luma.oled luma.core" andI get "SystemError: error return without exception set"
That doesn't fix it.
Max
On Thursday, August 6, 2020, 03:27:06 AM CDT, Richard Hull<EMAIL_ADDRESS>wrote:
@nathan-stewart2
Tried with same results. I did see this however:
luma-core 1.14.1 has requirement spidev<=3.4; platform_system == "Linux", but you'll have spidev 3.5 which is incompatible.
Can you try this instead:
$ sudo pip3 install --upgrade --upgrade luma.oled luma.core
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.

What version of spidev do you have installed?
Try: pip3 list | grep spidev to see the version.
If it is 3.5 please try to downgrade it with pip3 install spidev==3.4 --force-reinstall

In my 2nd post I mentioned that downgrading makes the error go away, however it still doesn't actually work.

however it still doesn't actually work

Can you be more descriptive?
How have you got the display wired up?
If you run the main luma.examples demo, what do you see on the screen? What command-line args did you use?

I have tried all the suggestions here which are,
sudo pip3 install --upgrade luma.oled luma.coresudo pip3 install --upgrade --upgrade luma.oled luma.corepip3 install spidev==3.4 --force-reinstallpip3 list | grep spidev  which shows 3.4
I get "SystemError: error return without exception set" whenever I try to run your python clock program. This had been working without any problems prior to doing an update/upgrade a few weeks ago.
Please let me know if there is anything you would like me to try.
Max
On Tuesday, August 11, 2020, 05:16:16 AM CDT, Richard Hull<EMAIL_ADDRESS>wrote:

however it still doesn't actually work
Can you be more descriptive?
How have you got the display wired up?
If you run the main luma.examples demo, what do you see on the screen? What command-line args did you use?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.

@MaryAlphaXray

try to run your python clock program

Please give the exact command you are using

Either ./clock_7seg.py or python clock_7seg.py gives the same error.
Traceback (most recent call last):  File "clock_7seg.py", line 63, in     main()  File "clock_7seg.py", line 45, in main    serial = spi(port=0, device=0, gpio=noop())  File "/usr/local/lib/python2.7/dist-packages/luma/core/interface/serial.py", line 281, in init    self._spi.cshigh = cs_highSystemError: error return without exception set
Max
On Tuesday, August 11, 2020, 04:11:47 PM CDT, Richard Hull<EMAIL_ADDRESS>wrote:
@MaryAlphaXray
try to run your python clock program
Please give the exact command you are using
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

@MaryAlphaXray
Notice this: /usr/local/lib/python2.7/dist-packages/luma/core/interface/serial.py ... python 2.7
I imagine if you did pip list | grep spidev it will show spidev version 3.5 is installed under python 2.7
Try: python3 clock_7seg.py

I'll pin this issue since it comes up a lot lately.

Running pip list | grep spidev shows 3.4.
When I run "python3 clock_7seg.py" I get
python3 clock_7seg.py  File "clock_7seg.py", line 48    seg.device.contrast(0x00)                            ^TabError: inconsistent use of tabs and spaces in indentation
I don't know enough about python to know how to fix this either.
Thanks, Max
On Tuesday, August 11, 2020, 04:36:44 PM CDT, Richard Hull<EMAIL_ADDRESS>wrote:

@MaryAlphaXray
Notice this: /usr/local/lib/python2.7/dist-packages/luma/core/interface/serial.py ... python 2.7
I imagine if you did pip list | grep spidev it will show spidev version 3.5 is installed under python 2.7
Try: python3 clock_7seg.py
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

@MaryAlphaXray Where did you get the clock_7seg.py file? It is not one I recognise from the luma.led-matrix nor luma.examples repos.
Have a look at this to fix the tabs vs. spaces issue: https://stackoverflow.com/questions/5685406/inconsistent-use-of-tabs-and-spaces-in-indentation. I would recommend using autopep8 as per the second answer to fix your issue.

The program is one of yours that has been renamed, sorry can't seem to find the original at the moment. It showed the date / time on a 8 character 7 segment display. I removed the date portion to show time only.
After I switched to using python3 and cleaned up the indention's it is working again, thanks.
Have you tried all of your example programs to see if they would run under python 3 ?
Thanks again, Max
On Wednesday, August 12, 2020, 01:56:57 AM CDT, Richard Hull<EMAIL_ADDRESS>wrote:
@MaryAlphaXray Where did you get the clock_7seg.py file? It is not one I recognise from the luma.led-matrix nor luma.examples repos.
Have a look at this to fix the tabs vs. spaces issue: https://stackoverflow.com/questions/5685406/inconsistent-use-of-tabs-and-spaces-in-indentation. I would recommend using autopep8 as per the second answer to fix your issue.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Ok, I can confirm it's working on Ubuntu 18.04, spidev 3.4,

Just so you know, I've also had to install libtiff5 and libopenjp2-7 on some of my Pi's to fix other errors when switching from Python to Python3. Even though spidev showed 3.4 I still had to run
pip3 install spidev==3.4 --force-reinstall
on some but not all of my Pi's.
Max
On Wednesday, August 12, 2020, 01:56:57 AM CDT, Richard Hull<EMAIL_ADDRESS>wrote:
@MaryAlphaXray Where did you get the clock_7seg.py file? It is not one I recognise from the luma.led-matrix nor luma.examples repos.
Have a look at this to fix the tabs vs. spaces issue: https://stackoverflow.com/questions/5685406/inconsistent-use-of-tabs-and-spaces-in-indentation. I would recommend using autopep8 as per the second answer to fix your issue.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

+1 seeing this error but I'm trying to get a display up and running for the first time. I've gone throw the installation as described in the wiki and tried the commands in this thread yet no dice

When I did the down grade to      pip3 install spidev==3.4 --force-reinstall
that worked for me.

Strange, pip3 list | grep spidev showed I had spidev 3.4 but pip3 install spidev==3.4 --force-reinstall removed the error. Still troubling the display but that may be a unrelated problem


[Windows] Optimize the drone build of Windows rke-tools

We need to increase the speed of Windows rke-tools build for Drone. For now, it took 20 mins for Windows build to complete.

Before it takes around 20mins for building rke-tools. https://drone-publish.rancher.io/rancher/rke-tools/55
Now it is 1 min https://drone-publish.rancher.io/rancher/rke-tools/60


Bugfix Reliability plot XML with EE loads to UI incorrectly

Describe the Problem
EE check boxes for Reliability plot don't get checked when XML is loaded to GUI
plot_20231013_193708.xml.txt
Expected Behavior
EE check boxes should be checked
Environment
Describe your runtime environment:
1. Machine: (e.g. HPC name, Linux Workstation, Mac Laptop)
2. OS: (e.g. RedHat Linux, MacOS)
3. Software version number(s)
To Reproduce
Describe the steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
Post relevant sample data following these instructions:
https://dtcenter.org/community-code/model-evaluation-tools-met/met-help-desk#ftp
Relevant Deadlines
List relevant project deadlines here or state NONE.
Funding Source
Define the source of funding and account keys here or state NONE.
Define the Metadata
Assignee

[ ] Select engineer(s) or no engineer required
[ ] Select scientist(s) or no scientist required

Labels

[ ] Select component(s)
[ ] Select priority
[ ] Select requestor(s)

Projects and Milestone

[ ] Select Organization level Project for support of the current coordinated release
[ ] Select Repository level Project for development toward the next official release or add alert: NEED CYCLE ASSIGNMENT label
[ ] Select Milestone as the next bugfix version

Define Related Issue(s)
Consider the impact to the other METplus components.

[ ] METplus, MET, METdataio, METviewer, METexpress, METcalcpy, METplotpy

Bugfix Checklist
See the METplus Workflow for details.

[ ] Complete the issue definition above, including the Time Estimate and Funding Source.
[ ] Fork this repository or create a branch of main_<Version>.
Branch name: bugfix_<Issue Number>_main_<Version>_<Description>
[ ] Fix the bug and test your changes.
[ ] Add/update log messages for easier debugging.
[ ] Add/update unit tests.
[ ] Add/update documentation.
[ ] Push local changes to GitHub.
[ ] Submit a pull request to merge into main_<Version>.
Pull request: bugfix <Issue Number> main_<Version> <Description>
[ ] Define the pull request metadata, as permissions allow.
Select: Reviewer(s) and Development issues
Select: Organization level software support Project for the current coordinated release
Select: Milestone as the next bugfix version
[ ] Iterate until the reviewer(s) accept and merge your changes.
[ ] Delete your fork or branch.
[ ] Complete the steps above to fix the bug on the develop branch.
Branch name:  bugfix_<Issue Number>_develop_<Description>
Pull request: bugfix <Issue Number> develop <Description>
Select: Reviewer(s) and Development issues
Select: Repository level development cycle Project for the next official release
Select: Milestone as the next official version
[ ] Close this issue.

@TatianaBurek I wanted to point out that the documentation here says:
If agg_stat is turned on, event equalization must be turned off (it is done automatically).

Will this restriction still be applied in this bugfix?  Also, this apparently applies to all statistic types since the documentation doesn't say that it's restricted to only reliability plots.  Do you interpret it that way as well?
Thanks.


Keycloak Authentication Frontend Url

Hi,
I'm a data analyst, not a developer. That's why, I don't know how to handle kind of these things.
I developed Shiny applications  and ShinyProxy runs on 8080 port. In order to authenticate shinyproxy, I ran a keycloak docker container on 8081 port. I took a domain from IT department such as mydomain.com.
By using nginx and reverse proxy, I assigned the domain to http://my-ip-address:8080 (the shinyproxy app url).
When I want to go to the app (mydomain.com), I have to login with keycloak. and I see the frontend url on the browser like
http://*.* .*.* :8081/auth/realms/shinyproxy/protocol/openid-connect/auth?response_type=code&client_id=shinyproxy&redirect_uri=http%3A%2F%[2Fmydomain.com](http://2fmydomain.com/)%2Fsso%2Flogin&state=858f3a51-b2ba-499c-bef4-804170f2f82b&login=true&scope=openid

Do I need two different domains for this problem? For example,

App: app.mydomain.com
Keycloak: keycloak.mydomain.com

Or can I use single domain for both of them? If it is possible, how nginx file or keycloak settings should be?
I couldn't any advise or documentation for this problem from the begining to the end.

Hi
You can use both shinyproxy and nginx on the same domain name.
The easiest way is to have both keycloak and shinyproxy running under a sub-path. E.g. https://example.com/keycloak and https://example.com/shinyproxy.
When logging into ShinyProxy using keycloak, it's correct that you'll be redirected to the URL of keycloak. After login, you'll be redirect back to shinyproxy.
Here is an example nginx configuration:
server {
	listen 80;
	server_name           example.com
	rewrite     ^(.*)     https://$server_name$1 permanent;

}

server {
	listen 443 ssl;

	server_name           example.com

        #ssl_certificate  .. ;
        #ssl_certificate_key  ..;

   	location /shinyproxy {
		proxy_pass          http://<IP_ADDRESS>:8080/shinyproxy;

		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
		proxy_read_timeout 600s;

		proxy_redirect    off;
		proxy_set_header  Host             $http_host;
		proxy_set_header  X-Real-IP        $remote_addr;
		proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
		proxy_set_header  X-Forwarded-Proto $scheme;
	}

   	location /keycloak {
		proxy_pass          http://<IP_ADDRESS>:9090/keycloak;

		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
		proxy_read_timeout 600s;

                proxy_buffers 8 128k;
                proxy_buffer_size 128k;

		proxy_redirect    off;
		proxy_set_header  Host             $http_host;
		proxy_set_header  X-Real-IP        $remote_addr;
		proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
		proxy_set_header  X-Forwarded-Proto $scheme;
	}

}

Hi, I think this question has been answered, therefore I'll close this issue, please open a new issue or re-open this issue if you are still experiencing an issue.


imagePullPolicy always for steps with non-pinned images

Tekton pods default to the IfNotPresent imagePullPolicy, leading to the possibility of missing updates to the images when they are referred by tag and already pulled by a past execution in the node where a TaskRun pod is scheduled.
This commit sets the imagePullPolicy to Always for the steps using non-pinned images referenced by tag.

/lgtm


Show JSHint errors/warnings on a file and folder levels

Hi,
I'm using VSCode for my JavaScript development and I also have JSHint configured. VSCode shows the errors/warnings when I open a file but it would be really useful if there was an indication within the File Explorer when a file has errors/warnings in it, an exclamation mark icon overlay for example. It would be even nicer if that overlay propagates to the parent folder and so on to the root folder (similar to how the it would show changed files). I think this error/warning overlay can help not only JS development but other languages as well.
Cheers,
Stan.

@stanislavgeorgiev Thanks for the suggestion! What version of VS Code are you using? There's a feature that was added in 1.20 that should do this: https://code.visualstudio.com/updates/v1_20#_error-indicators-in-the-explorer

Thanks for pointing that out @RMacfarlane. I'm using 1.22 and I guess I thought that the green highlighting is showing the changed files! Nevermind then and thanks for the help :+1: :)


[Digital Twins - Core] DigitalTwins Models - create, read, list, delete operations create models empty failing in nightly runs

Digital Twins - Core nightly test runs are failing with:

Error message:
expected 'Operation failed as models provided w…' to include 'should satisfy the constraint "MinIte…'
Stack trace:
AssertionError: expected 'Operation failed as models provided w…' to include 'should satisfy the constraint "MinIte…'
at Context. (/Users/runner/work/1/s/sdk/digitaltwins/digital-twins-core/test/public/testModels.spec.ts:105:14)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)

For more details check here:

https://dev.azure.com/azure-sdk/internal/_build/results?buildId=1613063&view=results

@abhinav-ghai, can you please have a look?

Could be related to PR #22029 where client side constraint validation was removed.

We've identified a issue on service side. We'll be rolling out a hotfix to address this issue. I'll provide ETA shortly.

The issue should be fixed now, where can we check the results of latest run?

This looks related to https://github.com/Azure/azure-sdk-for-js/pull/22029 change. This failing test is checking for MinItems constraint while passing empty values. Do we need to edit the test to look for a different error? Or since we are removing the constraint from SDK, remve this test altogether?

Do we need to edit the test to look for a different error?

@abhinav-ghai that ^ should be fine.

This has been resolved in #22363 . Nightly runs are green again: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=1671647&view=results


Minimal loading pretrain BEiT model

I want to ask if there is a minimal loading pre-trained model of BEiT because I want to use BEiT as a backbone in my research about multi-label classification. I don't need all the code in this repo but only the loading code for BEiT, but currently the loading code is so confusing for me, I think you should provide a torch hub model so that everyone can easily access to your model more.

Hi @thunanguyen , thanks for the good suggestion! Huggingface is working on merging BEiT models in their model hub (https://github.com/huggingface/transformers/pull/12994#event-5105605684 ). It would be much easier to load the checkpoints with user-friendly APIs.

BEiT has been merged: https://huggingface.co/transformers/master/model_doc/beit.html :)

Great! Will try it immediately! One more question though. Do you think the use of Squeeze layer like in SqueezeBERT can make the model smaller and faster? @donglixp


Update caches-warming.adoc with a note about maxRamMB

Add a note about documentCache not supporting maxRamMB setting properly.
Since Lucene's RamUsageEstimator doesn't understand the Document objects, it will default to 256 bytes. Depending on the real document size this can be wildly inaccurate and cause the cache to use several magnitudes more memory than expected.

For reference, I had documentCache with maxRamMB="128" consume 4.9 GB of memory. A quick web search indicated that others have stumbled on this issue before as well, so a nice little note in the documentation might help someone avoid the pitfall.

Thank you for the doc improvement, sorry it took so long to merge!


Cannot distinguish scenes with the same name.

In some cases, most of asset from asset store provides several example scenes that uses common names such as Main.unity, SampleScene.unity, Scene.unity and Test.unity. Distinguishing by name of scene might cause malfunction. So my suggestion is to use path to take uniqueness instead of name.
If you don't mind, I'll PR this branch.
Appreciate.

I'm not a maintainer, but I am the one who commit that feature.
It definitely useful when project contains many assets, so why not.
I have plans to make some settings in Project Settings for this asset, so I think it would be usefull to toggle between scene full path and name.

@Team-on
@cqtd
Thank you guys for contributing!😊
I'm really happy that you like my repo and it's useful😎👌

Thanks. I sent PR.

@Team-on
@cqtd
Thank you guys for contributing!😊
I'm really happy that you like my repo and it's useful😎👌
I fixed this problem by separating scenes with the same name with folders

Cool!

I checked again this, but I still have same issue because most of asset stores the scene in '.../scenes' directory.
My scenes are placed such as Assets/Scenes/Main.unity, Asset/Scenes/Bootstrap.unity.
And most assets placed sample scenes at Assets/${{ Plugin Name }}/Example/Scenes/SampleScene.unity

Hmmm so If you fixed this problem I'll merge your pull request

@cqtd
your changes make some problems
I can't open scenes that aren't in the build settings

Thanks. :D


feat(#4,#5): Google play deploy

feat(#4,#5): Google play deploy

Code Coverage

Total Project Coverage
100.00%
:white_check_mark:


help adding resources

Hi @daattali any interest in helping pull together a list of reasonably recent resources (at least your stuff!)

Hi, thanks for reaching out! I'll let you deal with organizing these into their proper sections (also because I don't want the headache of doing it :smile: ), but here's a bunch of links I think are useful. Many of them are my own stuff but I do try to make things generally applicable, so feel free to only include the ones you agree are useful. Also, great idea doing this, I think it's very much needed!
Maybe add sections for Shiny Server and shinyapps?

Sending data from Shiny to JavaScript and vice versa
Shiny articles has an extremely useful selection of excellent articles, I strongly urge everyone to go through most of them eventually (although this will be the third link to shiny.rstudio.com, so maybe it's a bit redundant)
How to get your own Shiny Server on the cloud to host your apps
showmeshiny - a huge gallery of Shiny apps
shinyapps google group
Shiny Server documentation
StackOverflow shiny questions
R-bloggers shiny articles
Blog post: Mimicking a Google Form with a shiny app
Blog post: Persistent data storage (and retrieval) in Shiny apps
App: saving and restoring session state of a shiny app (Joe Cheng)
GitHub repo: setup of a sample Shiny Server, with the config files and sample apps included

sweet - I will add these (thanks for collecting them).  Feel free to ping anyone else that may have additional resources. Else I'll just start munging through with github-wide and google searches until it (hopefully) gains some traction and people add pull requests for material they create.

maybe post on the google group telling people to make pull requests if they think they have a hig hquality resource that will be useful for others

i like it - good call

added in 55d72d07310b7ff6a167614f6405d29962a69a13


fix docker volume mount when building with docker under SELinux (#1500)

fixes #1500
Tested under Fedora and Ubuntu where SELinux is enabled.  I have not tested specifically with SELinux disabled.  Docker added the z and Z options in 1.7.  From man docker-run:

To change a label in the container context, you can add either of two suffixes :z or :Z to the volume mount. These suffixes tell Docker to relabel file objects on the shared volumes. The z option tells Docker that two containers share the volume content. As a result, Docker labels the content with a shared content label. Shared volume labels allow all containers to read/write content.  The Z option tells Docker to label the content with a private unshared label.  Only the current container can use a private volume.

ok, more reading, digging & experimentation..  The docker volume ":z" option causes docker to do a  chcon command (SELinux change context) under the covers on the specified directory on the HOST side.  This is a run time only context change on the specified file/directory, and a reboot or restorecon restores it back to default.  As @staebler pointed out users have raised concerns about the potential security concerns the host side change context may cause.
Alternatives:

Disable SELinux within the running container by specifying  --security-opt label:disable as a docker run option (@jpeeler mentioned this above)
Run with Docker in privileged mode (docker run --privileged).  Here Docker will enable access to all devices on the host as well as set some configuration in AppArmor or SELinux to allow the container nearly all the same access to the host as processes running outside containers on the host.

In my testing, both options works.  I think alternative 1 has the least security concerns or at least is the smallest hammer and doesn't involve changing host file context involved with the :z volume option.

recommitted with --security-opt label:disable option.


"ReferenceError: structuredClone is not defined" on running "npx freestyle dev"

Cloned the repo.
Ran npm install.
Tried running npx freestyle dev

But got this error message instead.
As shown in the screenshot Node version is 16.20.2 and NPM version 8.19.4

After upgrading node to version 18.19.1, this issue gets resolved though


Entering text in the Operator text field is slow

Entering carrier name in 'Operator' text field of a simulator (the default one for me) is slow, around half a second per letter on my Intel MacBook Air 2015.
CPU usage increases to 100 % in Activity Monitor.
Each time you press a key the console logs 2021-01-30 15:59:12.656254+0100 simctl[86698:5943382] Metal API Validation Enabled.
Application compiled in Release Mode.
Profiling with the SwiftUI debugger shows that it triggers many .body recomputations for each typed letter. I feel like the problem is in the Preferences definition which is defined as an ObservedObject observing UserDefaults values. Its .objectWillChange() is triggered if any of its property is updated, which triggers .body recomputations in every view with depends on Preferences, even if those views do not use any Preferences property that changed.

Same thing is happening on my MacBook Pro 2018, on both 'Operator' and 'Open URL' text fields.
I found a fix for it by creating a separate @State variable in the View for the TextField text and then assigning that to corresponding Preferences var after the user enters the text, instead of directly accessing the Preferences var from the TextField.
I'm not sure if this is the best solution to the problem so I'll let someone else chime in before opening a PR.

Same thing is happening on my MacBook Pro 2018, on both 'Operator' and 'Open URL' text fields.
I found a fix for it by creating a separate @State variable in the View for the TextField text and then assigning that to corresponding Preferences var after the user enters the text, instead of directly accessing the Preferences var from the TextField.
I'm not sure if this is the best solution to the problem so I'll let someone else chime in before opening a PR.

The issue is with the Preferences definition.
Profiling with the SwiftUI debugger shows that it triggers hundreds of .body recomputations plus the filtering of simulators list (among other things) for each letter typed.
Preferences published property objectWillChange is triggered when any of the Published properties is updated, i.e. when any UserDefault value is updated, thus including the filtered text, the url, the push text, the carrier text, etc...
IMO there is a design flaw here, the properties in Preferences should not be coupled like they are currently because it creates a tight dependency and shared state among views.
One solution could be to break this class apart and only reference the relevant state in views with @AppStorage instead of referencing an entire ObservedObject. Some data is local, e.g. pushPayload and carrierName belong to the NetworkView and should be internal state instead of shared state.
For instance Preferences could be break apart into multiple ObservedObjects such as Preferences, NetworkPreferences, etc, to decouple it from the rest.

Yes, I agree with your diagnosis and solution – do you want to have a go at this?

Not a SwiftUI expert but I'll make an attempt!


Fix REST path to workitems

In https://github.com/almighty/almighty-core/issues/97 we've changed the core to list workitems under /api/workitems (notice the "s" at the end). The docker container of almighty-core is not using this at the moment but we try to get it in there as quick as possible.

This change is

Looks good.


Updates with complex claims.

Small update with support for complex claims, also clarified language in the tutorial text.

Thanks @oed for the review! I added the Math.floor function.


standardize naming around var_of_value/constant/var_of_t

We should probably call it constant

@amc-ie I see this task was moved to "Berkeley Triage". Do you remember why?

The berkeley triage board reflects a read only status of items from other boards; items should only appear on that board that have the 'berkeley-rampup' label. Sorry if I am not understanding this correctly!