小编Str*_*der的帖子

如何在Java中使用@inherited注释?

我没有@Inherited在Java中获得注释.如果它自动为你继承了这些方法,那么如果我需要以自己的方式实现该方法那么那么呢?

如何了解我的实施方式?

再加上它是说,如果我不想用这个,做它,而在一个老式的Java办法,我必须实现的equals(),toString()以及hashCode()该方法的Object类,也是的注释类型的方法java.lang.annotation.Annotation类.

这是为什么?

即使我不知道@Inherited注释和用于工作的程序,我也从未实现过.

请有人从头开始解释我这件事.

java inheritance annotations

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

什么是ROWS UNBOUNDED PRECEDING用于Teradata?

我刚刚开始使用Teradata,我在Teradata遇到了一个名为"Rows unbounded preceding"的Ordered Analytical Function.我尝试了几个网站来了解这个功能,但是所有这些网站都使用了一个复杂的例子来解释它.能否请你给我一个天真的例子,以便我能清楚地了解基础知识.

sql teradata window-functions

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

如何在SQL中拆分和显示单词中的不同字母?

昨天在求职面试中,我被问到这个问题,我对此一无所知.假设我有一个单词"Manhattan"我想在SQL中只显示字母'M','A','N','H','T'.怎么做?任何帮助表示赞赏.

sql

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

Async/Await VS Task.Run:何时使用?如何使用?

好吧,我希望我得到了async/await的基础知识,但仍有一些问题在脑海里挥之不去.

但现在我正在谈论的问题.假设在这个简单的例子中

static void Main(string[] args)
{

    Method();

    Console.WriteLine("Main Thread");

    Console.ReadLine();

}

public async static void Method()

{

    await Task.Run(new Action(LongTask));

    Console.WriteLine("New Thread");

}

public static void LongTask()

{

    Thread.Sleep(8000);

    Console.WriteLine("Long Task");

}
Run Code Online (Sandbox Code Playgroud)

Main Thread在调用Method()并遇到等待8秒后,主线程仍然继续并打印.

因此,当遇到await时,Method()返回调用者,即返回到main函数,保存同步上下文并从那里继续执行.

Main Thread首先打印.

然后在8秒后完成,Long Task然后New Thread打印.

这部分我得到了.我的问题在于我的申请:

public IList<createcaseoutput> createCase(CreateCaseInput CreateCaseInput,SaveCaseSearchInput SaveCaseSearchInput)    
{
    .............
    SQL.CaseSQL.getCreateCaseParameters(CreateCaseInput, out strSPQuery, out listParam);    
    var AcctLst = rep.ExecuteStoredProcedure<createcaseoutput>(strSPQuery, listParam).ToList();

    if (!string.IsNullOrEmpty(AcctLst.ElementAt(0).o_case_seq.ToString()))

    {
        await saveCaseSearch(SaveCaseSearchInput, AcctLst.ElementAt(0).o_case_seq);
    }

    console.writeline("Async called");
    return AcctLst;    
}

public async …
Run Code Online (Sandbox Code Playgroud)

.net c# multithreading asynchronous async-await

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

使用Karma Jasmine进行Angular JS测试

我有这样的示例路线:

  angular
        .module('appRouter',['ui.router'])
        .config(function($stateProvider,$urlRouterProvider){
            $stateProvider
                .....
                .....
                .state('settings.account',{
                    url:'/account',
                    templateUrl:'templates/account.html',
                    controller:function(resolveData){
                        console.log(resolveData);
                    },
                    resolve:{
                        resolveData : function($http){
                            var root = 'https://jsonplaceholder.typicode.com';
                            return $http.get(root+'/posts/1').then(function(response){

                                return response.data;
                            });
                        }
                    }
                });

            .....
Run Code Online (Sandbox Code Playgroud)

它只是一个测试URL,我可以在线获取示例JSON数据

https://jsonplaceholder.typicode.com/posts/1

我想测试一下状态.

  beforeEach(function(){
        module('appRouter');
    });

    beforeEach(inject(function(_$rootScope_,_$injector_,_$state_,_$httpBackend_,$templateCache){
        $rootScope = _$rootScope_;
        $state = _$state_;
        $injector = _$injector_;
        $httpBackend = _$httpBackend_;
        $templateCache.put('templates/account.html','');
    }));

   it('should resolve "resolveData"',function(){
        const state = $state.get('settings.account');
        const resolveFn = state.resolve.resolveData;

                $httpBackend.whenGET('https://jsonplaceholder.typicode.com/posts/1').respond(function(){
        return [
            200,{
                "userId": 1,
                "id": 1,
                "title": "...",
                "body": "..."
        }]
    });

    $httpBackend.expectGET('https://jsonplaceholder.typicode.com/posts/1');

    $injector.invoke(resolveFn); …
Run Code Online (Sandbox Code Playgroud)

javascript unit-testing angularjs karma-jasmine

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

chrome无痕模式下的LocalStorage

因此,在我的Angular 1.5应用程序中,我也想保留页面加载时的数据,

所以我正在使用$window.localStorage

我正在从中读取一些价值localStoarge,它也可以正常工作incognito mode

The page refreshes and yet the values are retained

if($window.localStorage.selectedServers !== undefined)
    selectedObj = JSON.parse($window.localStorage.selectedServers);
Run Code Online (Sandbox Code Playgroud)

问题是

当我复制网址并在隐身的新标签页中打开时,

localStorage 得到不确定的。

如何摆脱这个问题?还是我做错了什么?

javascript html5 web-storage incognito-mode angularjs

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

Task.Run在for循环中

我有一个for循环里面

第一: 我想计算运行所需的SQL

第二步: 异步运行SQL,无需单独等待它们循环完成

我的代码看起来像:

for (
        int i = 0;
        i < gm.ListGroupMembershipUploadDetailsInput.GroupMembershipUploadInputList.Count;
        i++)
{
     // Compute
     SQL.Upload.UploadDetails.insertGroupMembershipRecords(
         gm.ListGroupMembershipUploadDetailsInput.GroupMembershipUploadInputList[i],max_seq_key++,max_unit_key++,
         out strSPQuery,
         out listParam);

     //Run the out SPQuery async
     Task.Run(() => rep.ExecuteStoredProcedureInputTypeAsync(strSPQuery, listParam));
}
Run Code Online (Sandbox Code Playgroud)

insertGroupMembershipRecords单独的DAL类中的方法如下所示:

public static GroupMembershipUploadInput insertGroupMembershipRecords(GroupMembershipUploadInput gm, List<ChapterUploadFileDetailsHelper> ch, long max_seq_key, long max_unit_key, out string strSPQuery, out List<object> parameters)
{
    GroupMembershipUploadInput gmHelper = new GroupMembershipUploadInput();
    gmHelper = gm;
    int com_unit_key = -1;
    foreach(var item in com_unit_key_lst){
        if (item.nk_ecode == gm.nk_ecode)
            com_unit_key = item.unit_key; …
Run Code Online (Sandbox Code Playgroud)

c# for-loop teradata task-parallel-library async-await

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

从Angular 1.5中的父组件调用子组件函数

在我的父组件的模板中,有一个嵌套组件.

<div class="inner" ng-show="!vm.loading">
    <div class="info-panel">
        <h3 id="basePrice">Current Cost</h3>
        <p>
            <small>
                <a href role="button" data-toggle="modal" ng-click="vm.openCostsModal()">See Details</a>
            </small>
        </p>
    </div>
    ......
    ......
    <pricingcalculation></pricingcalculation>
Run Code Online (Sandbox Code Playgroud)

<pricingcalculation></pricingcalculation>是嵌套组件.它的定义如下:

(function () {
    "use strict";
    angular.module("app")
        .component("pricingcalculation", {
            transclude: true,
            templateUrl: "/static/angtemplates/pricing-calculation.html",
            controllerAs: "vm",
            controller: ["$rootRouter", function ($rootRouter) {
                var vm = this;
                vm.openCostsModal = function () {
                    vm.costItems = [];
                    vm.projectedCostItems = [];
                    vm.totalOfCostItems = 0;
                    .....
                    .....
Run Code Online (Sandbox Code Playgroud)

因此,在父See Details按钮模板上定义的按钮单击

我希望调用子组件的函数openCostsModal().

怎么做 ?

angularjs

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

Angular 2中没有路由器提供商

作为一个新手,我在Angular 2中设置路线时遇到了问题.虽然我很确定,但这是我非常缺乏的基础.

我想要的只是我App Component加载并向我显示标题.在它下面,一个链接将加载contact-list component路由器出口部分.

import { Component,OnInit } from '@angular/core';
import { Contact } from './contact';

@Component({
  selector: 'app-root',
  template: `
    <h1>{{title}}</h1>
    <a routerLink="/contact-list">Contact List</a>
    <router-outlet></router-outlet>
    `
})
export class AppComponent{
  title = 'Welcome to my Dream App!';
}
Run Code Online (Sandbox Code Playgroud)

这里是 app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';

import { AppComponent } …
Run Code Online (Sandbox Code Playgroud)

javascript angular-routing angular-providers angular

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

Left Join/IS NULL如何消除一个表中而不存在另一个表中的记录?

我很难理解为什么LEFT JOIN/ IS NULL消除一个表中的记录而不是另一个表中的记录.这是一个例子

SELECT  l.id, l.value
FROM    t_left l
LEFT JOIN t_right r
ON      r.value = l.value
WHERE   r.value IS NULL
Run Code Online (Sandbox Code Playgroud)

为什么要r.value = NULL删除记录?我不理解 .我知道我遗漏了一些非常基本的东西,但目前我甚至无法弄清楚那个基本的东西.如果有人向我详细解释,我将不胜感激.

我想要一个非常基本的解释.

mysql sql isnull left-join

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