WhereIsAI/github-issue-similarity huggingface dataset:
Issue 1:
fn main() {

}

struct X;

impl X {

unsafe fn xevent_cast(buffer: &[u8; 256]) -> T {

return *(buffer.as_ptr() as *const T);

}

}

Issue 2:
Input:

struct T(u8);

fn t() -> *mut T {
unsafe { 0u8 as *mut T }
}

fn main() {
let a = unsafe { *t() };
}

Output:

$ rustc ../test.rs
../test.rs:9:19: 9:23 error: internal compiler error: this path should not cause illegal move
../test.rs:9 let a = unsafe { *t() };
^~~~
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /Users/John/Documents/dev/rust/src/libsyntax/diagnostic.rs:123

stack backtrace:
1: 0x10f825b75 - sys::backtrace::write::h757d4037fec4513elCt
2: 0x10f84800f - failure::on_fail::he99e1d2cd81a67a80Hz
3: 0x10f7b3c8a - rt::unwind::begin_unwind_inner::hede15ebc165353e0Qpz
4: 0x10d508707 - rt::unwind::begin_unwind::h5150449308391082809
5: 0x10d50869c - diagnostic::SpanHandler::span_bug::h1cc7aa850b4525b9nQF
6: 0x10c93bc1d - session::Session::span_bug::h9dff6f0c981e0b95mRq
7: 0x10c547999 - borrowck::build_borrowck_dataflow_data::hbfab9f3785e58ec8QRe
8: 0x10c5432fb - borrowck::borrowck_fn::h9d4d5a57ec1e26a2cPe
9: 0x10c5440f2 - borrowck::borrowck_item::hd3de64f0b51b624a9Ne
10: 0x10c54461f - borrowck::check_crate::hab49ad1d67fb67e9ZIe
11: 0x10c09e8aa - driver::phase_3_run_analysis_passes::h3bf5eb3f470c8788gwa
12: 0x10c082d90 - driver::compile_input::h63293298907e332cxba
13: 0x10c14e7ba - monitor::unboxed_closure.22558
14: 0x10c14cf15 - thunk::F.Invoke<A, R>::invoke::h15985566512806182469
15: 0x10c14bcf0 - rt::unwind::try::try_fn::h5957420952141477940
16: 0x10f8b1189 - rust_try_inner
17: 0x10f8b1176 - rust_try
18: 0x10c14c3ec - thunk::F.Invoke<A, R>::invoke::h12578415658120090831
19: 0x10f835814 - sys::thread::thread_start::he6c5dcba45c95bf2drw
20: 0x7fff933e22fc - _pthread_body
21: 0x7fff933e2279 - _pthread_body
Issue 1:
Environment

Windows build number: Microsoft Windows [Version 10.0.18963.1000]
Windows Terminal version (if applicable): commit id 734fc1d

Steps to reproduce

still, like #1404

at the defualt profile, "commandline" can't be opened, terminal starts and right after it shuts down.

Make profile a mistake, like the image under.

After that, starting a windows terminal, terminal automatically closes without any message.

Expected behavior

Terminal shows up an error message like #2422

Actual behavior

Terminal doesn't show up any error message, just shuts down.

Issue 2:
Environment

Windows build number: Microsoft Windows [Version 10.0.18362.418]
Windows Terminal version (if applicable):

Any other software? Viaual Studio Code 1.40.0-insider

Steps to reproduce

Set "terminal.integrated.windowsEnableConpty": true.

Install Cygwin.

Set the default shell as bash.exe(for Cygwin) in Viaual Studio Code, and the args as --login.

Run ls --color=auto.

Expected behavior

The executable files and the folders' names are displayed in bold. (You can check the bold character in MinTTY with the option Show bold ad font.)

Actual behavior

There is nothing displayed in bold.
Issue 1:
System information (version)

OpenCV => :4.1.0

Operating System / Platform => :Linux Ubuntu 18.04

and

OpenCV => :4.1.0

Operating System / Platform => :Windows 7

Detailed description

I have trained YOLO object detection via darknet and I could check result using

./darknet detector test cfg/obj.data cfg/yolo-obj.cfg yolo.weights data/test.jpg

but when I want to use dnn module in OpenCV for showing result on input image(160*30), it failed. But it could show result correctly for larger images such 1280*760.

I think that, blobfromimage function crop upper region of this image and subsequently show incorrect results for input image.

At last I show a sample of image that showed correctly by this module:

Steps to reproduce

Issue 2:
OpenCV => Latest

Operating System / Platform => Ubuntu 16.04

Compiler => gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)

Steps to reproduce

For some weird reason OpenCV is unable to save a CV_32FC1 type cv::Mat into a tiff. Below is the minimal example to duplicate this

// doesn't work
cv::Mat test = cv::Mat(100, 100, CV_32FC1, cv::Scalar(128));
cv::imwrite("test.tif", test);

No file is written.

However the different variations below all works properly

// works
cv::Mat test = cv::Mat(100, 100, CV_32FC3, cv::Scalar(128, 128, 128));
cv::imwrite("test.tif", test);

// works
cv::Mat test = cv::Mat(100, 100, CV_8UC3, cv::Scalar(128, 128, 128));
cv::imwrite("test.tif", test);

// works
cv::Mat test = cv::Mat(100, 100, CV_8UC1, cv::Scalar(128));
cv::imwrite("test.tif", test);

// works
cv::Mat test = cv::Mat(100, 100, CV_32FC1, cv::Scalar(128));
cv::imwrite("test.png", test);

// works
cv::Mat test = cv::Mat(100, 100, CV_32FC1, cv::Scalar(128));
cv::imwrite("test.jpg", test);

Why is it that CV_32FC1 Mat cannot be save as tiff?
Issue 1:
from collections import OrderedDict
import random
import pandas as pd

pd.__version__

'0.20.3'

df = pd.DataFrame.from_dict(OrderedDict(
[
((lv1, lv2, lv3), {'KG': random.randint(0, 100)})
for lv1 in ['A', 'B']
for lv2 in ['M', 'N', 'O']
for lv3 in ['X', 'Y', 'Z']
]
))
df

A
B

M
N
O
M
N
O

X
Y
Z
X
Y
Z
X
Y
Z
X
Y
Z
X
Y
Z
X
Y
Z

KG
16
71
27
8
83
0
100
72
100
42
26
21
91
5
36
98
96
52

df.loc[:, idx[:, :, 'X']]

A
B

M
N
O
M
N
O

X
X
X
X
X
X

KG
44
83
-28
5
-31
44

df.xs('Y', level=2, axis=1) - df.xs('Z', level=2, axis=1)

A
B

M
N
O
M
N
O

KG
44
83
-28
5
-31
44

idx = pd.IndexSlice
df.loc[:, idx[:, :, 'X']] = (df.xs('Y', level=2, axis=1) - df.xs('Z', level=2, axis=1))
df

A
B

M
N
O
M
N
O

X
Y
Z
X
Y
Z
X
Y
Z
X
Y
Z
X
Y
Z
X
Y
Z

KG
NaN
71
27
NaN
83
0
NaN
72
100
NaN
26
21
NaN
5
36
NaN
96
52

This was unexpected. I realize that the indexes do not match, and hence this behavior, but I expect Pandas to throw an Exception, rather than silently do this

idx = pd.IndexSlice
df.loc[:, idx[:, :, 'X']] = (df.xs('Y', level=2, axis=1) - df.xs('Z', level=2, axis=1)).values
df

A
B

M
N
O
M
N
O

X
Y
Z
X
Y
Z
X
Y
Z
X
Y
Z
X
Y
Z
X
Y
Z

KG
44
71
27
83
83
0
-28
72
100
5
26
21
-31
5
36
44
96
52

This was, of course, the behavior I was expecting

Issue 2:
Best shown with an example.

import numpy as np, pandas as pd
timestamps = map(pd.Timestamp, ['2014-01-01', '2014-02-01'])
categories = ['A', 'B', 'C', 'D']
df = pd.DataFrame(index=pd.MultiIndex.from_product([timestamps, categories], names=['ts', 'cat']),
columns=['Col1', 'Col2'])

>>> df
Col1 Col2
ts cat
2014-01-01 A NaN NaN
B NaN NaN
C NaN NaN
D NaN NaN
2014-02-01 A NaN NaN
B NaN NaN
C NaN NaN
D NaN NaN

I want to set the values for all categories in a single month. These examples work just fine.

df.loc['2014-01-01', 'Col1'] = 5
df.loc['2014-01-01', 'Col2'] = [1,2,3,4]

>>> df
Col1 Col2
ts cat
2014-01-01 A 5 1
B 5 2
C 5 3
D 5 4
2014-02-01 A NaN NaN
B NaN NaN
C NaN NaN
D NaN NaN

These examples don't work.

df.loc['2014-01-01', 'Col1'] += 1
df.loc['2014-02-01', 'Col2'] = df.loc['2014-01-01', 'Col2']

>>> df
Col1 Col2
ts cat
2014-01-01 A NaN 1
B NaN 2
C NaN 3
D NaN 4
2014-02-01 A NaN NaN
B NaN NaN
C NaN NaN
D NaN NaN

It doesn't seem to be a "setting a value on a copy" issue. Instead, Pandas is writing the NaNs.

My current workaround is to unstack each column into a DataFrame with simple indexes. This works, but I have lots of columns to work with. One dataframe is much easier to work with than a pile of dataframes.

The computations for each month depend on the values computed in the previous month, hence why it can't be done fully vectorized on an entire column.
Issue 1:
Hey folks,

In the Waypoint: Use Clockwise Notation to Specify the Margin of an Element challenge, it is asked to fulfill the following:

Your green-box class should give the left of elements 40px of margin.

Your green-box class should give the bottom of elements 20px of margin.

Your green-box class should give the top of elements 20px of margin.

Your green-box class should give the right of elements 20px of margin.

However, the third one (top of elements), only was checked as "accepted" when I entered the value of 40px instead of 20px. Could you please verify?

Issue 2:
In the instructions for the margin, you have the pixel setting for "Top" to 20px instead of 40px.
Issue 1:
Simplest sample program:

from flask import Flask

app = Flask("TestApp")

@app.route("/")
def test():
return "Hello World!"

app.run(host="0.0.0.0", port=5001, ssl_context="adhoc")

Test the web server through a browser: https://ip_address:5001/

The result is: Hello World!.

Run telnet ip_address 5001 (do not add chars as it expects an SSL/TLS session)

Test the web server through a browser: https://ip_address:5001/

The browser request hangs until the telnet is killed.

If you use app.run(host="0.0.0.0", port=5001, ssl_context="adhoc", threaded=True) the result is the same: each request is decoded before spawning the thread.

Simplest example:

import time
from flask import Flask

app = Flask("TestApp")

@app.route("/0")
def test_0():
time.sleep(10)
return "Hello World-0!"

@app.route("/1")
def test_1():
time.sleep(10)
return "Hello World-1!"

@app.route("/2")
def test_2():
time.sleep(10)
return "Hello World-2!"

app.run(host="0.0.0.0", port=5001, ssl_context="adhoc", threaded=True)

Run telnet ip_address 5001

Test the web server through a browser on different tabs using different routes to enable multithreading:

https://ip_address:5001/0

https://ip_address:5001/1

https://ip_address:5001/2

All requests hang until the telnet is killed.

It looks like when using ssl_context each request is strictly decoded in sequence.

Environment:

Python version: 3.10

Flask version: 2.2.2

It is also a security issue. The attack client for an ssl_context based web app is:

from telnetlib import Telnet

hostname = '...'
port = 5001

while True:
with Telnet(hostname, port) as tn:
tn.read_some()

As a temporary workaround, this can be added at the beginning of the Flask program:

import socket
socket.setdefaulttimeout(5) # seconds

Notice that this program works while telnet ip_address 5000 runs, because ssl_context is not used:

import time
from flask import Flask

app = Flask("TestApp")

@app.route("/0")
def test_0():
time.sleep(10)
return "Hello World-0!"

@app.route("/1")
def test_1():
time.sleep(10)
return "Hello World-1!"

@app.route("/2")
def test_2():
time.sleep(10)
return "Hello World-2!"

app.run(host="0.0.0.0", port=5000, threaded=True)

Issue 2:
It would be useful to be able to refer to flash categories using constants, for example:

FLASH_CATEGORY_MESSAGE = 'message'
FLASH_CATEGORY_DEFAULT = FLASH_CATEGORY_MESSAGE

This gives an overview of the already defined categories, and an obvious way to avoid duplicating these in every Flask application.
Issue 1:
Description of the new feature/enhancement

Implement single-instance mode as an option, so that multiple executions of wt.exe would add new tabs to already running instance of WT, instead of opening new windows.

Proposed technical implementation details (optional)

When I run wt.exe multiple times, I get a new Windows Terminal window every time. I do that quite often when navigating folders in Total Commander. I just type wt and expect the new tab to be opened with the directory I'm currently in in TC. Instead, I'd prefer to have a new tab in existing window.

Similarly, when running a shell (wsl.exe) inside Windows Terminal, if I type wt.exe I'd expect another tab to be opened. Currently nothing happens in this scenario (not even new WT window is opened).

I think, this could be managed with a single setting in profile.json:

"mode": "single-window|multiple-window" or sth similar.

Issue 2:
Description of the new feature/enhancement

When I work in the terminal (currently mainly CMDer/ConEmu) I like to keep one terminal going with multiple tabs.

When opening a new terminal window, my terminal does not create a new instance of the application but rather opens a new tab in the currently running instance.

Best approach would probably be to make it an option, I.E., not forcing the functionality on people, but rather have it toggle-able for people like me!

Proposed technical implementation details (optional)

Open a terminal while there is a terminal already running opens the running terminal application and creates a new terminal tab, alt. opens the terminal and allows the user to open a new tab manually.

(Love the terminal, it's really neat!)
Issue 1:
I've noticed some odd behavior with the syntax colourisation for template strings in Visual Studio 2013 (using TypeScript 1.4 plugin). It occurs when the string "#/" is present within the template string after at least one placeholder is present. I realise reading that is as clear as mud so look at the screenshot below for clarification:

As you can see the first 2 examples colourise in the fashion you would hope. The 3rd example behaves in an unexpected fashion after the "#/". Here's the code you can use to reproduce it with:

class highlightingBug {

demo() {

var urlWithoutHash =
`i_look_kind_of_normal_${"I_think"}`;

var urlWithHash =
`and_so_do_I_even_with_#/_in_place_${"I_think"}`;

var urlWithHashAfterFirstPlaceHolder =
`${"But_me_"}_well_things_look_a_little_odd_colour_wise_after_the_#/_${"That_is_what_I_think_anyway"}`;
}
}

Issue 2:
I'm playing with the new support for template strings in release-1.4 and seeing potential issues with syntax highlighting.

In a single-line template string it looks like the string is classified as a keyword.

In a multi-line template string like this:

var template = `/hello/
/world/`;

It looks like the "/hello/" is classified as a keyword and the "/world/" as a regexp.

Sorry if this is just not implemented yet. I looked for an issue first but didn't see one.
Issue 1:
Rossen Stoyanchev opened SPR-9395 and commented

Affects: 3.1.1

This issue is a backport sub-task of #14010

Issue Links:

#14020 Backport "Reinstate check for a type-level @RequestMapping annotation to decide if a bean contains @RequestMapping methods" ("duplicates")

Issue 2:
Rossen Stoyanchev opened SPR-9384 and commented

Affects: 3.1.1

This issue is a backport sub-task of #14010

Issue Links:

#14031 Backport "Reinstate check for a type-level @RequestMapping annotation to decide if a bean contains @RequestMapping methods" ("is duplicated by")

Referenced from: commits 2fa0e63
Issue 1:
In the Carousel documentation, there is the following Usage example:

Usage

Multiple carousels

Carousels require the use of an id on the outermost container, .carousel, for carousel controls to function properly. When adding multiple carousels, or when changing a carousel's id, be sure to update the relevant controls.

Proposed Fix

The places where it says id should be replaced with class or the .carousel should be an id selector instead.

There is also the following example that shows an active class on the first and only carousel item,

Examples

<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
...
</div>

The problem with this is that if you duplicate the div.item element with the active class, having active on multiple items will break the carousel and prevent it from moving left or right.

Proposed Fix

Change the example to

<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active"> <!-- First visible carousel item -->
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
<div class="item">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
...
</div>

Issue 2:
I spent a good half-hour trying to fix an issue which was a direct action of using the example code provided.

http://getbootstrap.com/javascript/#carousel

<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
...
</div>

It might just be my stupid mistake but I copied the item again with the active class, therefore the images were stacked and I thought the plugin was not working etc.

So the resolve might be to indicate active only needs to be on the first item.
Issue 1:
Using elasticsearch java api 1.4.3, I think I'm experiencing a problem similar to what I reported at yakaz/elasticsearch-action-updatebyquery#27 but this time it is the official API that seem to have the issue:

val qb = QueryBuilders.constantScoreQuery(FilterBuilders.termFilter("user", "kimchy"))
// returns false, which is expected because I have no such document in my index
client.prepareExists("myIndex")
.setTypes("myType")
.setQuery(qb)
.execute().actionGet().exists()

// returns true... for any query with an empty (but existing) index/type, which is obviously wrong
client.exists(client.prepareExists("myIndex")
.setTypes("myType")
.setQuery(qb)
.request()).actionGet().exists()

I think ExistsRequestBuilder.request() is the problem here and I need to get an ExistsRequest as it is what my elasticsearch wrapper expects.

Issue 2:
Today we have 3 flavors for each endpoint (for demonstration purpose I only use the _health API)

public interface ClusterAdminClient extends ElasticsearchClient<ClusterAdminClient> {

ActionFuture<ClusterHealthResponse> health(ClusterHealthRequest request);

void health(ClusterHealthRequest request, ActionListener<ClusterHealthResponse> listener);

ClusterHealthRequestBuilder prepareHealth(String... indices);

At least one of them is redundant here already but lemme first explain what is trappy here. If you use the prepareHealth().setWaitForGreenStatus() basically nothing happens. you need to call .get() or .execute().get() or .actionGet() or any of the X flavors. This is not so much of a problem for health because you are waiting for a response, but for endpoints that don't return info that is generally consumed ie. update settings this has in the past lead to so many test bugs that I consider this evil.

Yet, I think we should remove this method entirely and detach the Builders entirely from the Client. Today once a builder is created like this:

ClusterHealthRequestBuilder builder = client.prepareHealth().setWaitForGreenStatus()

it's tied to a client and if you close that client the builder can't be executed. To me if we even keep the builder in the future it should only have a build() method that returns the corresponding request. Then you can call:

ClusterHealthRequestBuilder builder = AdminBuilders.health().setWaitForGreenStatus();
client.health(builder.build());

which is less trappy... oh wait... client.health(builder.build()); returns an ActionFuture<ClusterHealthResponse> which is also redundant IMO. We already have a non-blocking API using a listener which is equally powerful.

I think what we should move to is this:

public interface ClusterAdminClient extends ElasticsearchClient<ClusterAdminClient> {

ClusterHealthResponse health(ClusterHealthRequest request);

void health(ClusterHealthRequest request, ActionListener<ClusterHealthResponse> listener);

that way it's clearly a blocking API and it's easy to use. We still keep the builder (for now ;) ) but remove it's coupling to the client which is super trappy.
Issue 1:
by peterbourgon:

In the spec, under "For statements", the topic of deleting map entries during
iteration is addressed with only the sentence:

> If map entries that have not yet been reached are removed during iteration, the
corresponding iteration values will not be produced.

This program appears to work fine:

> http://play.golang.org/p/P-O47Wp2LF

But the spec doesn't seem to *guarantee* that it will work. If this is guaranteed
behavior, can the spec be clarified? Specifically, can this sentence (or one like it) be
added:

> The current entry in a map iteration may be safely deleted.

Issue 2:
by Douglas.Linder:

The documentation of go build, here:
http://golang.org/pkg/go/build/

Does not account for the possibility of a source file that starts:

// +build TAG
package xxx

This results in the comment being treated as a package comment and not as a tag. The
correct behaviour is achieved by adding an additional line, as:

// +build TAG

package xxx

However, this does not appear in the documentation, which should be updated from:

> Constraints may appear in any kind of source file (not just Go), but they must
appear near the top of the file, preceded only by blank lines and other line comments.

To something that declares that the tag must *also* always be followed by at least one
single blank line, eg.

> Constraints may appear in any kind of source file (not just Go), but they must
appear near the top of the file, preceded only by blank lines and other line comments,
// and followed by at least one single newline so as not to be treated as a comment
attached the following elements. //

Additional information is available on this SO thread:
http://stackoverflow.com/questions/10646531/golang-conditional-compilation/10649653#10649653
Issue 1:
deno install is excellent for installing scripts, but it seems that it could only install ts (and js?) files through dependencies.

For example, std/http/file_server.ts is a simple file server which needs some html template to generate page, but it could only put all html template files(and even a lot of css files) inside the ts file as a string. Maybe it works, but it is not elegant and graceful enough to manage these strings. And this solution is not suit for images(such as favicon.ico) as they are binary files.

More about this example you can see this: https://github.com/denoland/deno/blob/master/std/http/file_server.ts#L200-L288

(It puts all the html and css inside the ts file as a string which is ugly)

The best solution I found is to clone the whole repo(with html and css files outside of ts file) to disk and use deno install ./index.ts manually to install my scripts locally. This install method is too complex and not fascinating at all; thus I was think of some feature such as deno install https://github.com/name/repo to run the same as git clone ... && deno install -n repo ./repo/xxx.ts?

Looking forward to your reply and thanks in advance.

Issue 2:
Problem

I often find myself needing to load non-JavaScript non-TypeScript assets, and various problems arise:

Local module (in git repo) has to use fs but remote module has to use fetch.

The assets cannot be cached.

The assets cannot be bundled.

Suggestion

Add some way to annotate assets using comments, and fetch should support those assets. For example:

// @deno-asset './assets/foo.wasm'
// @deno-asset './assets/bar.png'
await fetch(new URL('./assets/foo.wasm', import.meta.url))
await fetch(new URL('./assets/bar.png', import.meta.url))
// --allow-net is not required since it reads from cache

Alternatives

There is asset reference proposal that is likely not going to get to stage 3 anytime soon.

import assertion proposal had reached stage 3.