小编Moh*_*war的帖子

在 Node js 中连接两个音频文件

我正在开发一个网页,用户将在其中选择两个音频文件,应用程序将连接这两个音频文件并将其作为单个输出音频文件。我在后端使用nodejs,在客户端使用angularjs。我怎样才能达到这个要求?我浏览了很多图书馆,没有一个适合它。

audio node.js angularjs

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

带有 Spring Data ElasticSearch 的 GeoPoint 给出错误:QueryParsingException[field [location] is not a geo_point field]

我在春季有弹性搜索实体,如下所示:

@Document(indexName = "cities_in", type = "cities")
public class CityDocument {

@Id
private String id;

@Field(type = FieldType.String)
private String city;

@Field(type = FieldType.Object)
@GeoPointField
private GeoPoint location;
}
Run Code Online (Sandbox Code Playgroud)

但是当我使用 curl 看到映射时,我curl -s -XGET 'http://localhost:9200/cities_in/cities/_mapping?pretty=1'得到的输出为:

  {
   "cities_in" : {
   "mappings" : {
    "cities" : {
      "properties" : {
        "city" : {
          "type" : "string"
        },
        "id" : {
         "type" : "string"
      },
      "location" : {
        "properties" : {
          "geohash" : {
            "type" : "string"
          },
          "lat" : { …
Run Code Online (Sandbox Code Playgroud)

spring elasticsearch geopoints spring-data-elasticsearch

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

ngIf 未观察到变量变化

以下是一个 HTML 代码片段,其中 ngIf 检查为forceAngletrue,默认情况下forceAngle为 false。单击按钮后,我调用该ForceAngles()函数并将其设置forceAngle为 true。问题是一旦设置为 true,ngIf 应该检查状态并显示正确的模板。目前我没有得到预期的变化。我是这个域的新手,在互联网上冲浪了几个小时以获得适当的解决方案。我想我错过了一个 Angular 基础知识。在这方面需要专家支持。

<ng-container matColumnDef="AssemblyAngle">
            <mat-header-cell *matHeaderCellDef [ngClass]='txt-wrapper'> Assembly Angles</mat-header-cell>
            <div *ngIf="forceAngle == 'true' ; else inputtemplate;">
              <mat-cell *matCellDef="let element">
                <span class="txt-inner">{{forceAngle}}</span>
              </mat-cell>
            </div>
            <ng-template #inputtemplate>

              <mat-cell *matCellDef="let element" class="txt-wrapper mat-header-cell">
               abc
              </mat-cell>
            </ng-template>
      </ng-container>

<button class="btn-secondary" (click)="ForceAngles()">Force Angles</button>
Run Code Online (Sandbox Code Playgroud)

.ts 文件

ForceAngles() {
  this.forceAngle = 'true';
  
  this.loadCompressorOptimizeData();
  console.log(this.forceAngle);
  return this.forceAngle;
}
Run Code Online (Sandbox Code Playgroud)

typescript angular-material2 angular

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

春季启动:CORS问题

我正在使用Spring Boot版本2.0.2Release。下面是我的安全配置

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(
        prePostEnabled = true,
        securedEnabled = true,
        jsr250Enabled = true)
@ComponentScan("com.mk")
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    private AuthenticationProvider myAuthenticationProvider;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable();
        http.cors().configurationSource(corsConfigurationSource())
                .and()
                .csrf().disable()
                .anonymous().and()
                .authorizeRequests()
                .antMatchers(HttpMethod.GET,"/index.html").permitAll()
                .antMatchers(HttpMethod.POST,"/login").permitAll()
                .antMatchers(HttpMethod.GET,"*").authenticated()
                .and().httpBasic();
    }
    @Bean
    CorsConfigurationSource corsConfigurationSource() {
        CorsConfiguration configuration = new CorsConfiguration();
        configuration.setAllowedOrigins(Arrays.asList("*"));
        configuration.setAllowedMethods(Arrays.asList("GET","POST"));
        configuration.setAllowCredentials(true);
        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
        source.registerCorsConfiguration("/**", configuration);
        return source;
    }
Run Code Online (Sandbox Code Playgroud)

由于CORS的问题,我无法调用任何API(包括login是allowAll)。

在浏览器上,我得到了(它与Postman一起使用,因为在那里没有进行CORS检查)

无法加载http:// localhost:8080 / myurl:对预检请求的响应未通过访问控制检查:所请求的资源上没有'Access-Control-Allow-Origin'标头。因此,不允许访问源' http:// localhost:4200 '。响应的HTTP状态码为403。

spring spring-mvc spring-security cors spring-boot

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

如何将时间从下午2点或凌晨3点转换为PHP中的HH:MM:SS格式?

我怎样才能将像下午2点或凌晨3点的时间转换为PHP中的HH:MM:SS格式?

php

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

运行时sql过多.如何提高?

我在Sql Server MSSM中执行以下SQL查询,运行时间超过5秒.由内连接连接的表,只有几万条记录.为什么需要这么长时间?

查询的较高的成本是: - 聚集索引扫描[MYDB] [DBO] [LinPresup] [PK_LinPresup_Linea_IdPresupuesto_IdPedido] 78%.. - 聚集索引查找[MyDB].[dbo].[Pedidos].[PK_Pedidos_IdPedido] 19%

谢谢.

Declare @FILTROPAG bigint 
set @FILTROPAG = 1

Declare @FECHATRABAJO DATETIME
set @FECHATRABAJO = getDate()

Select * from(
SELECT distinct Linpresup.IdCliente, Linpresup.IdPedido, Linpresup.FSE, Linpresup.IdArticulo, 
        Linpresup.Des, ((Linpresup.can*linpresup.mca)-(linpresup.srv*linpresup.mca)) as Pendiente,
        Linpresup.IdAlmacen, linpresup.IdPista, articulos.Tip, linpresup.Linea,
        ROW_NUMBER() OVER(ORDER BY CONVERT(Char(19), Linpresup.FSE, 120) +
             Linpresup.IdPedido + CONVERT(char(2), linpresup.Linea) DESC) as NUM_REG
FROM Linpresup INNER JOIN Pedidos on LinPresup.IdPedido = Pedidos.IdPedido
               INNER JOIN Articulos ON Linpresup.IdArticulo = Articulos.IdArticulo
where  pedidos.Cerrado = 'false' and …
Run Code Online (Sandbox Code Playgroud)

sql sql-server sql-server-2008-r2

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

如何删除对象而无法访问它?

我知道每当我为类创建一个新对象时,该对象都存储在内存中.我也知道,在创建该对象时,只能在其创建的大括号范围内访问它(范围可见性).我需要找到一种方法来删除创建它的大括号之外的那个对象.我简要地看了一下智能指针,它可能就是我想要使用的东西?我假设它是,我只是不确定.如果一个智能指针可以满足我的需求,有人会请我提供一个如何使用智能指针访问创建它之外的对象的示例吗?谢谢 :)

编辑:

我正在尝试做的例子:

class ModernWarfare2
{
    //my class
    ModernWarfare2();
};


DWORD XamHook(DWORD r3, DWORD r4, DWORD r5)
{
    switch(XamGetCurrentTitleId())//a function that tells what game is being played
    {
    case Xbox360Dashboard://if i were to exit the game mw2
        {
            if(CODAllocated)//a boolean
            {
                //free the memory of the previous cod game
                if(MW2Allocated)//another boolean
                {
                    delete[] MW2;//gives me an error because i dont have access to MW2
                }
            }
            break;
        }
    case COD_MW2:
        {
            if(!CODAllocated)
            {
                if(!MW2Allocated)
                {
                    ModernWarfare2 *MW2 = new …
Run Code Online (Sandbox Code Playgroud)

c++ memory-management object visual-c++

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

Angular JS控制器调用两次(ng-controller)

我正在开发一个离子应用程序,当使用angular登录我的控制器被调用两次时,我已经查看了所有其他类似的问题,但没有找到解决方案.

问题是,当我删除ng-controller="LoginCtrl as lgnCtrl" 我得到我的控制器一次调用但没有双向数据绑定.

这是我的路线档案:

$stateProvider
.state('login', {
  url: "/login",
  views: {
    'main': {
      templateUrl: "app/user/loginView.html",
      controller: "LoginCtrl",
      controllerAs: "lgnCtrl"
    }
  }
})

  $urlRouterProvider.otherwise('/login');
Run Code Online (Sandbox Code Playgroud)

这是我的控制器

angular.module('starter.controllers')
.controller('LoginCtrl', LoginCtrl);

function LoginCtrl($state, $storage, $translate, $ionicPopup, LoginService, messageService) {
    var lgnCtrl = this;
    console.log("user dash 1zz");
    return lgnCtrl;
}
Run Code Online (Sandbox Code Playgroud)

这是我的观点:loginView.html:

<ion-view view-title="loginView" id="signinBlk">
   <ion-content>
       <div class="list list col span_1_of_2 "  ng-controller="LoginCtrl as lgnCtrl">
   </div>
   </ion-content>
</ion-view>
Run Code Online (Sandbox Code Playgroud)

index.html的:

<body ng-app="starter">
  <ion-nav-view name="main"></ion-nav-view>
</body>
Run Code Online (Sandbox Code Playgroud)

javascript angularjs angular-ui-router ionic-framework ng-controller

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

动态过滤器链接Java 8

我有一个代码

private void processFiles() {
        try {
            Files.walk(Paths.get(Configurations.SOURCE_PATH))
                    .filter(new NoDestinationPathFilter()) //<--This one
                    .filter(new NoMetaFilesOrDirectories()) //<--and this too
                    .forEach(
                            path -> {
                                new FileProcessorFactory().getFileProcessor(
                                        path).process(path);
                            });
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
    }
Run Code Online (Sandbox Code Playgroud)

截至目前,我有各种其他方法,与上述方法相同,只是在滤波器方面有所不同.有些方法有额外的过滤器,有些方法有不同或没有.

是否有可能创建一个条件所需的过滤器集合并动态传入.并且集合中的所有过滤器都应用于流.我不想对正在应用的过滤器列表进行硬编码.我想让它基于配置.我如何实现这一目标?

java java-8

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

在什么情况下可以在C中使用long int

在我的机器中,我得到以下结果:

sizeof(long) = 8

sizeof(long int) = 8
Run Code Online (Sandbox Code Playgroud)

在哪里使用long int,为什么不使用int

c int long-integer

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

JSON.parse:网络上的不同行为

我有一个静态网站,我在本地机器上使用jetty服务器(用于测试)和github页面(实时)运行.

两个站点的源代码完全相同.我使用相同的浏览器(Mozilla Firefox)进行下面的测试我最近使用以下代码来获取jQuery Ajax

 $.ajax({
        url: jsonFilePath,
        error: function (response) {... },
        success: function (responsedata) {
            var responsedata = JSON.parse(latestData);
            ...
Run Code Online (Sandbox Code Playgroud)

上面的代码在我的本地服务器上运行时工作正常,但在github服务器(相同的浏览器)上运行时失败

由于这个原因,它在github上失败了.它在定义dataType之后开始工作,如下所示

 $.ajax({
            url: jsonFilePath,
            dataType: "json",
            ...
Run Code Online (Sandbox Code Playgroud)

我的问题是,为什么在本地服务器上测试期间没有捕获到这个?所有的liberaries,data,json,js,jQuery文件都是一样的.可能导致这种行为差异的原因是什么?

javascript ajax jquery json

-1
推荐指数
1
解决办法
42
查看次数