使用我的代码,我得到3条消息,object initialization can be simplified
并且在我不断增长的知识渴望(和我的强迫症)中,我想"修复"我的代码,以便这些消息不会出现.我知道我可以设置它,所以这些消息不会出现,但我仍然会在我的脑海里,他们在背景中并不适合我.如果有人能指出如何"简化初始化"那将是很好的,所以我可以提高我的技能.如果需要更多代码,请告诉我,我可以添加它.
第一名:
TreeNode node = new TreeNode(drive.Substring(0, 1), driveImage, driveImage);//issue on this line
node.Tag = drive;
Run Code Online (Sandbox Code Playgroud)
第二:
DirectoryInfo di = new DirectoryInfo(dir);
TreeNode node = new TreeNode(di.Name, 0, 1); //this line
Run Code Online (Sandbox Code Playgroud)
我怀疑它的treenodes是因为我给了他们相同的名字,但我尝试更改名称但它并没有什么区别.
第三:
OleDbCommand select = new OleDbCommand();//this line
select.Connection = cnDTC;
select.CommandText = string.Format("SELECT MAX(VERSION_NO) AS MAX_VERSION FROM ({0})", strSQL2);
Run Code Online (Sandbox Code Playgroud) 我正在尝试安装 jupyterthemes 包并收到此错误。
Collecting jupyterthemes
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /packages/8a/08/9dee6dfd7f2aad6c30282d55c8f495b4dc1e4747b4e2bdbeb80572ddf312/jupyterthemes-0.20.0-py2.py3-none-any.whl
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /packages/8a/08/9dee6dfd7f2aad6c30282d55c8f495b4dc1e4747b4e2bdbeb80572ddf312/jupyterthemes-0.20.0-py2.py3-none-any.whl
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the …
Run Code Online (Sandbox Code Playgroud) 在.NET核心项目中,我更改了所有项目的名称,而不是重新加载所有项目后,当时许多错误显示大约3225。而且主要所有错误都与系统名称空间有关,例如
System.Object
未定义或导入 System.Boolean
未定义或导入 Task
不存在ArgumentNullException
找不到名称空间我该如何解决所有这些错误?
最近我发现IPython notebook
哪个是强大的工具.作为一名IT学生,我一直在寻找一种用Python表示图形的方法.例如,我想知道是否有可以从中抽取的库(如numpy
或matplotlib
?)
{ "1" : ["3", "2"],
"2" : ["4"],
"3" : ["6"],
"4" : ["6"],
"5" : ["7", "8"],
"6" : [],
"7" : [],
"8" : []
}
Run Code Online (Sandbox Code Playgroud)
这样的事情:
有这样的事吗?
背景:
我有同一个数据库的两个帐户,一个“主”帐户和另一个(子)帐户,用于我的网站连接到服务器,以便我可以管理用户可以做什么和不能做什么。这个帐户的很多权限在我访问它之前就已经存在了,所以我不知道所有权限到底是什么,除了我管理的那些。
有一个其他人创建的用户定义的表类型,不要问我他们为什么这样做,
CREATE TYPE [dbo].[AffectedServiceList] AS TABLE(
[AffSerName] [nvarchar](200) NULL
)
GO
Run Code Online (Sandbox Code Playgroud)
这种类型用于像这样的存储过程
ALTER PROCEDURE [dbo].[Contractsetup] @OtherParams, --Easier than typing them all
@list dbo.AFFECTEDSERVICELIST READONLY
Run Code Online (Sandbox Code Playgroud)
主账号可以完美的执行和修改这个过程,但是子账号不能运行或者修改这个存储过程,而在使用受影响的servicelist类型的时候会报错
找不到类型“AffectedServiceList”,因为它不存在或您没有权限。
我试过这样做 grant execute on type::dbo.AFFECTEDSERVICELIST to subaccount
但它仍然返回与权限相同的错误。我已经将它消除到权限中,因为当我尝试修改主帐户时,我刚刚得到
命令成功完成。
在我的机器上,我安装了 python3.4 和最近下载的 python3.6,我想将 python3.6 设置为命令提示符中使用的默认 python。
我已经删除了 python34 路径变量,但是当我通过命令提示符访问 python 时,它仍然默认打开 python3.4。我看到这个关于访问非默认 python 的问题,但那是针对特定文件的。
自从发布问题以来:
我还从系统路径变量中删除了 python34。
where python
在命令提示符中输入会返回以下内容:
C:\>where python
C:\Python34\python.exe
C:\Python36\python.exe
Run Code Online (Sandbox Code Playgroud)
键入echo %PATH%
回车符
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program …
Run Code Online (Sandbox Code Playgroud) 我想知道SELECT ANY TABLE
Oracle内部的权限是如何工作的。
它是否被视为单一特权?或者相当于GRANT SELECT ON MyTable TO MyUser
为每个表创建一个?
例如,我想知道这是否有效:
GRANT SELECT ANY TABLE TO PUBLIC;
REVOKE ALL ON MY_TABLE FROM PUBLIC;
Run Code Online (Sandbox Code Playgroud)
MY_TABLE
在这些查询之后我仍然可以从任何用户那里访问吗?
我试图在SQL Server 2008上进行全文搜索,但是我想要索引的表是一个带有复合主键的表,如下所示:
EXEC sp_fulltext_catalog 'My_Catalog', 'create'
EXEC sp_fulltext_table 'Message', 'create', 'My_Catalog', 'PK__MESSAGES__C87C0C9C0EC32C7A' // PK__MESSAGES__C87C0C9C1EC32C6A is a composite key
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
"'PK__MESSAGES__C87C0C9C1EC32C6A'不是强制执行全文搜索键的有效索引.全文搜索键必须是唯一的,不可为空的单列索引,它不是脱机的,不是在非确定性上定义的或不精确的非持久计算列,没有过滤器,最大大小为900字节.为全文密钥选择另一个索引."
这意味着我无法在具有复合主键的表中使用全文搜索?或者我做错了什么?
t-sql sql-server full-text-search primary-key sql-server-2008
我正在使用CFileDialog,我已经设置了如下所示的初始路径,如代码所示.它不起作用.如果我弄错了,请纠正我.
CFileDialog* filedlg = new CFileDialog(TRUE,(LPCTSTR)NULL , (LPCTSTR)NULL , OFN_HIDEREADONLY| OFN_ENABLESIZING , (LPCTSTR)NULL , FromHandle (hImgDlg) ,0 , FALSE );
filedlg ->m_ofn.lpstrInitialDir = "C:\\" ;
if ( filedlg ->DoModal() == IDOK )
{
/*** do somthing here *****/
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的 Angular 2 Web 应用程序中使用 Stripe Checkout。一切正常,直到我在收到卡令牌后尝试调用 createOrder 函数。
错误是:EXCEPTION: this.createOrder is not a function
收到令牌后如何调用 createOrder 函数?
openCheckout() {
let handler = (<any>window).StripeCheckout.configure({
key: 'pk_test_OtZk....xbk6UQB',
locale: 'no',
token: function (token: any) {
this.createOrder(token, this.cart); //THIS IS WHERE THE ERROR OCCURS
}
});
handler.open({
name: 'Test Store',
description: 'Test Description',
amount: this.cart.totalAmount,
currency: 'nok',
email: 'test@test.no',
image: '../../assets/images/test.png',
['allow-remember-me']: false
});
this.globalListener = this.renderer.listenGlobal('window', 'popstate', () => {
handler.close();
});
}
createOrder(token, cart) {
this.ordersService.createOrder(token, this.cart).subscribe(
res => { …
Run Code Online (Sandbox Code Playgroud) python ×3
c# ×2
sql-server ×2
t-sql ×2
.net ×1
.net-core ×1
angular ×1
c++ ×1
cfiledialog ×1
graph ×1
ipython ×1
mfc ×1
networkx ×1
oracle ×1
pip ×1
primary-key ×1
privileges ×1
python-3.x ×1
sql ×1
typescript ×1