小编Dan*_*lis的帖子

IntelliJ在鼠标悬停时显示JavaDocs工具提示

在Eclipse中,当将鼠标悬停在方法,变量等上时,将显示带有相应JavaDoc的工具提示.IntelliJ中有这样的功能吗?

java eclipse ide intellij-idea

595
推荐指数
10
解决办法
15万
查看次数

Angular2 RC 5.找不到动态加载组件的组件工厂

我正在尝试将我的动态组件加载程序从RC4更新到RC5,因为不推荐使用ComponentResolver.我已将加载程序更新为以下内容

@Component({
    selector: 'component-dispatcher',
    template: `<div #container></div>` // Define the template here because of its brevity
})
export class ComponentDispatcherComponent implements OnInit, OnDestroy {
    @Input() component:any; // Some dynamic component to render
    @Input() options:any;   // Component configuration, optional
    @Input() data:any;      // Data to render within the component

    // Inject the dynamic component onto the DOM
    @ViewChild("container", {read: ViewContainerRef}) container:ViewContainerRef;

    private componentReference:ComponentRef<any>;

    constructor(private resolver:ComponentFactoryResolver) {
    }

    ngOnInit() {
        // Create our component now we're initialised
        let componentFactory = this.resolver.resolveComponentFactory(this.component);
        this.componentReference = …
Run Code Online (Sandbox Code Playgroud)

angular

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

在OS X上找不到bash curl命令.我在哪里可以找到它?

我不知道自己要做什么,我是编程和尝试自学的新手.我正在尝试安装自制软件,ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)结果是"-bash:curl:command not found"

我一直在搜索谷歌,但似乎无法找到任何帮助我的东西.当我输入which curl它时,只是进入下一行终端,好像我刚刚打开终端...
我已经安装了命令行工具安装的xcode,甚至下载重新安装它以防万一有问题.并不重要,但我试图安装自制软件的原因是它需要用于dnscrypt所需的libsodium.

当我输入curl-config它时,为我提供OPTION的可用值包括:

  --built-shared says 'yes' if libcurl was built shared
  --ca        ca bundle install path
  --cc        compiler
  --cflags    pre-processor and compiler flags
  --checkfor [version] check for (lib)curl of the specified version
  --configure the arguments given to configure when building curl
  --features  newline separated list of enabled features
  --help      display this help and exit
  --libs      library linking information
  --prefix    curl install prefix
  --protocols newline separated …
Run Code Online (Sandbox Code Playgroud)

macos bash homebrew curl

24
推荐指数
2
解决办法
9万
查看次数

为什么以及何时需要展平JSON对象?

我很惊讶,之前没有人问过这个问题.

查看Json对象文档和快速谷歌搜索并没有产生令人满意的结果.

它的优点是什么?这个怎么运作?


编辑:为了清楚起见,请看一下这个展平/不展平的例子.

压缩/取消嵌套嵌套JSON对象的最快方法

谢谢.

javascript json flatten

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

JDBC SQL SERVER:该语句未返回结果集

我正在从Microsoft SQL Server Studio执行以下查询,该查询工作正常并显示结果:

SELECT *
INTO   #temp_table
FROM   md_criteria_join
WHERE  user_name = 'tecgaw'

UPDATE #temp_table
SET    user_name = 'tec'
WHERE  user_name != 'tec'

SELECT *
FROM   md_criteria_join
WHERE  user_name = 'tec'
   AND view_name NOT IN (SELECT view_name
                         FROM   md_criteria_join
                         WHERE  user_name = 'tecgaw')
UNION
SELECT *
FROM   #temp_table
ORDER  BY view_name,
      user_name,
      crit_usage_seq,
      crit_join_seq 
Run Code Online (Sandbox Code Playgroud)

但是,如果我在Java中执行相同的查询,则会抛出异常,声明"该语句未返回结果集".这是Java代码:

statement = conn.getConnection().createStatement();
resultSet = stmt.executeQuery(sql.toString());
Run Code Online (Sandbox Code Playgroud)

是因为我不能在一个语句中做多个SQL查询(即,创建#temp_table,更新它,然后使用它我的select语句)?

java sql-server jdbc resultset

12
推荐指数
3
解决办法
4万
查看次数

我为什么要使用Socket.io?

我正在学习Node.js,目前正在学习WebSockets.据我了解,Socket.io旨在解决各种浏览器对WebSockets的不一致支持......如果你查看了caniuse WebSockets,看来WebSockets目前几乎完全支持.任何人都可以解释为什么我应该在这种情况下使用Socket.io与WebSockets?

websocket node.js socket.io

9
推荐指数
1
解决办法
4402
查看次数

JDBC:只有当`con.commit`没有成功时,`con.rollback()`才有效吗?

我是Java JDBC的新手,并开发了小型数据库应用程序.我正在学习
O'Reilly - 使用JDBC和Java第2版进行数据库编程.

con.rollback()有效果只有在con.commit没有成功?

实际上我猜con.rollback()即使con.commit()成功也会产生影响.这意味着将其用作" 撤消 "动作.

我成功con.rollback()后试着打电话con.commit(),但是我没猜到.好吧/预期呢?

这个例子来自我上面提到的那本书:

con.rollback()被注释掉了.它接近尾声con.close().尝试取消注释.成功con.rollback()后不回滚东西con.commit().

import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;

public class UpdateLogic
{

    public static void main(String args[])
    {
        Connection con = null;

        try
        {
            String driver = "com.mysql.jdbc.Driver";
            Class.forName(driver).newInstance();
            String url = "jdbc:mysql://localhost:3306/Company";
            Statement s;
            con = DriverManager.getConnection(url, "root", "");
            con.setAutoCommit(false); // make sure auto commit is off!
            s = con.createStatement();// …
Run Code Online (Sandbox Code Playgroud)

java commit jdbc rollback

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

在IntelliJ IDEA中重新运行失败和未运行的测试

让我来描述一个简单的用例:

在我们的项目中运行所有测试可能需要长达10分钟.

有时我在第一次测试失败后会在代码中看到一个明显的错误,因此我想停止运行所有测试,修复错误并重新运行它们.不幸的是,我可以从一开始就重新运行所有测试,或者只重新运行失败的测试.

是否有一个IDEA插件允许我重新运行失败的测试和测试,当我按下"停止"时尚未执行?

junit intellij-idea

7
推荐指数
1
解决办法
1612
查看次数

Google People API"请求掩码不能为空"

我正在尝试请求通过Google OAuth登录的用户的个人资料信息.我的请求形成正确,我成功登录,但当我尝试在PHP中发出以下请求时,我得到错误请求掩码不能为空.有效路径是:...

但是,从Google People API people.get文档中可以清楚地看出,请求掩码值是可选的,如果没有传递,将返回除people.connections.list之外的所有值.这是我的代码:

// The entire OAuth process works up until this point...
// create the service
$service = new Google_Service_People($this->client);

try {
  $results = $service->people->get('people/me');
} catch(\Exception $exception) {
  echo $exception->getMessage();
  exit;
}
Run Code Online (Sandbox Code Playgroud)

以下是我从此错误中获得的异常消息:

{ "error": { "code": 400, "message": "Request mask can not be empty. Valid paths are: [person.addresses, person.age_ranges, person.biographies, person.birthdays, person.bragging_rights, person.cover_photos, person.email_addresses, person.events, person.genders, person.im_clients, person.interests, person.locales, person.memberships, person.metadata, person.names, person.nicknames, person.occupations, person.organizations, person.phone_numbers, person.photos, person.relations, person.relationship_interests, …

google-oauth google-people

6
推荐指数
2
解决办法
1518
查看次数

Angular 2 TestModuleMetadata没有EntryComponents属性

我正在使用Angular CLI 1.0.0-beta.32.2并正在为Angular 2服务编写单元测试,该服务动态创建一个Component并将其插入另一个Component.

在我的单元测试中,我尝试创建一个模拟组件来测试我的服务,但输出会ng test抛出一个错误,说明我的模拟组件是在entryComponents属性中指定的.当我尝试将Component添加到entryComponentsTestModuleMetadata对象的属性中时,如下所示:TestBed.createTestingModule({...entryComponents: [ TestDialogComponent ]...})我看到以下错误说明该entryComponents属性不存在.

Chrome 56.0.2924 (Windows 10 0.0.0) DialogService should create a child component when opening FAILED Error: No component factory found for TestDialogComponent. Did you add it to @NgModule.entryComponents?

查看TestModuleMetadata定义显示entryComponents属性不存在.那么如何在Angular 2和Jasmine的单元测试中动态创建一个Component呢?

unit-testing typescript angular-cli angular

5
推荐指数
1
解决办法
3486
查看次数