408 questions
6
votes
2
answers
307
views
What exactly does the Comma operator "," do
The formal description of the comma operator (,) is:
As a binary operator, the comma creates an array or appends to the array being created. In expression mode, as a unary operator, the comma creates ...
2
votes
1
answer
66
views
Empty enumeration from Enumerable.Select; or why does its enumerator seem to behave differently from other enumerators?
I am writing a library function to split an enumeration into multiple spans of enumerations but am running into an inexplicable issue with the enumerator from linq Select clause. Please see ...
0
votes
1
answer
129
views
Destructuring in a Ruby block when using index
Without using index I was able to destructure the first and second elements of an Array of Arrays like so:
[ [ 1, 2 ], [ 3, 4 ] ].each do |first, second|
puts second
end
#=> 2
#=> 4
I then ...
3
votes
1
answer
132
views
Does the use of an iterator imply a heap object?
Does the creation of an object of type IEnumerable<T> (such as the numbers object of type IEnumerable<int> in the below code example) imply the creation of an object on the heap that has ...
1
vote
0
answers
23
views
COM object output saved to variable in PowerShell cannot be reused after first access [duplicate]
I have a question regarding COM object output saved to a variable in PowerShell:
$netShare = New-Object -ComObject HNetCfg.HNetShare
$connections = $netShare.EnumEveryConnection
$connectionsProps = $...
3
votes
1
answer
255
views
In C#, my IEnumerator is reset / created anew when entering a method / local function. Why? [duplicate]
Consider this example:
List<int> l = [1, 2, 3, 4, 5];
void DoSomethingWith(IEnumerator<int> e) {
Console.WriteLine(e.MoveNext());
Console.WriteLine(e.Current);
}
using(var e = l....
0
votes
1
answer
268
views
The most elegant way of applying several filters in Ruby #select
I have a query object in my application that filters data with Array#select method
class QueryObject
def call(filters)
data = get_data # returns array
data = by_param1(data, filter[:param1])...
3
votes
2
answers
589
views
HashTable enumeration with unexpected results
This may be a dumb question so please be kind LOL. I'm trying to wrap my head around something I just ran into.
First
I have a HashTable that I can enumerate using the following:
$ht = [hashtable]@{&...
1
vote
1
answer
121
views
Swift enumerators: how is it implemented for empty collection?
I'm implementing a few custom enumerators for my data model, e.g.
struct Land {
// …
let council: Council
let size: Int
}
extension Collection<MyModel> {
func lands(in council: Council, ...
0
votes
1
answer
523
views
FOR EACH LOOP Container working in SSIS but failing as an SQL Job or in SSISDB Integration Service Catalogs, Even after providing correct File path
I am transferring data from folder(contains CSV Files) to SQL Server database using FOR EACH LOOP Container in SSIS. That works well in SSIS but it is giving me an error while running as SQL Jobs or ...
1
vote
3
answers
120
views
Unable to cast to object
I had a code:
var result = BOBase.Search(Mapper.SourceBrowserType, searchCriteria);
var list = new List<IBO>(result.OfType<IBO>());
But I need to be able to add many elements in a list. I ...
3
votes
1
answer
97
views
Ruby method to compose Enumerator with function
If you have an enumerator and some callable (proc/lambda/method) it is sometimes handy to compose them to create a new enumerator, like this
class Enumerator
def compose func
Enumerator.new do |...
0
votes
1
answer
367
views
Use Enumerators in Rails 7 with MongoDB
I'm building a new project with Rails 7 and MongoDB 8. And I wanted to use enumerators for multiple fields ( states etc .. )
I wanted to use the gem mongoid-enum but it doesn't work with Mongo 8.
Is ...
1
vote
1
answer
279
views
C# parallel mapping iterator retaining order
I have an Enumerator<T> as input, a mapping function that converts a T to an S, and I want to deliver an Enumerator<S> containing the results of the mapping. The mapping function is ...
0
votes
1
answer
118
views
Access value from a Netsuite hash, Enumerator
Hi I am trying to extract a value from a Netsuite hash inside custom fields, and some others, which typically look like this - `
"custbody_delivery_ticket_number"=>
{
"script_id&...