小编Jim*_*988的帖子

MySQL连接2个表但重命名列,因为它们具有相同的名称

我有2张桌子,

管理员,定价

  • admin包含列(id,date_created,type,value)
  • 定价包含列(id,date_created,relation,value)

我想做一个选择加入两个表,其中pricing.relation = admin.id

如何重命名value,id和date_created行,以便它们不会相互覆盖?

这是我正在尝试的事情:

$sub_types = $database->query('
    SELECT 
    pricing.*,
    admin.*
        FROM 
        pricing,
        admin
            WHERE pricing.relation = admin.id
');
Run Code Online (Sandbox Code Playgroud)

php mysql join identity-column

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

如何从视图中调用控制器 - Laravel

我有一个列出时间表的视图.

在该视图中,每个时间表都有一个可交付的字段...我有一个DeliverableController,它有一个动作"DropdownList",它调用模型并获取可交付成果列表并将它们推送到可交付的视图(只创建一个下拉框) .

当我循环遍历我的时间表时,我想得到DeliverableController/DropdownList的响应,并把它放在我的可交付字段应该在时间表上.

  • A)有一种方法可以从视图中获取控制器的响应
  • B)有没有办法从控制器方法中获取控制器的响应,以便我可以将结果推送到视图?

到目前为止我的代码是:

DeliverableController:

class DeliverableController extends BaseController {   
    private $deliverableRepository;

    function __Construct( IDeliverableRepository $deliverableRepo )
    {
        $this->deliverableRepository = $deliverableRepo;
    }

    ...

    public /*  */ function DropdownList()
    {        
        $deliverables = $this->deliverableRepository->Deliverables(); 
        return View::make( 'Deliverable/_DropdownList', array( "Model" => $deliverables ) );
    }
}
Run Code Online (Sandbox Code Playgroud)

Deliverables/_DropdownList查看:

<?php
    foreach( $Model as $item )
    {
?>
    <select name="">
        <option value = "<?php echo $item->ID; ?>"><?php echo $item->Title; ?></option>
    </select>    
<?php
    }
?>
Run Code Online (Sandbox Code Playgroud)

时间表控制器:

class TimesheetController extends BaseController {      
    private …
Run Code Online (Sandbox Code Playgroud)

laravel

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

捕获命令行输出(按字符输出,无需每行等待)

我当前正在将命令行进程的输出渲染到文本框中。问题是,在正常的命令提示符窗口中,写入的其中一行有一个负载栏之类的东西......每隔几秒它就会输出一个“。” 到屏幕上......经过几个点后,它将开始一个新行,然后继续加载,直到完成其过程。

使用以下代码,而不是获取这些“。” 一个接一个地出现,我的OutputDataRecieved正在等待整行被写出...所以负载栏是无用的...即,它等待“........................”并且然后它对它起作用。

有没有一种方法可以跟踪输出到屏幕的每个字符而不是每行输出的字符?

//Create process
System.Diagnostics.Process process = new System.Diagnostics.Process();

// arguments.ProcessStartInfo contains the following declaration:
// ProcessStartInfo = new ProcessStartInfo( "Cmd.exe" )
// {
//     WorkingDirectory = executableDirectoryName,
//     UseShellExecute = false,
//     RedirectStandardInput = true,
//     RedirectStandardOutput = true,
//     CreateNoWindow = true,
// }
process.StartInfo = arguments.ProcessStartInfo;

//Start the process
StringBuilder sb = new StringBuilder();

bool alreadyThrownExit = false;

// The following event only seems to be run per line output rather than each character …
Run Code Online (Sandbox Code Playgroud)

c#

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

如何延迟Angular 6/Typescript中的observable

我有以下方法GetCurrentUserDelayedTest,我想延迟.我在这里留下了原始实现GetCurrentUser来演示我最初是如何使用它的:

import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { User } from '../models/user';

export class UserService {

    // Normal method without delay
    public GetCurrentUser(): Observable<User>
    {
        return of(new User(""));
    }

    // Method with delay attempt at code
    public GetCurrentUserDelayedTest(): Observable<User>
    {
        var observable = new Observable<User>((observable) => {
            setTimeout(() => {
                return observable.complete();
            }, 2000);
        });

        observable.subscribe(() => {
            return of(new User(""));
        });

        return observable;
    }
}
Run Code Online (Sandbox Code Playgroud)

我试图延迟该方法将其数据返回2秒.

我究竟做错了什么?我是angular …

typescript angular

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

ASP 经典 - 如何加入字符串数组/加入/内爆不起作用

Dim stringIdCollection
    stringIdCollection = Join( Request.Form( "id" ), "', '" ) )    
Dim whereStatement
    whereStatement = "WHERE id IN ('" & stringIdCollection & "');"
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

Microsoft VBScript 编译错误“800a0401”

预计声明结束

/includes/Process.asp,第 49 行 stringIdCollection = Join( Request.Form( "id" ), "', '" ) ) --------------------- -------------------------------------------------- -^

是否可以在 Request.Form 上使用 Join ?

我希望输出是:

“哪里 ID 在('122','344','599')”

join request.form asp-classic

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

如何使用mvvm显示Windows Phone 8 app的加载栏

如何从视图模型中调用加载栏?凉爽的小点漂浮着.我似乎无法找到正确的Bing短语来搜索它.

c# mvvm windows-phone-8

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

User.Identity.Name - 哪个程序集引用将其带入您的项目?

我找不到User.Identity.Name来自哪个引用程序集.我怎么找到它?我需要将它添加到类库而不是我已经创建的默认MVC 5应用程序,以便我可以访问它吗?

http://msdn.microsoft.com/en-us/library/system.web.httpcontext.user(v=vs.110).aspx

C#类库/ AUser.cs

public class AUser
{
    public string Username
    {
        get
        {
            return User.Identity.Name // doesn't notice User
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

c# windows-authentication .net-assembly visual-studio-2013 asp.net-mvc-5

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

暂时禁用密码要求

我正在将用户帐户迁移到最少需要6个字符的应用程序.

如果我运行以下功能

var result = await UserManager.CreateAsync(newUser, "");
Run Code Online (Sandbox Code Playgroud)

它会当然抱怨密码无效.有没有办法我可以暂时忽略密码要求,这样我就可以创建我的用户?

笔记:

private ApplicationUserManager _userManager;
    public ApplicationUserManager UserManager
    {
        get
        {
            if (_userManager == null)
            {
                this._userManager = HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
            }
            return _userManager;
        }
        private set
        {
            _userManager = value;
        }
    }
Run Code Online (Sandbox Code Playgroud)

遗憾的是,这不起作用:

this._userManager.PasswordValidator = new PasswordValidator
{
    RequiredLength = -1, // I've also tried 0
    RequireNonLetterOrDigit = false,
    RequireDigit = false,
    RequireLowercase = false,
    RequireUppercase = false,
};
Run Code Online (Sandbox Code Playgroud)

因为它声明"您的密码长度必须至少为-1个字符"

c# owin asp.net-identity-2

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

剃刀和半完成html标签

我该如何做到这一点?

@if(item.i % 2 == 0)
{
   <div class="row">
}       

@if(item.i % 2 == 0)
{
   </div>
}
Run Code Online (Sandbox Code Playgroud)

没有它抱怨我没有完成标记,因此我认为我没有}在if语句的末尾添加

c# razor

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

你如何访问子方法

你如何访问子方法,例如?

class A
{
    public function Start()
    {
        // Somehow call Run method on the B class that is inheriting this class
    }
}

class B extends A
{
    public function Run()
    {
        ...
    }
}

$b = new B();
$b->Start(); // Which then should call Run method
Run Code Online (Sandbox Code Playgroud)

php

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