小编Ray*_*ito的帖子

Visual Studio 2017无法连接到WSL,表示用户名和密码错误

我遵循了Microsoft的本教程.我创建了我的WSL用户名和密码,安装了所有必需的应用程序,并启动了SSH服务.问题在于我从Tools > Options > Cross Platform > Connection Manager菜单中的Visual Studio连接到它.

我按照说明操作:

  • 主机名= localhost
  • 港口= 22
  • 用户名=我为WSL创建的用户名
  • 验证类型=密码
  • 密码=我为WSL用户名创建的密码.

当我这样做时,它说我的用户名或密码不正确.但我知道他们是对的.我无法发布图片来显示它,因为我的声誉还没有达到10但是它突出显示了红色的用户名和密码栏并且说Authentication failure. Please make sure credentials are correct.

我知道我可以连接到设备,因为我尝试连接到我的Raspberry Pi.每当我尝试调试任何东西时,它就会给我一个分段错误.但那是另一天的另一个问题.

关于为什么我无法连接到我的WSL的任何想法?

linux cross-compiling visual-studio

3
推荐指数
1
解决办法
1329
查看次数

将符号位,指数和尾数转换为浮点型?

我有符号位,指数和尾数(如下代码所示)。我正在尝试采用此值并将其转换为浮点数。这样做的目的是获得59.98(它将显示为59.9799995

uint32_t FullBinaryValue = (Converted[0] << 24) | (Converted[1] << 16) |
                            (Converted[2] << 8) | (Converted[3]);

unsigned int sign_bit = (FullBinaryValue & 0x80000000);
unsigned int exponent = (FullBinaryValue & 0x7F800000) >> 23;
unsigned int mantissa = (FullBinaryValue & 0x7FFFFF);
Run Code Online (Sandbox Code Playgroud)

我最初尝试做的只是将它们一点一点地放置在原处:

float number = (sign_bit << 32) | (exponent << 24) | (mantissa);

但这给了我 2.22192742e+009.

然后,我要使用公式:1.mantissa + 2^(exponent-127)但是您不能在二进制数中放置小数位。

然后我尝试获取每个单独的值(指数,特征,尾数),然后得到

Characteristic: 0x3B (Decimal: 59)
Mantissa: 0x6FEB85 (Decimal: 7334789)
Exponent: 0x5 (Decimal: 5) This is after …
Run Code Online (Sandbox Code Playgroud)

c c++ math floating-point precision

2
推荐指数
1
解决办法
854
查看次数

Android 导航组件无法与对话框片段一起使用

免责声明:我已经检查了文档,因为2.1.0导航组件支持对话框片段。(https://developer.android.com/jetpack/androidx/releases/navigation#2.1.0

我遇到的错误

DialogFragment尝试从 a 转到my时出现此错误Start Destination

java.lang.IllegalStateException: Fragment PostDistressDialog{829f5d1} (bbbc4926-684b-491b-9772-e0f0ffebe0af)} not associated with a fragment manager.

PostDistressDialog是使用导航组件DialogFragment调用的JournalEntryFragment(可以在下面的地图中看到)。PostDistressDialog不是 的内部类JournalEntryFragment。它属于自己扩展的一类DialogFragment

我的导航图的图片

在此输入图像描述

函数调用 NavController

public class PostDistressDialog extends DialogFragment implements ISaveDatabase {

...

@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
    if (getArguments()!=null) {

        ...

        // Set up the Alert Dialog
        AlertDialog.Builder alertDialog = new AlertDialog.Builder(getContext());
        alertDialog.setTitle(R.string.distressed_levels);
        alertDialog.setMessage(R.string.distressed_how_feel_post);

        // Inflate and set the layout for …
Run Code Online (Sandbox Code Playgroud)

android android-fragments android-navigation android-navigationview

2
推荐指数
1
解决办法
7961
查看次数