小编Vip*_*agi的帖子

VSCode 不建议和自动完成 java 代码

我正在 VSCode 中编写一个 java 程序,我注意到建议、错误报告和自动完成功能不起作用。弹出显示以下错误的通知:

Sorry, something went wrong activating IntelliCode support for Java. Please check the "Language 
Support for Java" and "VS IntelliCode" output windows for details.
Run Code Online (Sandbox Code Playgroud)

我尝试在设置中查找错误,但找不到任何错误。我也尝试先卸载然后重新安装上述扩展,但没有帮助。

任何帮助非常感谢!

java visual-studio-code

11
推荐指数
2
解决办法
3万
查看次数

提交后的表单未定义“this”,但未定义反应中的按钮

注意:这个问题不是问如何绑定事件处理程序。它在问为什么在没有绑定的情况下,'s (它指的是一个对象)和's (它的)this不一致。ButtononClickFormonSubmitundefined

完整问题:

this如果我没有在构造函数内绑定方法,我试图检查方法内的对象会发生什么。我发现 Form 和 Button 的结果不同。下面是我的代码,以便更好地理解:

const {Button, Form, Input} = Reactstrap;

class Test extends React.Component{
    constructor(props){
        super(props);
    }

    handleClick(){
        console.log(this);    //This gives complete information about the Button object and its properties 
    }

    handleSubmit(e){
        console.log(this);    //This one is undefined 
        e.preventDefault();
    }

    render(){
        return(
            <React.Fragment>
                <Form onSubmit={this.handleSubmit} >

                <Input type="submit" name="submit">Submit</Input>

                </Form>

                <Button name="butt1" onClick={this.handleClick}>Click</Button>
            </React.Fragment>
        );
    }
}

ReactDOM.render(<Test />, document.getElementById("root"));
Run Code Online (Sandbox Code Playgroud)
<div id="root"></div>

<script …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs reactstrap

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

Java ArrayList子列表给出错误的结果

问题所述,我试图在 Java 中的 ArrayList 中的特定位置之后找到元素的索引。下面是我的实现:

import java.io.*;
import java.util.*;
class palindrome{
    public static void main(String[] args)throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int[] array = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        int n=array[0];
        List<StringBuilder> ls=new ArrayList<StringBuilder>();
        while(n-->0){
            ls.add(new StringBuilder(br.readLine()));
        }
        StringBuilder rev=ls.get(1).reverse();
        System.out.println(rev);
        int i=1;
        System.out.println(ls.subList(i+1,ls.size()).indexOf(rev));
    }
}
Run Code Online (Sandbox Code Playgroud)

我正在为程序提供以下输入

4 2
oo
ox
xx
xo
Run Code Online (Sandbox Code Playgroud)

所以,逻辑是我试图找到'ox'的反向索引,它应该返回3,但代码总是返回-1。我无法发现任何错误。请告诉我你们是否发现了任何错误。

谢谢你!

java

0
推荐指数
1
解决办法
74
查看次数

在 C 中对 long double 应用“not”运算符

我在下面的 C 代码中对 long double 变量应用了 not 运算符:

#include <stdio.h>

int main()
{
   long double a;
   signed char b;
   int arr[sizeof(!a+b)];
   printf("\n%d",sizeof(arr));
   return 0;
}

Run Code Online (Sandbox Code Playgroud)

这段代码输出 16。我无法理解当我们在 long double 上应用 not 运算符时会发生什么,就像我们对a.

请帮助我了解这段代码发生了什么。

谢谢你!

c sizeof not-operator long-double integer-promotion

0
推荐指数
1
解决办法
156
查看次数

从 openJDK 8 升级到 openJDK 11

我在 ubuntu 18.04 系统中安装了 JDK 8,现在想使用将其升级到 JDK 11 。我只是想知道这是否会产生任何问题。升级时会删除旧版本吗(实际上我希望旧版本自行删除)?

java java-11

0
推荐指数
1
解决办法
1万
查看次数

反应导航 5.x 中的自定义抽屉组件无法正常工作

我尝试自定义react-navigation抽屉(v 5.x),因为我想在抽屉标题中添加公司信息。但这并不好,因为将自定义抽屉组件添加到抽屉会废弃抽屉上已经可用的任何导航项目列表(所有屏幕的名称)。下面是我的代码:

const CustomDrawerContentComponent = (props) => {
  return (<ScrollView>
    
      <View style={styles.drawerHeader}>
        <View style={{flex:1}}>
        <Image source={require('./images/logo.png')} style={styles.drawerImage} />
        </View>
        <View style={{flex: 2}}>
          <Text style={styles.drawerHeaderText}>Ristorante Con Fusion</Text>
        </View>
      </View>

  </ScrollView>)
  
};

render(){
  return(
     <NavigationContainer>
      <Drawer.Navigator initialRouteName="Home" drawerStyle={{
    width: 240,
  }} drawerContent={(props)=><CustomDrawerContentComponent {...props} />}>
        <Drawer.Screen name="Home" component={HomePage} options={{
          title: 'Home',
          drawerIcon: ({focused, size}) => (
            <Icon
              name="home"
              type="font-awesome"
              size={size}
              color={focused ? '#7cc' : '#ccc'}
            />
          )
        }}/>
        <Drawer.Screen name="Menu" component={MenuNavigator} options={{
          title: 'Menu',
          drawerIcon: ({focused, size}) => (
            <Icon
              name="list" …
Run Code Online (Sandbox Code Playgroud)

reactjs react-native react-navigation react-navigation-drawer

0
推荐指数
1
解决办法
780
查看次数

结合两个表格计算学生参加考试的次数

我有下面两个表学生和考试: 学生表:

Id   Name
1    Samantha
2    Jane
3    Bob
4    Scarlet
5    David
Run Code Online (Sandbox Code Playgroud)

考试:

student_id   subject
1     Biology
1     physics
3     history
4     geography
4     geography
Run Code Online (Sandbox Code Playgroud)

现在我需要找出哪个学生参加了哪次考试多少次,我期望的确切结果是:

student.id examination.subject no_of_times
1          biology      1
1          physics      1
3          history      1
4          geography    2

Run Code Online (Sandbox Code Playgroud)

我尝试过以下查询,但得到了错误的答案:

select Student.id, examination.subject, count(*) from Student join examination Student.id = examination.student_id;

Run Code Online (Sandbox Code Playgroud)

请帮助我编写正确的查询以获得正确的预期输出!

谢谢你!

mysql count

0
推荐指数
1
解决办法
1万
查看次数