scalar

Objects with no '.Count' Property - use of @() (array subexpression operator) vs. [Array] cast

送分小仙女□ 提交于 2019-11-29 07:21:12
I am trying to perform some simple if statements, but all of the newer cmdlets that are based upon [Microsoft.Management.Infrastructure.CimInstance] don't seem to expose a .count method? $Disks = Get-Disk $Disks.Count Doesn't return anything. I found that I can cast this as an [array], which makes it returns a .NET .count method as expected. [Array]$Disks = Get-Disk $Disks.Count This works without directly casting it as an array for previous cmdlets: (Get-Services).Count What is the recommended way to get around this? An example that doesn't work: $PageDisk = Get-Disk | Where {($_.IsBoot -eq

What does addScalar do?

北城以北 提交于 2019-11-28 21:08:43
The JavaDoc says: SQLQuery org.hibernate.SQLQuery.addScalar(String columnAlias, Type type) Declare a scalar query result I know what executeScalar is in C#, but this scalar and C# scalar seem to be absolutely different. This is declaring that you want the result of the query to return objects for individual named columns, rather than entities. For instance createSQLQuery("SELECT COUNT(*) AS c FROM Users").addScalar("c").uniqueResult() Will return a single Long . If you specify multiple scalars, the result will come back as an array of Object . Its similar to executeScalar except that it works

how to create and call scalar function in sql server 2008

浪子不回头ぞ 提交于 2019-11-28 19:33:02
问题 I have created a Scalar Functions, it was created successfully, but when I call the function using select statement, it says invalid object, I altered the function, I got the message command completed successfully, but when I call the function, I gets same error. below is the function I am trying to call: ALTER FUNCTION [dbo].[fn_HomePageSlider] ( @PortalID int, @ArticleID int ) RETURNS NVARCHAR(MAX) AS BEGIN DECLARE @HTML NVARCHAR(MAX) SET @HTML = ''; Declare @Title varchar(1000) Select

PHP - cannot use a scalar as an array warning

人盡茶涼 提交于 2019-11-28 11:52:19
I have the following code: $final = array(); foreach ($words as $word) { $query = "SELECT Something"; $result = $this->_db->fetchAll($query, "%".$word."%"); foreach ($result as $row) { $id = $row['page_id']; if (!empty($final[$id][0])) { $final[$id][0] = $final[$id][0]+3; } else { $final[$id][0] = 3; $final[$id]['link'] = "/".$row['permalink']; $final[$id]['title'] = $row['title']; } } } The code SEEMS to work fine, but I get this warning: Warning: Cannot use a scalar value as an array in line X, Y, Z (the line with: $final[$id][0] = 3, and the next 2). Can anyone tell me how to fix this? You

Can scalar functions be applied before filtering when executing a SQL Statement?

孤人 提交于 2019-11-28 04:32:29
问题 I suppose I have always naively assumed that scalar functions in the select part of a SQL query will only get applied to the rows that meet all the criteria of the where clause. Today I was debugging some code from a vendor and had that assumption challenged. The only reason I can think of for this code failing is that the Substring() function is getting called on data that should have been filtered out by the WHERE clause. But it appears that the substring call is being applied before the

Scalar vs. primitive data type - are they the same thing?

£可爱£侵袭症+ 提交于 2019-11-28 02:47:27
In various articles I have read, there are sometimes references to primitive data types and sometimes there are references to scalars. My understanding of each is that they are data types of something simple like an int, boolean, char, etc. Is there something I am missing that means you should use particular terminology or are the terms simply interchangeable? The Wikipedia pages for each one doesn't show anything obvious. If the terms are simply interchangeable, which is the preferred one? Michael Ekstrand I don't think they're interchangeable. They are frequently similar, but the difference

Objects with no '.Count' Property - use of @() (array subexpression operator) vs. [Array] cast

十年热恋 提交于 2019-11-28 00:58:58
问题 I am trying to perform some simple if statements, but all of the newer cmdlets that are based upon [Microsoft.Management.Infrastructure.CimInstance] don't seem to expose a .count method? $Disks = Get-Disk $Disks.Count Doesn't return anything. I found that I can cast this as an [array], which makes it returns a .NET .count method as expected. [Array]$Disks = Get-Disk $Disks.Count This works without directly casting it as an array for previous cmdlets: (Get-Services).Count What is the

What does addScalar do?

不羁岁月 提交于 2019-11-27 20:51:55
问题 The JavaDoc says: SQLQuery org.hibernate.SQLQuery.addScalar(String columnAlias, Type type) Declare a scalar query result I know what executeScalar is in C#, but this scalar and C# scalar seem to be absolutely different. 回答1: This is declaring that you want the result of the query to return objects for individual named columns, rather than entities. For instance createSQLQuery("SELECT COUNT(*) AS c FROM Users").addScalar("c").uniqueResult() Will return a single Long . If you specify multiple

When to return a pointer, scalar and reference in C++?

不打扰是莪最后的温柔 提交于 2019-11-27 17:43:07
I'm moving from Java to C++ and am a bit confused of the language's flexibility. One point is that there are three ways to store objects: A pointer, a reference and a scalar (storing the object itself if I understand it correctly). I tend to use references where possible, because that is as close to Java as possible. In some cases, e.g. getters for derived attributes, this is not possible: MyType &MyClass::getSomeAttribute() { MyType t; return t; } This does not compile, because t exists only within the scope of getSomeAttribute() and if I return a reference to it, it would point nowhere

c# LINQ: how to retrieve a single result

非 Y 不嫁゛ 提交于 2019-11-27 13:50:54
问题 Kind of new to linq, whats the simplest way to retrieve a single result using linq? example, my query var query = from c in db.productInfo where c.flavor == "Classic Coke" && c.container == "Can" select c.co2Target; it should only return a single field with a double value. how do i pull it out of query? In the past i had used ExecuteScalar. How do i do it with linq? I would like to preserve its data type UPDATE: Here's where I am now. The problem is that the test query im running here is