AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-16928404

janci's questions

Martin Hope
janci
Asked: 2024-09-29 14:44:57 +0800 CST

我的函数没有覆盖所有返回路径吗?或者这是编译器的错误

  • 8

我有以下函数,在我最近更新 Visual Studio 2022 编译器 (17.11.4) 之前,该函数一直有效。我从编译器收到的错误是:not all code paths return a value。但哪条路径未被覆盖?一个是return GetAllDatesWithoutLock();,另一个是重新抛出ExceptionDispatchInfo.Throw(ex);?此代码在更新之前运行正常。

public ScheduleDateTimeResponse GetAllDates()
{
    log.Info("GetAllDates before locking");
    semaphoreObject.Wait();
    try
    {
        return GetAllDatesWithoutLock();
    }
    catch (Exception ex)
    {
        Console.WriteLine(Thread.CurrentThread.Name + "Error occurred.");
        log.Error(Thread.CurrentThread.Name + "Error occurred in GetAllDates:", ex);
        ExceptionDispatchInfo.Throw(ex);
    }
    finally
    {
        semaphoreObject.Release();
        log.Info("GetAllDates after locking");
    }
}
c#
  • 1 个回答
  • 70 Views
Martin Hope
janci
Asked: 2024-09-10 21:44:39 +0800 CST

是否有 osgi.ee 包

  • 5

我一直在关注 Lars Vogel 的教程 [https://www.vogella.com/tutorials/EclipseTycho/article.html#google_vignette]。我目前被困在 RCP 插件项目的编译错误中: Software being installed: ... requires 'osgi.ee; (&(osgi.ee=JavaSE)(version=22))' but it could not be found。有很多关于它的讨论,但我还没有看到解决方案。我想知道 Eclipse 版本:版本:2024-06 (4.32.0) 是否有针对上述问题的解决方案。关于这个问题的大多数讨论都超出了我的理解范围。下面是我的聚合器 pom 文件:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.vogella.tycho</groupId>
    <artifactId>releng</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <properties>
        <tycho.version>4.0.8</tycho.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
    </properties>

    <!--repositories>
        <repository>
            <id>eclipse</id>
            <url>http://localhost:8080/site</url>
            <layout>p2</layout>
        </repository>

    </repositories-->
    <!--repositories>
    <repository>
      <id>my-repo1</id>
      <name>your custom repo</name>
      <url>https://mvnrepository.com/artifact/at.bestsolution.efxclipse.eclipse/javax.annotation</url>
    </repository-->


    <modules>
        <module>MyFeature</module>
        <module>MyPlugin</module>
        <module>updatesite</module>

    </modules>

    <dependencies>

        <!--
        https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api -->
        <!--dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <version>3.0.2</version>
        </dependency-->

        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <version>2.1.1</version>
            <scope>provided</scope>
        </dependency>
        <!--dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.annotation</artifactId>
            <version>3.0</version>
        </dependency-->
        <!-- https://mvnrepository.com/artifact/org.osgi.ee/ee.foundation -->
        <!-- https://mvnrepository.com/artifact/org.osgi/org.osgi.core -->
        <!-- https://mvnrepository.com/artifact/org.osgi.ee/ee.minimum -->


    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>tycho-p2-director-plugin</artifactId>
                    <version>${tycho.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-maven-plugin</artifactId>
                <version>${tycho.version}</version>
                <extensions>true</extensions>
            </plugin>
            <!--Enable the replacement of the SNAPSHOT version in the final product configuration-->
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-packaging-plugin</artifactId>
                <version>${tycho.version}</version>

                <executions>
                    <execution>
                        <phase>package</phase>
                        <id>package-feature</id>
                        <configuration>

                            <finalName>
                                ${project.artifactId}_${unqualifiedVersion}.${buildQualifier}</finalName>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>target-platform-configuration</artifactId>
                <version>${tycho.version}</version>
                <configuration>
                    <pomDependencies>wrapAsBundle</pomDependencies>
                    <!-- Optional set the Java version you are using-->
                    <executionEnvironment>JavaSE-21</executionEnvironment>
                    <target>
                        <file>../TargetDefinition/myTarget.target</file>
                    </target>
                    <environments>
                        <environment>
                            <os>linux</os>
                            <ws>gtk</ws>
                            <arch>x86_64</arch>
                        </environment>
                        <environment>
                            <os>win32</os>
                            <ws>win32</ws>
                            <arch>x86_64</arch>
                        </environment>
                        <environment>
                            <os>macosx</os>
                            <ws>cocoa</ws>
                            <arch>x86_64</arch>
                        </environment>
                    </environments>
                </configuration>
            </plugin>

        </plugins>
    </build>

</project>
maven
  • 1 个回答
  • 23 Views
Martin Hope
janci
Asked: 2024-02-24 17:59:32 +0800 CST

routerLink 不会导航到指定路由器出口的延迟加载模块

  • 6

我正在尝试使用命名导航到延迟加载模块中定义的组件router-outlet。当我单击“测试”按钮(test.component.html)时,出现异常:

NG04002:无法匹配任何路由。URL 段:“测试”。

我的app-routing.module.ts是:

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './components/home/home.component';
import { AboutComponent } from './components/about/about.component';
import { DashboardComponent } from './components/dashboard/dashboard.component';
import { AuthGuard } from './auth.gard';
import { ListComponent } from './list.component';
import { TestComponent } from './test/test.component';


const myModule = () => import('./my-routing/my-routing.module').then(x => x.MyRoutingModule);
const routes: Routes = [
  { path: '', component: TestComponent },
  { path: 'experiment', loadChildren: myModule },
  {
    path: 'home',
    component: HomeComponent, outlet: "outlet1"
  },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

我的test.component.html看起来像这样:

<div class="container">
  <div class="row">
    <div class="col-2">
      <a [routerLink]="[{ outlets:{ outlet1: ['home'] }}]" routerLinkActive="active"><button type="button" class="btn btn-primary">
          Home</button></a>
    </div>
    <div class="col-1">
      <a [routerLink]="[{ outlets:{ outlet1: ['experiment','test'] }}]"><button type="button" class="btn btn-primary">
          Test</button></a>
    </div>

  </div>
</div>

我的my-routing.module.ts看起来像:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ListComponent } from '../list.component';
import { TestComponent } from '../test/test.component';

const routes: Routes = [

  { path: 'test', component: ListComponent, outlet: "outlet1" },

];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class MyRoutingModule { }
angular
  • 1 个回答
  • 26 Views
Martin Hope
janci
Asked: 2024-02-24 14:24:22 +0800 CST

routerLink 不会导航到延迟加载模块

  • 5

我在导航到延迟加载模块中定义的组件时遇到问题。该组件ListComponent在路径“test”下定义(my-routing.module.ts - 延迟加载模块)。每当我单击“测试”按钮(test.component.html)时,我都会收到异常:

NG04002:无法匹配任何路由。URL 段:“测试”。

为什么?

我的app-routing.module.ts如下所示:

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './components/home/home.component';
import { AboutComponent } from './components/about/about.component';
import { DashboardComponent } from './components/dashboard/dashboard.component';
import { AuthGuard } from './auth.gard';
import { ListComponent } from './list.component';
import { TestComponent } from './test/test.component';


const myModule = () => import('./my-routing/my-.module').then(x => x.MyRoutingModule);
const routes: Routes = [
  { path: '', component: TestComponent },
  { path: 'experiment', loadChildren: myModule },

];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

我的my-routing.module.ts是:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ListComponent } from '../list.component';
import { TestComponent } from '../test/test.component';

const routes: Routes = [

  { path: 'test', component: ListComponent },

];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class MyRoutingModule { }

我的test.component.html看起来像这样:

<div class="container">
  <div class="row">
    
    <div class="col-1">
      <a [routerLink]="['test']"><button type="button" class="btn btn-primary">
          Test</button></a>
    </div>

  </div>
</div>
angular
  • 1 个回答
  • 34 Views
Martin Hope
janci
Asked: 2023-10-29 13:53:52 +0800 CST

如何在“select”控件中动态设置默认值

  • 5

我订阅 HTTP 服务器以接收数据,之后我的select控件将通过 Angular 框架加载数据。我的目标是设置默认值。我的默认值由我从服务器收到的对象的三个值组成,并用“/”分隔,因此 HTML 代码如下所示:

<label>{{ functionStr }}</label>
<select #element formControlName="selectedUser" class="form-select" (change)="changeClient($event)">
    <option *ngFor="let account of accountsAvailable4Function">{{ account.firstName }}/{{ account.lastName }}/{{ account.email }}
    </option>
</select>

我在初始化时使用了默认值FormGroup:

var selected = this.accountsAvailable4Function[1].firstName+"/"+this.accountsAvailable4Function[1].lastName+"/"+this.accountsAvailable4Function[1].email
this.form = this.formBuilder.group({
      scheduledDate: ['', Validators.required],
      selectedUser: [selected, [Validators.required]],
    });

这会引发异常,因为我的accountsAvailable4Function数组尚未初始化。

我尝试使用FormGroup如下控件来设置它。这也不起作用,因为我怀疑该控件尚未加载:

var selected = this.accountsAvailable4Function[1].firstName+"/"+this.accountsAvailable4Function[1].lastName+"/"+this.accountsAvailable4Function[1].email
this.f['selectedUser'].setValue(selected);
      

是否有一些我可以监听的事件,以便在加载选择控件时通知我?

附加:加载accountsAvailable4Function数组:

this.accountService.getAll()
      .pipe(first())
      .subscribe({
        next: (accounts: Account[]) => {
          accounts.forEach(account => {
            account.userFunctions.forEach(userFunc => {
              if(userFunc.userFunction == this.functionStr) {
                this.accountsAvailable4Function.push(account);
              }
            });
          });
          
          /* HTML select control selects by default first element - verify it*/
          this.selectedAccount = this.accountsAvailable4Function[0];
          this.dataSource = new MatTableDataSource(this.accountsSelected4Function);
          this.dataSource.paginator = this.paginator;

        },
        complete: () => {
          this.accountsLoaded = true;
          var selected = this.accountsAvailable4Function[1].firstName+"/"+this.accountsAvailable4Function[1].lastName+"/"+this.accountsAvailable4Function[1].email
          this.f['selectedUser'].setValue(selected);
        },
        error: error => {
          this.alertService.error(error);
          this.accountsLoaded = true;
        }
      });         
html
  • 1 个回答
  • 25 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    重新格式化数字,在固定位置插入分隔符

    • 6 个回答
  • Marko Smith

    为什么 C++20 概念会导致循环约束错误,而老式的 SFINAE 不会?

    • 2 个回答
  • Marko Smith

    VScode 自动卸载扩展的问题(Material 主题)

    • 2 个回答
  • Marko Smith

    Vue 3:创建时出错“预期标识符但发现‘导入’”[重复]

    • 1 个回答
  • Marko Smith

    具有指定基础类型但没有枚举器的“枚举类”的用途是什么?

    • 1 个回答
  • Marko Smith

    如何修复未手动导入的模块的 MODULE_NOT_FOUND 错误?

    • 6 个回答
  • Marko Smith

    `(表达式,左值) = 右值` 在 C 或 C++ 中是有效的赋值吗?为什么有些编译器会接受/拒绝它?

    • 3 个回答
  • Marko Smith

    在 C++ 中,一个不执行任何操作的空程序需要 204KB 的堆,但在 C 中则不需要

    • 1 个回答
  • Marko Smith

    PowerBI 目前与 BigQuery 不兼容:Simba 驱动程序与 Windows 更新有关

    • 2 个回答
  • Marko Smith

    AdMob:MobileAds.initialize() - 对于某些设备,“java.lang.Integer 无法转换为 java.lang.String”

    • 1 个回答
  • Martin Hope
    Fantastic Mr Fox msvc std::vector 实现中仅不接受可复制类型 2025-04-23 06:40:49 +0800 CST
  • Martin Hope
    Howard Hinnant 使用 chrono 查找下一个工作日 2025-04-21 08:30:25 +0800 CST
  • Martin Hope
    Fedor 构造函数的成员初始化程序可以包含另一个成员的初始化吗? 2025-04-15 01:01:44 +0800 CST
  • Martin Hope
    Petr Filipský 为什么 C++20 概念会导致循环约束错误,而老式的 SFINAE 不会? 2025-03-23 21:39:40 +0800 CST
  • Martin Hope
    Catskul C++20 是否进行了更改,允许从已知绑定数组“type(&)[N]”转换为未知绑定数组“type(&)[]”? 2025-03-04 06:57:53 +0800 CST
  • Martin Hope
    Stefan Pochmann 为什么 {2,3,10} 和 {x,3,10} (x=2) 的顺序不同? 2025-01-13 23:24:07 +0800 CST
  • Martin Hope
    Chad Feller 在 5.2 版中,bash 条件语句中的 [[ .. ]] 中的分号现在是可选的吗? 2024-10-21 05:50:33 +0800 CST
  • Martin Hope
    Wrench 为什么双破折号 (--) 会导致此 MariaDB 子句评估为 true? 2024-05-05 13:37:20 +0800 CST
  • Martin Hope
    Waket Zheng 为什么 `dict(id=1, **{'id': 2})` 有时会引发 `KeyError: 'id'` 而不是 TypeError? 2024-05-04 14:19:19 +0800 CST
  • Martin Hope
    user924 AdMob:MobileAds.initialize() - 对于某些设备,“java.lang.Integer 无法转换为 java.lang.String” 2024-03-20 03:12:31 +0800 CST

热门标签

python javascript c++ c# java typescript sql reactjs html

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve