Tag: variables

如何检查一个variables是否在Bash中设置?

我如何知道是否在Bash中设置了一个variables? 例如,如何检查用户是否给函数第一个参数? function a { # if $1 is set ? }

为什么variables名前面是星号,而不是后面的types?

为什么大多数C程序员都这样命名variables: int *myVariable; 而不是像这样: int* myVariable; 两者都是有效的。 在我看来,星号是types的一部分,而不是variables名的一部分。 谁能解释这个逻辑?

什么是C ++中的引用variables?

C ++中引用variables的简短定义是什么?

Angular2 – 错误如果不检查是否存在{{object.field}}

我有一个关于检查对象中是否存在字段的问题。 我想打印所有类别的用户,所以我正在做这样的事情: <ul *ngIf="user.categories.length > 0" *ngFor="#category of user.categories"> <li> {{category.name}} </li> </ul> 原因? 所有的数据正确打印,但我在Web控制台中出现错误,如: Cannot read property 'name' of null 但是当我做这样的事情时: <ul *ngIf="user.categories.length > 0" *ngFor="#category of user.categories"> <li *ngIf="category"> {{category.name}} </li> </ul> 那么一切都好。 我做错了什么,或者我每次都要检查一下? 你有过这样的问题吗? 提前致谢。

在ArrayBlockingQueue中,为什么要将最终成员字段复制到本地最终variables?

在ArrayBlockingQueue ,所有需要锁的方法在调用lock()之前将其复制到本地finalvariables中。 public boolean offer(E e) { if (e == null) throw new NullPointerException(); final ReentrantLock lock = this.lock; lock.lock(); try { if (count == items.length) return false; else { insert(e); return true; } } finally { lock.unlock(); } } 当字段this.lock是final时候,是否有任何理由将this.lock复制到局部variableslock final ? 此外,它还在使用E[]之前使用本地副本: private E extract() { final E[] items = this.items; E x […]

什么是特殊的美元符号shellvariables?

在Bash中,似乎有几个variables具有特殊的,一致的含义值。 例如, ./myprogram &; echo $! 将返回后台myprogram进程的PID。 我知道别人,比如$? 我认为这是目前的TTY。 有其他人吗?

int和long在C ++中有什么区别?

纠正我,如果我错了, int是4个字节,范围从-2,147,483,648到2,147,483,647(2 ^ 31) 长度是4个字节,范围从-2,147,483,648到2,147,483,647(2 ^ 31) C ++有什么区别? 它们可以互换使用吗?

如何在使用SUDO时保持环境variables

当我用sudo使用任何命令时,环境variables不在那里。 例如,设置HTTP_PROXY后,命令wget没有sudo可以正常工作。 但是,如果我键入sudo wget它说它不能绕过代理设置。

在JavaScript中将string转换为variables名称

我寻找解决scheme,但找不到任何工作。 我有一个variables叫onlyVideo 。 "onlyVideo"string被传入一个函数。 我想在函数内部设置variablesonlyVideo 。 我怎样才能做到这一点? (有很多variables可以调用到函数中,所以我需要dynamic工作,而不是硬编码的语句。) 编辑:可能有更好的方式做你想做的事情。 我在JavaScript冒险中很早就提出了这个问题。 看看JavaScript对象是如何工作的。 一个简单的介绍: // create JavaScript object var obj = { "key1": 1 }; // assign – set "key2" to 2 obj.key2 = 2; // read values obj.key1 === 1; obj.key2 === 2; // read values with a string, same result as above // but works […]

SQL Server中的临时表和表variables有什么区别?

在SQL Server 2005中,我们可以通过两种方式创build临时表: declare @tmp table (Col1 int, Col2 int); 要么 create table #tmp (Col1 int, Col2 int); 这两者有什么区别? 对于@tmp是否仍然使用tempdb,或者内存中是否发生任何事情,我都读过了相互冲突的意见。 在哪种情况下,一个performance优于另一个?