[ZEPPELIN-3062] Removes ctrl+s default behavior from notebook

What is this PR for?
As a programmer I habitually press CTRL + S out of fear for my sanity.
Other web text editing tools (google docs, jupyter notebooks) ignore the base functionality of CTRL + S of saving the HTML page, and do nothing instead.
This is a small change that will makes the user experience of Zeppelin notebooks much much better.
What type of PR is it?
Improvement
Todos
What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-3062
How should this be tested?

I tested manually:

Ran yarn run dev
Went to localhost:9000
Created a new note, now anytime a user presses 'CTRL+S' in the scope of the note nothing happens, and the user can continue coding uninterrupted.

Screenshots (if appropriate)
Questions:

Thanks @tessbianchi for the contribution! It looks great to me.
One thing is OSX uses Command + S instead of CTRL + S for saving HTML page shortcut.

Do you think you can handle Command + S also in this PR?

Yes of course!

Alright added support for the command key. However, I do not have a mac and couldn't test it.
I implemented the second answer on https://stackoverflow.com/questions/3902635/how-does-one-capture-a-macs-command-key-via-javascript stackoverflow.

I tested that Command + s was ignored successfully on Mac.

Tested on my mac and windows. works well.
LGTM!

Can someone approve?

I'll merge to master if no further comments! Thanks @tessbianchi.

Roger! Thanks!


Google_Http_MediaFileUpload PHPDoc issues?

I've been using Google_Http_MediaFileUpload to upload videos to YouTube. I have no issue with the actual functionalities of the code, only with the type hinting that seems to be incorrect for a lot of the constructor / methods parameters.
Code example
The following code is mostly taken from the documentation.
$chunkSizeBytes = 10 * 1024 * 1024; // 10 MB
$fileSize = filesize($videoFile->getRealPath());

$this->googleClient->setDefer(true);

$insertRequest = $ytService->videos->insert(
    'snippet,status',
    $ytVideo
);

$media = new \Google_Http_MediaFileUpload($this->googleClient, $insertRequest, 'video/*', null, true, $chunkSizeBytes);
$media->setFileSize($fileSize);

This works perfectly fine, but triggers a lot of linting warnings from, for example, PHPStan or Intelephense in VSCode, because of the PHPDoc block of Google_Http_MediaFileUpload constructor.
Here's the warnings:

Parameter #2 $request of class Google_Http_MediaFileUpload constructor expects 'Psr\Http\Message\RequestInterface', 'Google_Service_YouTube_Video' given.
Parameter #4 $data of class Google_Http_MediaFileUpload constructor expects string, null given.
Parameter #6 $chunkSize of class Google_Http_MediaFileUpload constructor expects bool, int given.

For the first, I'm not really sure what's the issue here. Using the result of $ytService->videos->insert is what the doc says to do, but the returned type is not compatible at all (but it works when it actually runs, so it's correct...)
Is it intentional that $chunkSize is defined as a bool (seems weird to me, but maybe there's a reason)? $data should also specify |null.

I guess this might be related to googleapis/google-api-php-client-services#172 ?

I see It's been two years since this was reported, and I can confirm it's still an issue even with v2.12.6.
In a similar example, the ops report holds true both for $request (RequestInterface) and $chunkSize (bool)
$request = $this->service->videos->insert('snippet,status', $video, []); when $request passed onto the Google_Http_MediaFileUpload::construct() raises warning about

Expected parameter of type '\Psr\Http\Message\RequestInterface', '\Google\Service\YouTube\Video' provided

I'm about to find out wether passing the $insertRequest breaks the internal functionality for MediaFileUpload::process() since that method call is dependant on receiving the proper $request object.

I have just come across this issue in version [2.15.3] (https://github.com/googleapis/google-api-php-client/releases/tag/v2.15.3)
Is there anyway to fix it to stop it showing as a 'Problem' in VSCode?

@wayonhigh Yes there is. I just found out:
Add this line before 1293:
/** @var \Psr\Http\Message\RequestInterface $insertRequest */
It's a PHPDoc comment that clarifies the actual variable type.

@tinusg thank you! Actually, since I post that question, I moved from Intelephense to Devsense Intelliphp https://docs.devsense.com/en/vs/editor/intelliphp and it doesn't show as a "problem"

I'll check that out as well, thanks!


Show Fade % on Extension

Can return this from the inspect server for a call and annotate it on the page.

Closed in #154


MIDI Channels Presets

So, I was bored and implement #7 myself

Currently we can cause an error if we put a invalid insturment ID using the preset editor (the wrench icon), but I can deal with that now. Thanks!


AMBARI-22290: HDP + HDF installation fails (jluniya)

Change-Id: I8d30b30aa1c0b0e49f9e45fadac127e6a05ac90b
Forward port changes in AMBARI-22272 to Ambari 2.7. Revised patch to store applicable services in DB as repo definitions are now stored in the DB.
How was this patch tested?
Deployed HDP + HDF cluster and ensured that ZOOKEEPER doesn't consider HDF repo while deploying.
2018-05-17 14:43:33,448 - Command repositories: HDF-3.2-repo-1, HDP-3.0-repo-1, HDP-3.0-GPL-repo-1, HDP-UTILS-<IP_ADDRESS>-repo-1
2018-05-17 14:43:33,448 - Applicable repositories: HDP-3.0-repo-1, HDP-3.0-GPL-repo-1, HDP-UTILS-<IP_ADDRESS>-repo-1
2018-05-17 14:43:33,449 - Looking for matching packages in the following repositories: HDP-3.0-repo-1, HDP-3.0-GPL-repo-1, HDP-UTILS-<IP_ADDRESS>-repo-1
2018-05-17 14:43:44,611 - Adding fallback repositories: HDP-UTILS-<IP_ADDRESS>-repo-2
2018-05-17 14:43:48,525 - Package['zookeeper_3_0_0_0_1343'] {'retry_on_repo_unavailability': False, 'retry_count': 5}
2018-05-17 14:43:48,612 - Installing package zookeeper_3_0_0_0_1343 ('/usr/bin/yum -y install zookeeper_3_0_0_0_1343')

Please review Ambari Contributing Guide before opening a pull request.

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/Ambari-Github-PullRequest-Builder/2349/
Test PASSed.


Redirect user to calendarPage on login

Description
LoginWIthDiscord.js file is modified so that on login the user is redirected from landingPage to calendarPage.
Type of change
Please select everything applicable. Please, do not delete any lines.

[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] This change requires a documentation update

Issue
'Redirect user to Calendar when user logs in' #268
Checklist:

[ ] I have executed npm run lint and resolved any outstanding errors. Most issues can be solved by executing npm run format
[x] My code follows the style guidelines of this project
[ ] I have performed a self-review of my own code
[x] I have commented my code, particularly in hard-to-understand areas
[x] My changes generate no new warnings

Tested and it works. My only concern is that this prevents users from accessing the landing page when logged in. Would it be possible to have login redirect to the calendar page, but not lock a logged-in user from the calendar?
Tagging @MatthewBozin for visibility and he originally created the issue.

Yes I see, the logged in user cannot access 'Home' from the calendar. I'll take another look at this!

It seems to work now, there is freedom to move to any page whether logged in or not. :)
Whilst trying to fix it, I also worked out how to redirect to the landing page when the user logs out, so I've left that code in the logout function in useProvideAuth.js just in case it is desired, happy to remove it if not!

It appears to be working now! I also added code to redirect to the landing page on logout, in case that's desired but I'm happy to remove it if not, let me know if there's a better way of doing it and I'll give it another go

The code looks good to me, tested it and everything works!
I'm curious about the line spacing, was that due to a linter you are using? Would you mind altering your line spacing to have it conform with the rest of the codebase?
Otherwise, this looks ready to merge.

That's great! I have removed those empty spaces now. Sorry this was overlooked as I was adding and removing an if statement when I was trying to get the useEffect hook to work. Many thanks

That's great! I have removed those empty spaces now. Sorry this was overlooked as I was adding and removing an if statement when I was trying to get the useEffect hook to work. Many thanks

Great work!


feat: Inheritance support for Validation decorators

Add "InheritValidation" decorator to support validation inheritance from the parent class. Solves: https://github.com/pleerock/class-validator/issues/31

thank you very much for your efforts, but actually there was inheritance support in the class-validator, but there was a bug I just found and fixed here. Please take a look at current implementation if its okay for you then good, if no lets continue discussion here. If current implementation is okay then from your PR would be great to have a tests for this feature.
you can try latest version by npm i class-validator@next

Hi, I've tried the latest version and indeed, the bugfix solved the issue. I overlooked that piece of code when I implemented this change, sorry for that.
So I think this PR is obsolete now.

I'll release a new version as soon as you and @edcarroll decide if he finished with a new features and its good to go.
What about this PR, it would be great if you can adopt your test, and we merge only a test. Thank you

I think the test I added in this PR can be taken as is (only removing the line: @InheritValidation(MyClass)), since it should be tested separately to have clear visibility on this feature.
So do you want me to creat another PR with this test only or you want to copy it by yourself?

would be nice you just update this PR, so you'll appear in the list of contributions

I've updated the PR as discussed. So it contains only the unit test for this feature and also a small section in the README.md so it is clear that this is supported.

Thank you very much


fix: use the Vue3 setup syntax sugar

Fix: https://github.com/casdoor/casdoor-python-vue-sdk-example/issues/7

@Abingcbc @Nekotoxin plz review

lgtm


Consider metadata object for projects in build

    > How about we just establish the convention that all resource generators are passed the project name as a parameter?

Would that mean having a GeneratingScript class inherting the Script class ? That might work (from a DX perspective, that is)

passing arguments feels like programming in YAML, which is not a favourite pastime of mine.

Yeah I don't disagree there.

I'd rather that we make each script each own entry in scripts and a corresponding scala object. super clear and obvious, easy to run, easy to debug.

No configuration or flexibility, just that?

This is a little too strict for my taste, I do think it'd be interesting to allow for users to pass some configuration to the scripts in the bleep.yaml. Say someone wants to publish pre-built scripts as literal "plugins" : this would allow people to customise the behaviour of the plugin without having to touch 2 files (the build file to pull the dependency and configure a script project + a scala file).
To elaborate : if you have a metadata field in the projects configuration that'd receive an arbitrary Json object, bleep could pass that object to scripts and script implementors could use that to retrieve configuration elements however they please. If users would rather duplicate some Scala files instead of using yaml configuration, they'd totally be able to do that. What's more : you could deep-merge the metadata value of all the templates (and the one of the project itself) before passing it to the script. Imho, this would be coherent with the way bleep is configured (declaratively), generally speaking, and would prevent having to compile scala code when reconfiguring some aspects of the build (which is a one of the appeals of bleep, as having to compile a Scala-written build is detrimental to the snappiness of the build's commands)./
Originally posted by @Baccata in https://github.com/oyvindberg/bleep/pull/247#discussion_r1057545971

This can be a fine way of threading through whatever info you want from the build to scripts, and it can be mergeable just like the rest of the build


Allow dragging to establish matching connections

Several users in user studies attempted to drag between elements of the matching interface; while the interactions should not rely on dragging (think: touch interfaces), it should be supported.

Maybe include a dismissible hint toaster that explains that dragging is not required, the first time a user does it.


Investment Visualization Tare Page Correction

Description
In the DB we are storing thousands of metric tonnes of emissions, but this is not reflected in our presentation on the tare page.

Firthermore, we source our Exxon data dirrectly from them, so we need to update our citation on their tare page

Todo

[ ] Change tooltip to reflect thousands of metric tonnes
[ ] Change Exxon citation

Exon Mobile Citation
"""
The Scope 1, 2 and 3 emissions presented are sources from Exxon Mobil Corporation via their 2023 Advancing Climate Solutions Progress Report.
"""


Does json-iterator have length limitation in Unmarshal?

hi, I have a json string whose size is more than 150000 bytes. It turned out that encoding/json library can unmarshal this json string correctly but json-iterator can not based on my experiments.
So does json-iterator have length limitation in Unmarshal?

Sorry I can't share this json string directly because it is my company's data.


[#1486] fix: button text update

What changes were proposed in this pull request?
Updated button name from 'Submit' to 'Delete'
Why are the changes needed?
To make the button look more specific to it's task.
Fix: #1486
Does this PR introduce any user-facing change?
No

Hi @amananand20 , can you paste some pictures about this changes?


Windows playbook only works if machine is in inventory

This is not productive if we have developers wanting to run in their local machines or even through an alternate AWX install.
The same applies for the Unix playbooks.

Related: https://github.com/AdoptOpenJDK/openjdk-infrastructure/issues/532

@jdekonin Is this still required and if so do you have an idea of what might be required (Except for possibly having localhost as an option in the hosts: line in the top level playbook file? I don't believe it's possible to run ansible locally on a Windows machine.

I wanted to setup a machine via ansible tower but I had to either hack the host line in the main.yml or add the machine to an inventory.  Seems like an unwanted and unnecessary step if the machine isn't going into a build system where the inventory file is required.
How does the automated checks work?  Or do the automated checks work on windows yet?  For that matter the same issue would exist on linux.  How does the linux automated checks work?  Are those machine(s) in the inventory list?

@jdekonin Ref: https://github.com/AdoptOpenJDK/openjdk-infrastructure/blob/master/ansible/pbTestScripts/testScript.sh
At the moment it runs a sed against the hosts line to change it to all

That seems like an unneeded step.  One that I don't want to embed in AWX automation as its add complexity when its not required.  Why not just have the main.yml default to all?

@jdekonin Can this be closed due to https://github.com/AdoptOpenJDK/openjdk-infrastructure/pull/1017 ?

That only covers unix, I had wanted that change for windows too but I guess that didn't get done so I just opened a PR with the change.

Windows fix is in, therefore closing.


nimble/host: Fixes for UUID handling

This is more generic approach for issue described in https://github.com/apache/mynewt-nimble/pull/193.

@andrzej-kaczmarek Any way i can help get this merged? Looks like the tests are failing because they didn't get updated for the function rename:
nimble/host/test/src/ble_hs_test_util.c: In function ‘ble_hs_test_util_verify_tx_find_info_rsp’:
nimble/host/test/src/ble_hs_test_util.c:1268:13: error: implicit declaration of function ‘ble_uuid_init_from_mbuf’; did you mean ‘ble_uuid_init_from_buf’? [-Werror=implicit-function-declaration]
             ble_uuid_init_from_mbuf(&uuid, om, off, 2);
             ^~~~~~~~~~~~~~~~~~~~~~~
             ble_uuid_init_from_buf


Better documentation 1

A large collection of examples in the crate documentation all tested.
This should significantly improve the start-up cost for new users.

Actually, the test errors are in the #[extendr] macro:
error: custom attribute panicked
 --> src/lib.rs:16:1
  |
test src/lib.rs - (line 13) ... FAILED
6 | #[extendr]
test src/lib.rs - (line 31) ... ignored
  | ^^^^^^^^^^
  |
  = help: message: Unable to write R wrapper file to target directory: Os { code: 2, kind: NotFound, message: "No such file or directory" }

error[E0425]: cannot find function `init__fred` in this scope
  --> src/lib.rs:24:7
   |
14 |    fn fred;
   |       ^^^^ not found in this scope

error: aborting due to 2 previous errors

https://github.com/extendr/extendr/pull/87/checks?check_run_id=1591605832#step:9:54

The test errors are caused by the R wrapper code misfiring in doc tests. We need to separate metadata from
the wrapper code in a subsequent PR.
For now, I'll disable the doc test.

I've added simpler Robj::from (or r!) conversions to include arrays.
You should now be able to return an array (a fixed size list of values) from a function
or assign it to an object.
let my_list : Robj = list!(a = [1, 2, 3], b = [1., 2., 3.]);

Question: should I call f64 values "numeric" or "real".
robj.as_real_slice()
vs
robj.as_numeric_slice()

We now have dozens of example doc tests, more consistent names for functions and hopefully a broad spectrum
of support for many more ways of working.
Writing docs has the advantage that you need to fill in the gaps!
Check the docs by running cargo doc --target-dir /tmp/
Please prompt me if anything is missing.

Note the r!() and R!() macros.
The first generates an R object from rust.
The second generates an R object from R source code.
I hope to parameterise the R!() macro in future.

Question: should I call f64 values "numeric" or "real".

I guess we should follow R's terminology here; it should be "numeric" if we allow conversion from/to INTSXP (and LGLSXP?), otherwise "real."
c.f.

isReal(): https://github.com/wch/r-source/blob/90a3e7d8560e145ef01e1339127c6d67a9deba24/src/include/Rinternals.h#L1821
isNumeric(): https://github.com/wch/r-source/blob/90a3e7d8560e145ef01e1339127c6d67a9deba24/src/include/Rinlinedfuns.h#L961-L972

Overall looks great! One place where I see room for improvement, in particular for macros, is that it would help to add 1--2 sentences explaining in more detail what each macro does and what its arguments are, before showing the examples. Some macros are already there (e.g. rprint!) or are fine as is (e.g., factor!), but others need more detail.
A couple of specific comments:

I'm still not sure what the lang! macro does. If its purpose is to create a call, then I think this should be stated explicitly: "This macro can be used to create a function call. The first argument is the name of the function (provided as a string), and subsequent arguments are taken as arguments to the function. Arguments can be named, as in R. To evaluate the function call, use .eval() or .eval_blind()."
For the R! macro, it would be helpful to add something like the following: "The argument to this macro is arbitrary R code. Note that the code does not need to appear in quotes, but you do have to add a semicolon after every R statement. The macro takes the code and evaluates it with eval(), so the return value is of type Result<Robj, AnyError>."
I think having an r! macro and an R! macro is going to be a source of confusion. Maybe the r! macro could be renamed into ro! or rob! or rfrom!?
I agree with @yutannihilation regarding real/numeric.

The lang! macro creates an R language object which may be a call, and operator or other things.
We could call it "make_call!" and drop the eval_blind() (instead use eval().unwrap())
I'm going to rename the f64 functions to "real" from "numeric" then.
We haven't looked at complex in any detail, and I've left this alone for now.
There are a few complex number crates such as num_complex.

@andy-thomason One thing that just occurred to me: Both lang! and now call! probably can't handle function calls to namespaces. Normally you have to locate the namespace first and then you can use Rf_findFun() to find the function call in the name space.
As an example, see e.g. here:
https://github.com/clauswilke/sinab/blob/955d38cfb1dc1833433548ff638baf315daa4a4d/src/r_callbacks.c#L18-L19
where the get_namespace() function is defined here:
https://github.com/clauswilke/sinab/blob/955d38cfb1dc1833433548ff638baf315daa4a4d/src/r_callbacks.c#L3-L12
Maybe add macros lang_namespace! and call_namespace! that take a namespace as their second argument? Or modify lang! so it can take an R object as input and add a macro find_fun! that can locate a function in a namespace?

I've been avoiding thinking about environments and namespaces so far, but that suggestion is a good one.
I didn't know about Rf_findFun, but I'll read about it tomorrow.
I've switched to talking about "integer", "real", "logical" and "raw" for vectors.
We may make all the macros require unwrap() or ? and should write some examples.
I may also add a Mutex mechanism, so we can make multi-threaded R calls and run the
tests in parallel.

Yeah, it's pretty straightforward. There's Rf_findVar() to find any symbol and Rf_findFun() to only find functions. See e.g. here: https://github.com/hadley/r-internals/blob/master/environments.md
It's a good idea to use Rf_findFun() to construct a call, so if there's no such function you get a more informative error message.

@clauswilke We should probably merge this and take the pain of the big change!

Yes, I agree. Better to take several small steps. In particular since the squash commit will compress all of this into one a single commit.


Bump Minio universe package to latest release

This release includes a security fix.

Closed in favour of https://github.com/mesosphere/universe/pull/1122


Memory results not matching with the paper

Hello
I was wondering if anyone has tried to reproduce the results for GPU memory utilization from the paper. I am using the default hyperparameters but not able to reproduce the same results.
Below are the outputs I am getting on running RTE:
bash scripts/ladder_side_tuning_base.sh "0" "rte"
For traning:
***** train metrics *****
  epoch                      =        2.0
  init_mem_cpu_alloc_delta   =      261MB
  init_mem_cpu_peaked_delta  =      524MB
  init_mem_gpu_alloc_delta   =      865MB
  init_mem_gpu_peaked_delta  =        0MB
  train_mem_cpu_alloc_delta  =     1085MB
  train_mem_cpu_peaked_delta =        0MB
  train_mem_gpu_alloc_delta  =       46MB
  train_mem_gpu_peaked_delta =     4234MB
  train_runtime              = 0:00:59.58
  train_samples              =       2490
  train_samples_per_second   =      0.839
Memory utilization 5.1456630859375 GB

For eval:
***** eval metrics *****
  epoch                     =                2.0
  eval_accuracy             =            54.3478
  eval_average_metrics      = 54.347826086956516
  eval_loss                 =             0.2978
  eval_mem_cpu_alloc_delta  =                0MB
  eval_mem_cpu_peaked_delta =                0MB
  eval_mem_gpu_alloc_delta  =                0MB
  eval_mem_gpu_peaked_delta =             1136MB
  eval_runtime              =         0:00:01.26
  eval_samples_per_second   =            109.105
Memory utilization 2.04748828125 GB

The published results are 5.5GB for training 0.88GB for inference (Table 1 in the paper). The percentage of trainable parameters is matching at 1.74% (also from Table 1). AFAIK this shouldn't depend on the platform beyond a reasonable margin of error. I'm using one v100 GPU with 16GB memory. Please let me know if I am missing something. Thank you!

For evaluation with batch size of 1, I'm getting the following results.
***** eval metrics *****
  epoch                     =                2.0
  eval_accuracy             =            54.3478
  eval_average_metrics      = 54.347826086956516
  eval_loss                 =             0.3541
  eval_mem_cpu_alloc_delta  =                0MB
  eval_mem_cpu_peaked_delta =                0MB
  eval_mem_gpu_alloc_delta  =                0MB
  eval_mem_gpu_peaked_delta =               11MB
  eval_runtime              =         0:01:04.25
  eval_samples_per_second   =              2.148
Memory utilization 0.92277490234375 GB

While this is close to the reported results, I am still wondering what I am missing.

I found the solution. So we should run the script with train set to false in the config file. In seq2seq/configs/side_transformers.json set "do_train": false and "per_device_eval_batch_size": 1 to get the numbers matching to that on the paper.


Why not also look inside the type for (static) to_json and from_json funtions?

My knowledge of template magic is limited, so I'm probably missing something :).
Static member functions can access private and protected members.
class Type {
  ...
public:
    static void to_json(json &j, const Type &p) {...};
    static void from_json(json &j, Type &p) {...};
}

The main reason I see to declare these functions outside the scope of Type is to allow to separate serialization completely, which isn't possible because you always need the friends declaration, have getters/setters for all your internal variables or worse, have everything public.
I would even look inside Type for a serializer for std::shared_ptr<Type>.
In case a practical example helps, I am trying to serialize a template<Type> that contains map of std::shared_ptr<Type>.

// T::ptr_type is a typedef for std::shared_ptr<T>
template<typename T>
class Resolvable
{
public:
	typedef 	T	ref_type;
	Resolvable() {};
	Resolvable(ref_type r) : mReference(r) {};

	ref_type &Reference() {return mReference; };

protected:
	ref_type mReference;
};

template<typename T>
class Resolver {
public:
	Resolver()
	{
		// force T to be of Resolvable
		(void)static_cast<Resolvable<typename T::ref_type>*>((T*)0);
	}

	typename T::ptr_type &resolve(const typename T::ref_type &r)
	{
		return mEntries.at(r);
	}

	typename T::ref_type add(const typename T::ptr_type t)
	{
		typename T::ref_type r = static_cast<Resolvable<typename T::ref_type>*>(t.get())->Reference();
		if (mEntries.find(r) != mEntries.end())
			throw std::runtime_error("Duplicate entry " + std::to_string(r) + ".");

		mEntries[r] = t;

		return r;
	}

	void remove(const typename T::ref_type r)
	{
		mEntries.erase(r);
	}

	static void to_json(json &j, const Resolver<T> &resolver)
	{
		for(const std::pair<typename T::ref_type, typename T::ptr_type> &entry: resolver.mEntries)
		{
			j.push_back(*(entry.second));
		}
	};

	static void from_json(json &j, Resolver<T> &resolver)
	{
		for (json &e : j)
		{
			typename T::ptr_type ptr = std::make_shared<T>();
			T::from_json(e, *ptr);
			resolver.add(ptr);
		}
	};

private:
	std::map<typename T::ref_type, typename T::ptr_type>	mEntries;
};

The problem lies in the Resolver::from_json function: I can't find a way to express T::from_json(e, *ptr); in another way. If I do (*ptr) = e;, *ptr = e.get<T>() or ::from_json(e, *ptr);, it can't find the serialization function (and I run out of alternatives).
I have it all working by using static member functions and declaring external helpers that forward to the static ones. It works, it probably all gets optimized away, but it requires a lot of useless code.
If the serializer would check for those functions in the type, none of it would be necessary.
I realize there are probably other good solutions for my problem here (feel free to suggest them) but the static member function seems so simple a solution (for my problem at least) that I had to ask why this is not supported.

I think this is the way dropbox/json11 is doing it. @theodelrieu, any thoughts on this?

It does fix the problem with resolving the ::from_json function.  Any ideas why?
In the mean time, I can remove a lot of code by doing:
template <typename T, typename SFINAE = typename std::enable_if<
		std::is_function<decltype(T::from_json)>::value and
		not std::is_member_pointer<decltype(T::from_json)>::value and
		std::is_function<decltype(T::to_json)>::value and
		not std::is_member_pointer<decltype(T::to_json)>::value
		, bool>::type>
static void to_json(json& j, const T& opt) {
	T::to_json(j, opt);
}
template <typename T, typename SFINAE = typename std::enable_if<
		std::is_function<decltype(T::from_json)>::value and
		not std::is_member_pointer<decltype(T::from_json)>::value and
		std::is_function<decltype(T::to_json)>::value and
		not std::is_member_pointer<decltype(T::to_json)>::value
		, bool>::type>
static void from_json(const json& j, T & opt) {
	T::from_json(j, opt);
}

So the template function will resolve for any object with static to_json and from_json functions.

PS: the problem I had with the ::from_json function in the Resolver is because the from_json function had a non-const json argument.

I switched to:
//
//	taken from http://stackoverflow.com/questions/87372/check-if-a-class-has-a-member-function-of-a-given-signature
//

template<typename U, typename T = U>
struct has_to_json
{
    template<typename S, void (*)(json& j, const T& opt)> struct SFINAE {};
    template<typename V> static char Test(SFINAE<V, &V::to_json>*);
    template<typename V> static int Test(...);
    static const bool value = sizeof(Test<U>(0)) == sizeof(char);
};
template<typename U, typename T = U>
struct has_from_json
{
    template<typename S, void (*)(const json& j, T& opt)> struct SFINAE {};
    template<typename V> static char Test(SFINAE<V, &V::from_json>*);
    template<typename V> static int Test(...);
    static const bool value = sizeof(Test<U>(0)) == sizeof(char);
};

//
// These template functions are automatically instantiated to
//   serialize any object T with static to_json and from_json
//   member functions.
//
template <typename T, typename std::enable_if_t<
		has_to_json<T>::value
		>>
inline void to_json(json& j, const T& opt) {
	T::to_json(j, opt);
};

template <typename T, typename std::enable_if_t<
		has_from_json<T>::value
		>>
inline void from_json(const json& j, T& opt) {
	T::from_json(j, opt);
};

But this does not always work correctly:

if the type T is in a std::vector, somehow I have to explicitly declare the conversion functions because the templates are ignored.
if the type T is a template itself, this doesn't seem to work either.

for the second case:
typedef GenericSet<uint32_t, my_set_detail::my_set_type_t> MySet;

is not matched by the template.

In any case, I got my code running the way I like it.
Feel free to incorporate the above code or close the issue.

I disagree, friend can enforce encapsulation, but like every feature, it is often mis/overused.
(How would you implement operator<< for Resolver? Either a friend, or you add an accessor)
This library doesn't require friend functions, it's up to the user to implement the from_json free function.
In your case, you don't have a way to access Resolvers private data, your static method could also be a friend, its only purpose is to access mEntries (one cool bonus with the friend, is that it's non-intrusive).
Since Resolver only holds one attribute, this might be a hint that you need an accessor.
I prefer not to merge this into the lib, and wait for more feedback before supporting a new way to serialize.
Plus, there's some issues that need to be resolved:

If there's both the static method, and the free function, which one is chosen?
the prototypes could be changed to match adl_serializer special case (for non-default-constructible types)

The templates take care of serializing Resolver<>.
For the Resolvable<> classes, I provide an explicit (external) function that uses the exported API of a Resolvable (Reference() and resolve()).
// class Type : Resolvable<>;
inline void to_json(json& j, const Type::ptr_type & opt) {
	j = opt->Reference();
}
inline void from_json(const json& j, Type::ptr_type & opt) {
	opt = Type::resolve(j);
}

I have also generic templates to serialize pointers to my classes:
template <typename T>
inline void to_json(json& j, const std::shared_ptr<T> & opt) {
	T::to_json(j, *opt);
};
template <typename T>
inline void from_json(const json& j, std::shared_ptr<T> & opt) {
	T::from_json(j, *opt);
};

I have not yet found a way to override the generic std::shared_ptr<T> template in a meaningful way for classes that obey Resolvable except by providing explicit non-template (external or friend) to_json/from_json functions. It may be possible, my template knowledge (however much this issue has expanded it)  is not up to the task :).
If there are both static methods and the free functions (as here in the std::shared_ptr<Resolvable<>> case), overload resolution will select the explicit function over the template forwarders.
I consider that an advantage: the template will act as a fallback and catch any to_json/from_json that isn't explicitly implemented and check for the static functions inside the class. Should you change your mind and add this, no existing code will break.
I do not understand what you mean with your second issue. I looked at that but as far as I understand, those also require friend statements. Perhaps it is possible to put my templates in an adl_serializer but I am unsure of overload resolution in that case and (from my point of view), I fail to see what I would win (feature-wise)?

To override the behaviour of std::shared_ptr, you can take a look at the Readme, there is an example with boost::optional.
As for my second issue, the only reason the required prototype for free-functions takes a non-const reference to type T, is to make ADL work.
When specializing adl_serializer, the following prototype is allowed: T from_json(json const&).
This allows non-default constructible types to be converted.
We could improve the existing fallback mechanism, which is quite primitive right now, to support static methods (forwarding references/templates omitted):

static T T::from_json(json const&)
static json T::to_json(T const&)

Although this would be possible, I believe we should wait 3.0.0 first, since there are more important issues, and I'd like to have other people's input about this too.
We could also support non-static methods.
Anyway, thanks for your feedback!

To override the behaviour of std::shared_ptr, you can take a look at the Readme, there is an example with boost::optional.

I have already overridden the std::shared_ptr behavior. I just haven't found a way to specialize the template for Resolvable classes, I have to specify explicit functions for that. I would love to have a second template that handles them but I haven't found how to do it. I am inclined to believe it impossible.

Supposing you have a trait is_resolvable<>, you could do something like this:
template <typename Resolvable>
struct adl_serializer<Resolvable, std::enable_if_t<is_resolvable<Resolvable>::value>
{
  /* ... */
};

To go further, I would need a small reproducible example that I can tweak. Do you have that?

I can make one.
The problem with that approach is that (as far as I can tell), the compiler will take my generic pointer template over a template that where he needs to do type conversion.

Here is the example.
testtemplate.cpp.txt

Thanks, I will take a look

Hi, first of all, I quite don't get the goal of your Resolvable/Resolver classes (the code is quite complicated) but here are my thoughts.
You're right, specializing the adl_serializer overrides the default behaviour:
namespace nlohmann {
template <typename T> struct adl_serializer<std::shared_ptr<T>> {
  static void to_json(json& j, const std::shared_ptr<T>& opt) {
    T::to_json(j, *opt);
  }

  static void from_json(const json& j, std::shared_ptr<T>& opt) {
    T::from_json(j, *opt);
  }
};
}

Secondly, I think most of your static methods can be removed, by providing an accessor, I didn't see real private data in your example (that might be because it is an example though)
Anyway, I'll keep your suggestion in mind, even if I won't implement it in the near future, unless other users ask for that feature.

The classes are part of a database structure. When server side processing is done, the data is serialized and sent to the client. Some records are static though and those classes are implemented as a Resolvable, the client has a cached copy of them. Since Resolvable classes only serialize their reference number, a lot less data needs to be transferred.
And yes, I removed all private data from my classes :).
Can you explain what the advantage is of using the adl_serializer over the global function templates I defined?

Sure, there's several advantages.
First, the library cannot find your free method void to_json(json&, std::shared_ptr<T> const&);.
That's because of Argument-Dependent Lookup, this method must be in the type's namespace, which is std in this case, and thus, it's illegal to put stuff into it.
(it is not a good idea to hijacks other libraries' namespaces too, even though it's not illegal).
In your example, it only works because you call that method explicitely, but doing something like this would fail:
// that will trigger a static_assert
auto j = json(yourObject);

Secondly, if we add an overload in the library, that handles std::shared_ptr<T>, it will cause an ambiguous call with your free function, whereas your adl_serializer specialization will always be preferred.

I don't think we are on the same page. The example as given compiles and works.
It serializes std::shared_ptr's to both normal classes and Resolvable<> classes, both correctly for their type, both without calling the functions specifically (see main), except inside the Resolver because there I want the non-default behavior (the serialization of the resolver serializes and restores the lookup table, can't use the references for that). Any other reference to T::to_json and T::from_json points to the static functions.
You're right that the code needs a cleanup :), especially the add functions are headaches. They check for each added object whether a copy is already present (automatically freeing the added object and returning a reference to the entry from the lookup table) or if it needs to be added. The complexity arises mostly because the added object may or may not have a reference value already.
All templates use type T, not std::shared_ptr, so they should be found in T's namespace, not std?
They use these template functions (which match most classes in my project, only A in example):
template <typename T>
inline void to_json(json& j, const std::shared_ptr<T> & opt) {
	T::to_json(j, *opt);
};
template <typename T>
inline void from_json(const json& j, std::shared_ptr<T> & opt) {
	T::from_json(j, *opt);
};

To make the Resolvable classes work, I need to declare non-template free to_json/from_json functions for resolvable classes (type R in the example). These:
inline void to_json(json& j, const R::ptr_type & opt) {
	j = opt->Reference();
}
inline void from_json(const json& j, R::ptr_type & opt) {
	opt = R::resolve(j);
}

As I understand it, the compiler will find my non-template functions for the resolvable types (R in example) and just not look for templates.
I cannot find a way to turn these explicit free functions into a free template that will work correctly for Resolvable classes but not interfere with normal classes. As far as I understand it, the normal template (first  in this post) keeps applying so the compiler cannot decide which one to use.
As for your second point, this code does not fail:
	A::ptr_type a;
	a = std::make_shared<A>("Class A");

	json normal;
	normal = a;

This should be equivalent to: auto j = json(yourObject); ?
So how exactly does adl_serializer influence overloading? And how would that interfere with the free functions I declared?

I might have misread the code, sorry.
I don't have a lot of time right now, so I will simplify the explanation:
The basic_json constructor calls adl_serializer<T>::to_json, which by default looks for the free-function user-defined to_json(json&, T const&).
Thus, if you specialize adl_serializer<T>, and redefine adl_serializer<T>::to_json, the free functions will not be looked up.
We might support other types in the library (like std::shared_ptr for example), by adding a free function in the nlohmann::detail namespace.
And if a user specialized adl_serializer<std::shared_ptr<T>>, it will not conflict with the new overload we added.
I hope I'm clear enough, you can send me a message if you want more detailled explanation.

Not sure if this is what this thread is for or not, but is there any way to use a virtual to_json member function in order to have the right type be automatically selected with a base type pointer/reference?

This both not what the thread is about nor is it (if I understand it correctly) what this particular json library is about: argument dependent lookup, which I believe means that the correct function is determined at compile-time by the argument type you (de)serialize and not by (possibly runtime) polymorphism.
I solved my problem by implementing to_json/from_json with template functions that automatically forward to the static functions if they are present in the object. Defining those template functions was fun for me but YMMV :)

@theodelrieu Any ideas on this or can this be closed?


What does dev.sh do and why should I run it?

Can we also mention the system pre-requisites like yarn and python to be there to run this dev.sh script?

I think we can extend the script to check for these pre-requisites such that it auto intalls any dependencies if not there on the system

#203 resolves this


Use the monotonic clock to measure time elapsed

For measuring elapsed time, one should use a monotonic clock instead of the system clock because the system clock can go backwards in time, whereas a monotonic clock is guaranteed to be non-decreasing.

Is there particular reason to use monotonic instead of perf_counter?
Also, would you rather use monotonic_ns (or perf_counter_ns) to avoid floating point errors?

Is there particular reason to use monotonic instead of perf_counter?

Per PEP 418, monotonic is suitable for implementing a timeout in a program. perf_counter does exist as well, but perf_counter is intended for use in performance and benchmarking contexts.

Also, would you rather use monotonic_ns (or perf_counter_ns) to avoid floating point errors?

Are floating point errors a real concern here? If floating point errors are a true concern here, then it's possible to use the corresponding *_ns function to mitigate that concern.

Per PEP 418 ...

Ah, thanks I didn't know that!

Are floating point errors a real concern here?

Unlikely. I just tend to use *_ns by default these days.
I'm not officially associated with pyvisa so feel free to ignore me 😁. For what it's worth (which is basically nil), this LGTM.

I was mostly worried about availability but this function is older than I though so no issue.


How to read from HttpRequest rather than a File?

I'd like to know how to extract the content from an HttpRequest, rather than a file. Currently I'm getting content from a file:
    public static bool SaveAsCsv(string excelFilePath, string destinationCsvFilePath)
    {
        using (var stream = new FileStream(excelFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
        {
            IExcelDataReader reader = null;
            if (excelFilePath.EndsWith(".xls"))
            {
                reader = ExcelReaderFactory.CreateBinaryReader(stream);
            }
            else if (excelFilePath.EndsWith(".xlsx"))
            {
                reader = ExcelReaderFactory.CreateOpenXmlReader(stream);
            }

            if (reader == null)
            {
                return false;
            }

However, the requirement is to get the payload from an HttpRequest.
I currently have the scaffolding for an Azure Function:
    [FunctionName("OnXlsxToCsvHttpTriggered")]
    public static async Task<IActionResult> Run(
        [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
        ILogger log)
    {
        log.LogInformation("C# HTTP trigger function processed a request.");

        string name = req.Query["name"];

        string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
        dynamic data = JsonConvert.DeserializeObject(requestBody);
        name = name ?? data?.name;

        return name != null
            ? (ActionResult)new OkObjectResult($"Hello, {name}")
            : new BadRequestObjectResult("Please pass a name on the query string or in the request body");
    }

I'd like to be able to get the payload from req.Body and somehow read it into IExcelDataReader?
How do I take an HttpRequest payload and read it into the interface IExcelDataReader?

Hi,
I suppose req.Body is a System.IO.Stream:
https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.httprequest.body?view=aspnetcore-2.1
ExcelReaderFactory.CreateReader takes a System.IO.Stream parameter, so there's a chance you can pass the body directly to it.
The docs dont say if the req.Body stream is seekable or not. You will get an error if it isn't. If so, you have to copy req.Body into a MemoryStream manually before passing it to CreateReader.


String game using Java

This code predicts the output of game if two players play optimally.
Please assign me this issue.

can you assign this issue to me ?

@gaurijoshi22 could you please assign this issue to me.

Hi @gaurijoshi22 can you assign me this project

hi @keshavsingh4522 can you assign this project to me so that I can work on this project


Review/fix travis issues

Fixed travis issues in the project.
REVIEW: please take a look at commit https://github.com/voc/voctomix/commit/78c67359f3f7ff7b5d26ffa35f2e746d106bd473

I'm getting familiar with open source/github... step by step...
But please remind that I've also made a branch called "review/fixing-travis-issues" which was branched form another feature branch :/. I just made a new one (to which this pull request is related) that was branched from master with a very similar name.
"review/fixing-travis-issues" is about to delete.
Hope you are comfortable with all the prose I write. I just want log what I'm realizing. Feeling like a beginner in something you do all day is quite enlightening :) ty all for you patience

@fightling No problem with being verbose :) Please don't hesitate to ask on IRC when you're not sure about how or why we handle things the way we do.

@fightling At work we usually like to leave the actual act of merging to the branch opener. I added minor Ideas to maybe make the Code even a little bit more readable which you might consider to change or not, that's up to you.
If you decide to be ready to merge, please use the "command line instructions" and make sure to push to the origin at<EMAIL_ADDRESS>Afterwards you might want to rebase the other open PR so that it builds green.

\o/


Some more support for @android: resources.

Dots after '@android:style/' needs to become underscores. (I'm not sure if this is true for all types of resources or only style/
@android:drawable/ support for android:background

thanks, nice work.

0.0.2-alpha13


sosedoff/pgweb:latest is not latest

sosedoff/pgweb:latest seems to be 5 months old and looking at the size, corresponds to version 0.8 instead of latest 0.9.2
https://hub.docker.com/r/sosedoff/pgweb/tags/

You're right. I think i pushed a wrong tag.

Fixed. Public registry should contain proper latest and 0.9.2 release rebuilt using alpine image and as a result its image side has been reduced to 8Mb.


Change default currency network of fees for delegation to empty

The clientlib will ask for the currency network of fees and
use it for its meta transaction so it should pass the schema
validation which expect an address / missing

Codecov Report

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

@@           Coverage Diff           @@
##           master     #356   +/-   ##
=======================================
  Coverage   64.13%   64.13%
=======================================
  Files          47       47
  Lines        3326     3326
=======================================
  Hits         2133     2133
  Misses       1193     1193

Impacted Files
Coverage Δ

relay/relay.py
27.72% <ø> (ø)
:arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61a91d3...a3e6aa1. Read the comment docs.

Looks ok to me, but apperently the config is at best misleading, so I opened an issue #357


DocsArchive-<IP_ADDRESS>Auto archive content

Auto archive content from https://github.com/OPS-E2E-PPE/docs-archive-test

Docs Build status updates of commit a012bb5:
:warning: Validation status: warnings

File
Status
Preview URL
Details

archvieTargetFolder/content/someContent.md
:warning:Warning

Details

archvieTargetFolder/index.md
:warning:Warning

Details

.openpublishing.redirection.json
:white_check_mark:Succeeded

archvieTargetFolder/TOC.yml
:white_check_mark:Succeeded

archvieTargetFolder/content/sql-database-engine.png
:white_check_mark:Succeeded

archvieTargetFolder/docfx.json
:white_check_mark:Succeeded

archvieTargetFolder/content/someContent.md

[Warning] Missing attribute: author. Add the current author's GitHub ID.

archvieTargetFolder/index.md

[Warning] Missing attribute: author. Add the current author's GitHub ID.
[Warning] Missing attribute: title. Add a title string to show in search engine results.

For more details, please refer to the build report.
Note: If you changed an existing file name or deleted a file, broken links in other files to the deleted or renamed file are listed only in the full build report.


Upgrade JavaScript dependencies

Testing plan: Tested with dev server.

lgtm, aside from my comment above.


enable passing site ID or name via command line

Currently, the site ID must be read from the terminal (and thus entered in the toml file by netlifyctl to be used).  Would be great to be able to pass this via command line!
Make sure to update the help text if this option gets added please :)

any command in particular? the deploy command supports both now

I'd say the deploy command just needs its --help text updated to complete this, then!

I don't think the deploy command works without a configuration file yet (or at least, I couldn't make it work): netlifyctl deploy appears to call middleware.ChooseSiteConf() first (which looks at the configuration, and prompts the user if there's ), and then checks the --site-id flag.


How do I learn to create something like this?

Hi there,
Thanks a lot for this amazing package. I meant to ask, how do I learn to make something like this? Learning how to write rust code is one thing, but could you reccomand me something specific to learn how to create this wrappers?
Thanks a lot.
Cheers,
Fra

Hi @FrancescoSaverioZuppichini , the rust-bindgen tutorial should be a good start.

Thanks a lot


nib alias not working correctly in bash or sh

The multiline version of the alias is not working as expected in bash or sh

Since nib has transitioned to being delivered as a Ruby gem this issue no longer applies.


corrected Type

correted Typo in German Docs about Networking of Pods

@peacock-2000 Thanks you for your contribution.
Could you please sign the CLA before the PR can be reviewed.
You can follow the steps documented here: CLA Steps

/retitle [de] Fix typo in "Pods" page

/easycla

/lgtm

/assign @rlenferink


Should the prompts be fixed or trained across all the tasks?

According to the code:
https://github.com/iamwangyabin/ESN/blob/d163bc64541803241a9b2ea76a5d6c985e9fc9a5/trainer.py#L16-L24
It seems the prompts should be fixed after the first task. However, the prompts are actually kept training since the vitprompt still requires grad. freezep does not work. The vitprompt is still trained in the following tasks.
If the prompts should be trained across all the tasks, does the following code in eval() function result in the leakage of task information?
https://github.com/iamwangyabin/ESN/blob/d163bc64541803241a9b2ea76a5d6c985e9fc9a5/trainer.py#L109
It seems that the backbone leverages the prompts in the current test task to extract image features, but the backbone should not know the task which the image belongs to.

Firstly, it's true that we maintain only the recent prompt (current session), and indeed, there is no freezing of prompts after each task—in line with the approach taken by L2P, we continuously fine-tune this prompt parameter. This means that at any given point, we're utilizing a single, latest prompt that has been fine-tuned through the continual tasks.
Regarding the eval() function, the code in question is designed to generate an accuracy matrix after all the incremental learning sessions are completed. This process involves iterating over the model parameters at all incremental stages to test and calculate the results and measure forgetting. Hence, there is no leakage of task information during the testing phase. The task ID is solely used to restore and evaluate the model's accuracy at that specific task (task id). The code is written in this manner specifically to facilitate the creation of the accuracy matrix, ensuring a thorough evaluation of the model across all increments.

Thank you for the timely reply!


Implementation of firstDuplicate

--Adapted from CodeSignal.com---
Given an array a that contains only numbers in the range from 1 to a.length, find the first duplicate number for which the second occurrence has the minimal index. In other words, if there are more than 1 duplicated numbers, return the number for which the second occurrence has a smaller index than the second occurrence of the other number does. If there are no such elements, return -1.
Example
For a = [2, 1, 3, 5, 3, 2], the output should be firstDuplicate(a) = 3.
There are 2 duplicates: numbers 2 and 3. The second occurrence of 3 has a smaller index than the second occurrence of 2 does, so the answer is 3.
For a = [2, 2], the output should be firstDuplicate(a) = 2;
For a = [2, 4, 3, 5, 1], the output should be firstDuplicate(a) = -1.
Input/Output
[execution time limit] 4 seconds (py3)
[input] array.integer a
Guaranteed constraints:
1 ≤ a.length ≤ 105,
1 ≤ a[i] ≤ a.length.
[output] integer
The element in a that occurs in the array more than once and has the minimal index for its second occurrence. If there are no such elements, return -1.

I would like to work on it in python

I would like to work on it in python

For sure no problem

I can do C# and js

I can do C# and js

Great, can you contribute either of any preferred language?

I can do C# and js

Great, can you contribute either of any preferred language?

Did both, just tell me in which folder do I put them and I'll send a PR.

I can do C# and js

Great, can you contribute either of any preferred language?

Did both, just tell me in which folder do I put them and I'll send a PR.

in the Algorithms folder

I would like to work on it in c++

I would like to work on it in java

#201 pull?

@ankitaugale23 @reethu-annjo @shaswatsingh19 please create a pull request in submitting your implementation and make sure you put it into /problems folder

@ankitaugale23 @reethu-annjo @shaswatsingh19 please create a pull request in submitting your implementation and make sure you put it into /problems folder

I have made a PR #316 . Kindly check

@ankitaugale23 @reethu-annjo @shaswatsingh19 please create a pull request in submitting your implementation and make sure you put it into /problems folder

I have made a PR #316 . Kindly check

You're good to go.


Added printing patterns in C++

Signed-off-by: VinayakTekade<EMAIL_ADDRESS>Proposed Changes

Added 25 patterns

@aravindvnair99 Removed it. That's just a preference I have to take input and output from txt files.

@aravindvnair99 Added helper text for inputs.


[github/codeowners] Add container-platform as owner of /pkg/proto/datadog/workloadmeta

What does this PR do?
Adds container-platform as owner of /pkg/proto/datadog/workloadmeta.
Describe how to test/QA your changes
Skip.

/merge


[BUG] API is responding with header text/html;charset=utf-8 instead of application/json

Describe the bug
Not sure where to raise the request, hence raising here for attention.  If this is not the correct place please point where to raise it?
I am playing with the demo API exposed at http://langchain4j.dev/demo/openai//v1/chat/completions though I sent content-type as application/json, accept header as application/json and request_format in body as json_object I am receiving the data in json format but response header contains text/html;charset=utf-8 as a result my spring boot application is unable to parse it.
Log and Stack trace
Request CURL :
curl --location 'http://langchain4j.dev/demo/openai//v1/chat/completions' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer demo' \
--data '{
    "messages": [
        {
            "content": "what is java",
            "role": "user"
        }
    ],
    "model": "gpt-3.5-turbo",
    "response_format": {
        "type": "json_object"
    },
    "stream": false,
    "temperature": 0.7
}'

Response Headers ::
Date: Wed, 27 Mar 2024 10:48:03 GMT
Content-Type: text/html;charset=utf-8
Transfer-Encoding: chunked
Server: Jetty(9.4.48.v20220622)

Response Body ::
{"id":"chatcmpl-97L75I9ZGy8xNuHjeDniW3UDOURff","created":1711536483,"model":"gpt-3.5-turbo-0125","choices":[{"index":0,"message":{"role":"assistant","content":"Java is a high-level, object-oriented programming language developed by Sun Microsystems in 1995. It is platform-independent, meaning that Java programs can run on any device that has a Java Virtual Machine (JVM) installed. Java is widely used for developing desktop, web, and mobile applications, as well as enterprise software and large-scale systems. It is known for its simplicity, readability, and robustness, making it a popular choice among developers."},"finish_reason":"stop"}],"usage":{"prompt_tokens":10,"completion_tokens":90,"total_tokens":100}}

Stacktrace :
org.springframework.web.client.UnknownContentTypeException: Could not extract response: no suitable HttpMessageConverter found for response type [class com.example.openai.api.OpenAiApi$ChatCompletion] and content type [text/html;charset=utf-8]

To Reproduce
Call above curl , though it has response_format as json_object , body is coming correctly but response header is not set correctly.
Expected behavior
Excepted to receive in response headers value of content-type as application/json

@rajadilipkolli thnaks for reporting!

How do you connect to demo API?
I guess you want to get JSON back, right? Since you set

"response_format": {
        "type": "json_object"
    }

Regarding Content-Type: text/html;charset=utf-8: I will check

@rajadilipkolli thnaks for reporting!

How do you connect to demo API?
I guess you want to get JSON back, right? Since you set

"response_format": {
        "type": "json_object"
    }

Regarding Content-Type: text/html;charset=utf-8: I will check

Hi @langchain4j ,
Please find my response below,

Connecting to demo API using RestClient as our client has restriction on adding 3rd party jars. only few we can add. Fighting to get approval for using all langchain4j jars.
I'm receiving the response in json format as pasted in the BUG.
As response is in json format want to get content-type in response headers as application/json

@rajadilipkolli please note that demo key is for demonstration purposes only, it is not intended to be used on the long-term.


[JN-732] Add pdf support

DESCRIPTION
This adds pdf as an allowed filetype for the site file uploader. It also makes a few user-facing changes, like renaming "images" to "media" and changing some styling to be more consistent with other pages.
Right now I only updated the "media" language where it was user facing. If we decide that media is the right word to use, it would make sense to propagate that language throughout the rest of our code. I just didn't want to be too quick to make that change before reaching consensus.

TO TEST:  (simple manual steps for confirming core behavior -- used for pre-release checks)

Launch admin API and UI
Try uploading a PDF: https://localhost:3000/ourhealth/studies/ourheart/env/sandbox/media
Verify that the regex still only supports image types + pdf

@MatthewBemis Thx for the link. That explains the need.
How would users create a link to an uploaded PDF? Or is that for a future PR?

HeartHive currently uses an uploaded pdf (that I snuck in by changing the file extension) for their privacy policy (See the link to https://thehearthive.org/api/public/portals/v1/hearthive/env/live/siteImages/2/privacy_notice.pdf about 2/3 of the way down on https://thehearthive.org/).  They can construct links it the same way that images are linked from the participant ui.  We don't have a UI for the making the construction of those links easy yet, so it's something that Whitney would probably have to help with in the short term


Added welcome message setting, default true

When having Account verification enabled, users received 2 mails while making an account, added a config setting to toggle the welcome message

Thanks for creating a PR. Maybe not sending the welcome email during singup when requireAccountVerification is set to true is a better solution?
Keep in mind, these two emails contain different content and serve unique purposes.

Perhaps sending a welcome message after a user has been verified as an option would also be interesting?

If we do that without adding a new config settings, I'd probably be for it.
As it stands, this kind of change is something consumers could/should change on their own and I'm not sure it adds a lot of value being the default.

Since both signup and verify - index.js files would require the format of the welcome message, would it be okay for you to move the formatting of both to uti/sendmail and add it to the options as a possible parameter. Maintaining the functionality of sending custom e-mails.

I'm not sure I follow. The welcome email says hello and includes their username and email address. The verification email only has a link in it.

If verification by email is disabled. the signup page will send a 'welcome-mail'
else the verification page sends a 'verify-mail', when successfully verified it sends a 'welcome-mail'
However this means that the the 'welcome-mail' function is duplicated, thus when you want to customize the 'welcome-mail' you might customize the wrong 'welcome-mail' function.
However if we move the options to the utility/sendmail then there is only 1 version of the 'welcome-mail'

In it's current form these emails are simple and easy to maintain. This is a good example of something that the consumer should customize in their app.
Closing this PR for now. Thank you again for getting involved. 👍


Question: NixOS for an OpenStack CI?

Howdy!
We are considering using NixOS as the basis for a Continuous Integration system for an open source project called Snabb NFV. This would run multiple tests and the most complex one is to setup and test a basic single-node OpenStack environment including Nova (w/ Libvirt+QEMU) and Neutron (w/ MySQL database). We need to be able to easily test with different versions/patches of each software component including bootstrapping VM images with specific kernels and awkward-to-compile software (e.g. Intel DPDK that depends on host kernel and CPU at build time).
We are new to NixOS and we would probably need some help to get us moving in the right direction and to have this up and running in a reasonable timeframe (1-2 months).
The main alternative that I see is to run devstack inside a Docker container. On the positive side this would reuse a lot of work that other people in the OpenStack community are doing. On the negative side this is really messy and easily veers off into becoming unreproducible over time.
I would really appreciate advice! Large or small effort to run Nova+Neutron as above on NixOS? Could we find somebody available now to help us implement this in such a way that we can understand and maintain it? Am I overlooking some important things?
Thanks!

I doubt you'll have any good answers on such general question. I'd recommend you get at least one developer experienced with OpenStack and one with Nix and evaluate how much work would be needed to setup such infrastructure.
We've proved so far we can package most of the software easily, but sometimes the build ecosystems make things harder to isolate, which just means more time needs to be spend decoupling bits and pieces.

Question restated in a more actionable way:
Is there a NixOS professional available to quickly create a proof-of-concept NixOS expression to install Nova(libvirt+qemu) + Neutron(mysql) that we could evaluate as the basis for our CI? We would gladly pay a reasonable fee for this. Contact<EMAIL_ADDRESS>

Closing, see https://github.com/NixOS/nixpkgs/pull/10399


Release v0.1.0

Here is a list of what I think we need to do to release v0.1.0:
package.json

[x] Replace all instances of "cycle-hot-reloading-example" with "cycle-canvas"
[x] Set version to v0.1.0
[x] Everything in dependencies should be in devDependencies. (we don't actually use any of it in the driver, just examples)
[x] Add some scripts to compile our es6 to es5 prior to release. These will hook into the npm publish step

   "scripts": {
     "start": "babel-node ./examples/flappy-bird/server.js",
     "test": "mocha --compilers js:babel-register",
     "bundle": "browserify ./examples/flappy-bird/index.js -t babelify -t uglifyify -o bundle.js",
+    "precompile-lib": "rm -rf lib/ && mkdir -p lib",
+    "compile-lib": "babel src -d lib",
+    "prepublish": "npm run compile-lib"
   },

[x] Change the main file to point at the compiled es5 code (src/canvas-driver.js -> lib/canvas-driver.js)
[x] Add a files array with lib/ so that it gets included in the compiled package

+   "files": [
+     "lib/"
+   ],

After all that is done we need to test that the module can be installed locally.

[x] Run npm link in the cycle-canvas directory
[x] Copy one of the example projects to a directory outside the cycle-canvas directory
[x] Run npm link cycle-canvas in the copied example directory
[x] If you ls node_modules/cycle-canvas, you should see the cycle-canvas code, including the lib directory
[x] Change the example to import from cycle-canvas instead of the relative path.
[x] You should be able to run the example and it should import cycle-canvas successfully

After we've tested that we can install our module locally we're almost ready for release.

[x] Push all changes up and check that travis passes
[x] git tag v0.1.0
[x] git push origin master --tags
[x] npm adduser (you should only have to do this the first time and you'll need an npm account)
[x] npm publish (exciting!)
[x] try npm install cycle-canvas in the copied example project
[x] celebrate! 🎉
[x] tell the world!

I think that's everything, but there's a good chance I've missed something. Give it a go and let me know how you get on!

Everything is looking good! I didn't notice a travis file in the repository. It's on npm and working! Thanks for your detailed list. It helped a lot.

Awesome work! I've tested this with the flappy bird example and it works great! Congratulations on your first npm package!
You're right about the lack of travis, my bad! Would you be interested in tackling tests next?
I'll close this now, since v0.1.0 is out!

Thanks for the kind words! I would be interested in tackling tests!


FluxEngine can't see my Greaseweazle F7 Plus (Windows)

Hi, I wanted to test our FluxEngine with my Greaseweazle F7 Plus but it doesn't seem to detect it. Reading the documentation it says it will auto detect either the FluxEngine or GW.  Perhaps I'm doing something wrong or maybe this is due to the new GW firmware? (Firmware: 1.4)
Thanks!
C:\Program Files\FluxEngine>fluxengine rpm
Error: cannot find the FluxEngine (is it plugged in?)

It will always report this error but the GW hardware is on COM13 and working properly with the GW software.
C:\Program Files\greaseweazle>gw info
Host Tools: 1.15.1
Device:
  Port:     COM13
  Model:    Greaseweazle F7 Plus (Ant Goffart, v2)
  MCU:      216MHz, 256kB SRAM
  Firmware: 1.4
  Serial:   GW002D00363438510C36383538
  USB Rate: Full Speed (12 Mbit/s)

That error message doesn't exist in the client any more, which makes me think you're using an old version. Do you have the latest development version?

Ah sorry I was running "FluxEngine Windows client version 389"-- I'll try the dev build and report back.

Ok yes all is good with the latest dev built. Thanks!


Cannot print types with wildcards

If a type with parameter bounds is instantiated with a wildcard, it cannot be printed:
@ case class MyList[T <: String]()
defined class MyList
@ null.asInstanceOf[MyList[_]]
cmd3.sc:8: type arguments [_$1] do not conform to class MyList's type parameter bounds [T <: String]
            .print(res3, res3, "res3", _root_.scala.None)
             ^
cmd3.sc:8: type arguments [_$1] do not conform to class MyList's type parameter bounds [T <: String]
            .print(res3, res3, "res3", _root_.scala.None)
                  ^
Compilation Failed

The same example works fine in Typelevel's REPL.
See also https://github.com/typelevel/scala/issues/156.

Huh I thought this would have been caught by now; I guess we missed a spot

This is a problem with PPrint. Here is a minimal repro without Ammonite:
scala> case class MyList[T <: String]()
defined class MyList

scala> println(pprint.TPrint.default[MyList[_]])
<console>:14: error: type arguments [_$1] do not conform to class MyList's type parameter bounds [T <: String]
       println(pprint.TPrint.default[MyList[_]])
                                    ^

Spent some time digging into this, didn't manage to get a satisfactory answer why this is happening. The implicit-recursion makes things kinda confusing in the TPrint macro expansion, maybe we could make it not-recurse in the case of _? That might make the problem go away, or at the very least make it easier to debug

If default takes a type parameter, this most likely triggers the issue I've described. Consider the following function:
def f[T](value: T): Unit = {}

Passing a MyList[_] value to f() is not allowed in regular Scala. If you change the parameter type to Any, it compiles. I am actually curious to learn about the motivation behind this Scala design decision.

@tindzk not sure what you are referring to, but passing a MyList[_] to f in your example works just fine.
@  case class MyList[T <: String]()
defined class MyList
@ def f[T](value: T): Unit = {}
defined function f
@ f[MyList[_]](???)
scala.NotImplementedError: an implementation is missing
  scala.Predef$.$qmark$qmark$qmark(Predef.scala:284)
  ammonite.$sess.cmd2$.<init>(cmd2.sc:1)
  ammonite.$sess.cmd2$.<clinit>(cmd2.sc)

This is a bug in the pprint.TPrint module, not in Scala itself

This is what I had in mind:
scala> f(null.asInstanceOf[MyList[_]])
<console>:15: error: type arguments [_$1] do not conform to class MyList's type parameter bounds [T <: String]
       f(null.asInstanceOf[MyList[_]])

huh, interesting. Maybe raise an issue on scala/scala? That definitely should work


token-cli: infer program_id when possible

first step is to normalize what our args are named (details in commit message, for the sake of our futute descendents) and then its pretty easy to handle this inside config creation
closes #3532

it turns out im not allowed to do tis but i thought it was v cute
        } else if !sign_only {
            value_of(matches, "token")
                .or_else(|| value_of(matches, "account"))
                .or_else(|| value_of(matches, "address"))
                .and_then(async |address| rpc_client.get_account(&address).await.ok())
                .map(|account| account.owner)
                .unwrap_or(default_program_id)
        } else {

alright going back to code reviews before i finish this but note to self that i want to write a few tests for program id inference and mismatch, and i also want to get rid of all the check_owner calls and replace them witha config method get_owned_account that does this implicitly

ok nevermind the line about tests, this cant be unit tested, and we dont have an integration test flow


Scroll-to-player broken again

There are two options: individual player size options and a main one under layout that's hidden if static header is disabled.
The scroll-to-player in the player size options has always been broken, scrolling not to the player, but past it about the same pixel height as the header. Sometime in the last few dev versions, the working option under layout has stopped scrolling altogether.
Resetting options does not fix.

Yeah, I also noticed that immediately. Strangely enough, now the one in the individual player worked for me, although I had to deactivate both the static header and scroll to player options from the General >> Layout tab.

It just occurred to me that I could be a little more specific about how the scroll options currently work.
All options off
Scroll option under static header
Fill size with scroll option (static off)
Fill size with scroll option (static on)
Fill size with scroll option (static and scroll on)

I'm having this issue too, so I did a little investigation and this regression happened because of the fix for #1723 in build 514 (commit bf177e75bb3135fc17243ac9591ead8e679f6c7c).  By commenting out ytcenter.utils.scrollTop(0); on line 20957 it fixes the issue for me.  I'm not sure what the proper fix is, but I can say that the function whyDoYouScrollDotCOM doesn't make a lot of sense and should be refactored.

@CameronJRoss the function whyDoYouScrollDotCOM is made because YouTube sometimes scrolls down the page. It has something to do with hiding the header. I will just have to make a condition that checks if Scroll to player is enabled and if it is then disable that part.

I have noticed that YouTube scrolls a bit down on it's own, but only on channels. It can be frustrating trying to click "videos" on a main channel page only for the page to scroll down a bit once loading was finished, causing me to click the promoted channel video instead. Also, when I get to the list of videos, I could end up clicking a video when I was trying to click the "popular/uploaded time" dropdown.

@YePpHa If you change the ID of #masthead-positioner to something different then the www-pageframe script won't be able to scroll the page due to the bar offset anymore. Just remember to clone its style properties to the new ID you give it, they are located in the www-pageframe-XXXX.css file.

@Yonezpt I will look into it. It would be great if we wouldn't have to account for YouTube scrolling the page.

Will certainly fix quite a few bugs. In case of being helpful, this is the function responsible for that header auto-scrolling when a page finishes loading, located in www-pageframe.js:
function Gl() {
    if (Al = R('masthead-appbar')) {
        Bl = R('masthead-positioner');
        Cl = R('masthead-positioner-height-offset');
        xj();
        Hl();
        Il();
        Jl = new lk(Kl);
        var a = Ll;
        r('yt.scheduler.instance') && (a = function () {
            ah(Ll)
        });
        Ml.push(N('init', a));
        Ml.push(N('dispose', Nl));
        Ol = wj();
        vh.getInstance();
        Pl(Ah(0, 128) ? Ah(0, 129)  : !0);
        Ql = qd('html', void 0, void 0) [0];
        Ml.push(N('masthead-ticker-close', Rl));
        Ml.push(N('appbar-guide-delay-load', Hl));
        Ml.push(N('page-resize', Sl));
        El || Ll()
    }
}

@Yonezpt I found that the #masthead-positioner element is only a container and I can move the elements inside it instead of itself. This makes YouTube's function return -0 instead of -51 and it looks the same without any side effects (what I've observed).
So I've changed:
body.hide-header #masthead-positioner {
  top: -51px;
}

to
body.hide-header #masthead-positioner > * {
  margin-top: -51px;
}

The animation part I'm using has also been changed the exact same way. I'm using margin-top as the children of #masthead-positioner do not have the top property set, which breaks the animation, and this was the simplest way. I could use top by setting a default top CSS property for the children.


Delete CLI command

Need a delete CLI command to permanently delete a component from the folder and also update the module file

Duplicate of #900


can't import cadquery

How to reproduce the issue:

Run:

docker run -it ghcr.io/fusion-energy/fusion-neutronics-workflow

using the latest tag

Navigate to the examples folder:

cd examples/example_01_single_volume_cell_tally/

Run

python 1_create_cad_and_convert_to_dagmc.py

This produces:
Traceback (most recent call last):
  File "1_create_cad_and_convert_to_dagmc.py", line 4, in <module>
    import paramak
  File "/opt/conda/lib/python3.8/site-packages/paramak/__init__.py", line 14, in <module>
    from .shape import Shape
  File "/opt/conda/lib/python3.8/site-packages/paramak/shape.py", line 10, in <module>
    import cadquery as cq
  File "/opt/conda/lib/python3.8/site-packages/cadquery/__init__.py", line 14, in <module>
    from .occ_impl import exporters
  File "/opt/conda/lib/python3.8/site-packages/cadquery/occ_impl/exporters/__init__.py", line 10, in <module>
    from ...cq import Workplane
  File "/opt/conda/lib/python3.8/site-packages/cadquery/cq.py", line 54, in <module>
    from .selectors import (
  File "/opt/conda/lib/python3.8/site-packages/cadquery/selectors.py", line 23, in <module>
    from pyparsing import (
ImportError: cannot import name 'upcaseTokens' from 'pyparsing' (/opt/conda/lib/python3.8/site-packages/pyparsing/__init__.py)

Subsenquently, I can't import paramak either

I don't think so cause I can also reproduce the error without importing paramak:

docker run -it --rm ghcr.io/fusion-energy/fusion-neutronics-workflow
run python
run import cadquery

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/python3.8/site-packages/cadquery/__init__.py", line 14, in <module>
    from .occ_impl import exporters
  File "/opt/conda/lib/python3.8/site-packages/cadquery/occ_impl/exporters/__init__.py", line 10, in <module>
    from ...cq import Workplane
  File "/opt/conda/lib/python3.8/site-packages/cadquery/cq.py", line 54, in <module>
    from .selectors import (
  File "/opt/conda/lib/python3.8/site-packages/cadquery/selectors.py", line 23, in <module>
    from pyparsing import (
ImportError: cannot import name 'upcaseTokens' from 'pyparsing' (/opt/conda/lib/python3.8/site-packages/pyparsing/__init__.py)

This bug is due to the dockerfile installing paramak version 0.7 instead of the newer versions such as 0.8.1

Updating to paramak 0.8.1 didn't fix it apparently
https://github.com/fusion-energy/fusion_neutronics_workflow/runs/6653637317?check_suite_focus=true


Fresh code style in controllers

@goszowski Thanks for the PR. I've cherry picked some commits.
And no wonder why you did some same changes in different commits :) No problem.

And if you like to customize the controller. stub it is very easy to do with your own style.
Check this https://github.com/appzcoder/crud-generator/blob/master/doc/templates.md

I know, but some customization is impossible without updates in your package (this changes are in my commits). In addition, it's very difficult to change the template every time, at each project.
I understand that your package is designed to save time, but not for complications, such as rewriting templates, in order for it to work properly.

Oh you don't need to customize again & again. Just keep copy of your own templates then reuse your every projects.
I tried to keep the template simple and let user to use from Laravel 5.1+

So we need to split users into versions.
These can be different directory templates, depending on the version. What do you think of this?
The index method looks rather awkward. I don't know people will think about me if they see this code.
I understand that it is simple version, and  I can then change these methods, but I would like to have OK right after the generation, hope not only me.


ALB integration returns status code 500 when body field is null

Verified that ALB does as you say, 502 returned with json {"statusCode": 200, "body": null} but expect 200 returned when json is {"statusCode": 200}. The go struct isn't actually able to produce this, since the type is string rather than *string.
So... I think it's OK to represent in this model that null should never be written for this integration. As far as I can tell in my testing it's also harmless to drop the empty string body, ALB behaves the same way.

I was referencing this issue recently in a discussion, and realized that the change modified the request, not the response - so the issue described of a 5xx on the response path still exists.
Originally posted by @bmoffatt in https://github.com/aws/aws-lambda-go/issues/408#issuecomment-1092057339

no issue

The go struct isn't actually able to produce this, since the type is string rather than *string


Upgrade the license CI check to v5 script action

Is there an existing issue for this?

[X] I have searched the existing issues

Problem Statement
#1863 tried to upgrade the script GH action to v5, but due to a breaking change, that requires a manual change to the script.
#1870 rolls back #1863. But at some point we need to upgrade to v5 nonetheless.
Proposed Solution

update the REST call code to use the new comment creation APIs introduced in v5
bump the github-script GH Action on our CI to v5

Additional information
No response
Acceptance Criteria

[ ] the license check CI action is running actions/github-script@v5 or newer
[ ] the license check CI is green

@mflendrich I don't see any references to action/github-script in this repo. Can we close this in this case?

Sounds good.
Closing as "obsolete"


CIP ???? | Don't force Built-In functions

A very rough draft of a CIP that suggests to remove the type instantiations (which are essentially no-ops) from builting UPLC functions.
This should be benefitial for the development of (among others) @aiken-lang, @Hyperion-BT 's helios, and @ImperatorLang 's eopsin.
I need some advice on the Path to Active section. As I understand the specification and implementation of UPLC and PLC is currently under supervision of @input-output-hk and will thus need their approval.
Rendered draft

Don't allow forcing what can't cause any effects.

@effectfully What you describe is more or less exactly what i.e. plutonomy does.
I agree its a viable workaround for now and I am fine with it being the eventual outcome.
I am describing here the ideal situation from a user perspective, not from a blockchain developer perspective. Whether or not it is feasible/worthwile is up to discussion.

Another data point is here: https://github.com/input-output-hk/plutus/pull/5112
That suggested that getting rid of a significant fraction of the redundant forces in a program had minimal effect on runtime.

What if we simply implement an optimization that binds force (force (builtin fstPair)) to a variable and replaces all occurrences of this expression with that name? And similarly for all other builtins. Then we'll get a constant and pretty negligible amount of overhead per builtin.

Plutarch already does this. It's not always worth it though, because let-bindings are expensive too.

While I certainly like the idea of untangling UPLC from TPLC/PIR/Plutus Tx, I'm not sure I like the idea of untangling UPLC from any kind of types. Built-in functions have signatures, those signatures have quantifiers, we should account for quantifiers somehow and force is a sensible way of doing that, semantics-wise. If we can get away with having minimal runtime/size overhead by pulling those forces out of the program, then I'll vote for not weirdifying the language. Particularly because such a change would be even trickier in the blockchain context where we have to maintain backwards compatibility or perform weird and potentially risky tricks.

I disagree with the reasoning in your argument. Semantics-wise, force makes no sense at all. The types in Plutus are meant to be erased away entirely, yet we have this vestigial force and delay, which is only there to preserve pseudo-laziness as experienced in Haskell in some edge cases with foralls. For comparison, GHC does not preserve foralls in the output (observable by doing (unsafeCoerce (id :: forall a. a -> a) :: Int -> Int) 5).
The real issue in my opinion is Plutus's reliance on impure behaviour. Even though Plutus is supposedly a functional language, you're supposed to cause a transaction failure by the script failing, an impure effect! Now, all of a sudden order of evaluation matters, when it should not have mattered in the first place. Of course, order of evaluation always matters in some sense, since one manner of evaluation might push the transaction past its allocated script budget, yet I believe that in practice, this is rare, as the programs we put in scripts aren't too complicated.
How would Plutus be made pure? Rather than failing invalid terms, make them stuck. Then, ifThenElse 0 1 2 would simply not reduce further and already be in WHNF. Script success can be done the same way: success is returning () (or True, perhaps), and any other WHNF is considered a failure. If a term is not in WHNF and the budget has been exceeded, that is of course also a failure.
In practice this would mean the pathological example of ifThenElse (nullList l) True (headList l) no longer behaves unexpectedly no matter the order of evaluation.
If evaluated strictly, if l is nil, then headList [] simply doesn't reduce, and the whole expression still returns True.
I believe this would allow entirely dropping all vestiges of call-by-name from the translation of Haskell into UPLC.
(Of course, you'd need a new language version, and existing Plutus scripts can't be trivially ported over, unless they're already in the idiomatic style which no one uses because of performance reasons.)
I considered this approach while thinking about replacing UPLC with an SKI calculus after revisiting https://okmij.org/ftp/tagless-final/ski.pdf for the 100th time.

I very much want to get rid of this, and as far as I can tell, there are these four general solutions:

Make an interpreter in Plutus, such that a single transaction can push the script state forward without finishing.
Allow creating transactions on Cardano that run an arbitrary script with an arbitrary context, while noting the resultant script state (i.e. hash of output term). Allow then chaining such transactions together, then finally consuming the output as a proof that your transaction would pass without running the script in its entirety in the final transaction. This would avoid the issues Duncan brought up at one time (don't remember where), that larger transaction budgets impede parallel processing of transactions. You could represent the outputs of the above-mentioned transactions as UTXOs.
Cryptographically prove execution succeeds. Using a SNARK, that is, succinct non-interactive argument of knowledge, you would be able to prove that the execution succeeds with an exceedingly small probability of fraud (not unlike what Leios does). The issue is this is still nascent technology, and the practical solutions are still not developed. The current working ones are either 1) trustful or 2) too slow to verify proof/prove statement 3) size of proofs in bytes is too big. There are albeit papers exploring new theoretically practical solutions.
Somehow prove that execution budget is not exceeded before you put the script on-chain. You can have types that express how much computation each term requires. This is not too complex in the absence of recursion, but still seems like a lot of novel work.

I still believe we should get rid of force and delay for new language versions entirely before we attempt to do any of the above.

This is all a bit of a digression, but...

I disagree with the reasoning in your argument. Semantics-wise, force makes no sense at all. The types in Plutus are meant to be erased away entirely, yet we have this vestigial force and delay, which is only there to preserve pseudo-laziness as experienced in Haskell in some edge cases with foralls.

This isn't quite right. Generally, polymorphism can be weird in strict languages if you erase the types entirely, because you can end up in a situation like this:
let x = /\ a . t
in ... x ...

===> erases to

let x = t
in ... x ...

and then we evaluate t as soon as we see it... but then we're effectively evaluating "under" the type abstraction and the semantics of our original language may not make sense there. This notoriously led to soundness issues in ML, and the traditional response is the "value restriction": terms underneath a type abstraction must be values and not things that can compute. This is a horrible artificial restriction also. We opted for a less traditional route in that we made type abstractions and applications have computational meaning. That removes the problem entirely, at the cost of having force and delay. That cost turns out to be more substantial in the end than we anticipated, but I just wanted to point out that the other points in the design space aren't good either.

Now, all of a sudden order of evaluation matters, when it should not have mattered in the first place.

Surprise! Order of evaluation does not matter today (apart from logging, which isn't observable on-chain). Since the only effect is error and the language is strict, changing the order of evaluation cannot affect whether or not you fail, it can only affect which failure you hit, and they're not distinguishable, so it doesn't matter.

If evaluated strictly, if l is nil, then headList [] simply doesn't reduce, and the whole expression still returns True.

I think this depends a lot on how we stuckness was handled. I see two approaches:

Propagate stuckness upwards. The rule for applications says "reduce your arguments to values, and then apply the function". If an argument is stuck, then you can't do that and the application is stuck. Then the ifThenElse is also stuck. But this is basically equivalent to having error!
Allow a stuck term to be passed around a value until we "need" it. I think this is arguably just making us weirdly non-strict in one place.

So I think this proposal is either equivalent to the status quo or a weird strict/non-strict hybrid.

I think 2. is the best solution. It is "weirdly" non-strict, but it solves the problem cleanly I think. You're right wrt. the rest FWIW. Rather than order of evaluation, perhaps saying evaluation matters even if you ignore its result? Which is essentially the same as saying it's impure.
The precise semantics would likely be something like this:

Introduce new term stuck. This is a normal value and can be passed around as you expect. It is in some sense isomorphic to (), yet in TPLC we ascribe it every type, i.e. stuck :: a, not unlike undefined in Haskell.
Applying something that isn't a function results in stuck.
Applying a stuck to a lambda is not special-cased and is entirely valid.
Applying a stuck to a built-in is stuck depending on whether the built-in uses it or not, i.e. when it checks which constructor (of e.g. Booleans) it is.
In general, anything that generates an error now turns into stuck.

We get:
   ifThenElse (nullList Nil) True (headList Nil)
-> ifThenElse True True Stuck
-> True

   (\_ -> True) (headList Nil)
-> (\_ -> True) Stuck
-> True

(excuse me for not using the correct UPLC syntax, I can't remember it).
Perhaps the name "stuck" isn't quite right, because it's not possible to become unstuck (since there is nothing to wait for). The original term is entirely gone and replaced by something which is really just an error. The difference is entirely in how we handle the error.
In fact, you can describe the above as simply: Make error into a first-class value you can pass around, rather than bubbling it up immediately.
I will probably make a CIP as I believe this is IMO the cleanest solution.
I don't believe we have to remove delay and force from the language, albeit it may very well make the evaluator more efficient.
It would in any case allow you to omit those constructs entirely when turning erasing type abstractions and applications.

@effectfully It would diverge as expected.

@L-as I don't understand the point then. You said

I believe this would allow entirely dropping all vestiges of call-by-name from the translation of Haskell into UPLC.

but if a basic if-then-else expression diverges unless we keep the existing machinery that prevents the two branches from being evaluated at the same time, then what problem are we trying to solve here with the introduction of stuck values?

Sorry, I really don't get it. So given

In practice this would mean the pathological example of ifThenElse (nullList l) True (headList l) no longer behaves unexpectedly no matter the order of evaluation.
If evaluated strictly, if l is nil, then headList [] simply doesn't reduce, and the whole expression still returns True.

How is it unexpected that
ifThenElse (nullList l) True (headList l)

blows up but it's expected that
let factorial n = ifThenElse (n == 0) 1 (factorial (n - 1))
in factorial 2

loops?

I am not sure how to proceed. I think the discussion kind of derailed on a related topic that is however not connected to this CIP. There also does not seem a strong position to keep the CIP (right now), so I am pondering if I should just leave it open to be considered at another point again or just close it? I think finalizing it does not make sense if there is no strong support to accept it.

https://github.com/cardano-foundation/CIPs/pull/459

#469

@nielstron Personally, I think it's useful to have Proposed CIPs that won't necessarily be accepted (@rphair I can't remember what we decided was the right way to do this?). Then in future if the discussion recurs we can refer to the previous proposal and see what we thought. So I would be keen for you to incorporate some of the discussion into the main text and then we can merge it.

I have adjusted the proposal as per the comments. Will leave this open as a documentation on why/why not it should be adopted.

To repeat my recommendation, I think it would be fine to merge this as Proposed.

@rphair Thanks! Changes applied.

@Ryun1 @Crypto2099 this has been waiting for a 2nd editor review before merge since March 2023.  Since all the discussion was settled as much as it ever could be (I think), and the last ruling from Plutus expertise was for this to stand as Proposed even though nobody will do it (https://github.com/cardano-foundation/CIPs/pull/459#issuecomment-1451753297), I'm marking it Last Check and putting it on the agenda to move it forward if no last objections: since it appears to be a proper proposal that just got lost between review requests.

@nielstron
Can you rename the folder for this proposal from CIP-???? to CIP-0091

@nielstron the only thing we're waiting for before approving & merging is you renaming the containing directory.

Oh sorry, I missed that. I also added the note that there is no plan to actually implement this CIP